diff --git a/testing/file_test/README.md b/testing/file_test/README.md index fdcb1b937549..30e1393a545b 100644 --- a/testing/file_test/README.md +++ b/testing/file_test/README.md @@ -148,3 +148,11 @@ Supported comment markers are: Output line matchers may contain `[[@LINE+offset]` and `{{regex}}` syntaxes, similar to `FileCheck`. + +- ``` + // TIP: + ``` + + Tips like this are added by autoupdate, for example providing commands to + run the test directly. Tips have no impact on validation; the marker informs + autoupdate that it can update or remove them as needed. diff --git a/testing/file_test/autoupdate.cpp b/testing/file_test/autoupdate.cpp index cbee60f2563d..e5eff253ce21 100644 --- a/testing/file_test/autoupdate.cpp +++ b/testing/file_test/autoupdate.cpp @@ -217,6 +217,22 @@ auto FileTestAutoupdater::AddRemappedNonCheckLine() -> void { .second); } +auto FileTestAutoupdater::AddTips() -> void { + CARBON_CHECK(tips_.empty()) << "Should only add tips once"; + + tips_.reserve(4); + // This puts commands on a single line so that they can be easily copied. + tips_.emplace_back("// TIP: To test this file alone, run:"); + tips_.emplace_back("// TIP: " + test_command_); + tips_.emplace_back("// TIP: To dump output, run:"); + tips_.emplace_back("// TIP: " + dump_command_); + + for (const auto& tip : tips_) { + new_lines_.push_back(&tip); + ++output_line_number_; + } +} + auto FileTestAutoupdater::ShouldAddCheckLine(const CheckLines& check_lines, bool to_file_end) const -> bool { return check_lines.cursor != check_lines.lines.end() && @@ -295,6 +311,7 @@ auto FileTestAutoupdater::Run(bool dry_run) -> bool { // we don't insert a blank line before the STDERR checks if there are no more // lines after AUTOUPDATE. AddRemappedNonCheckLine(); + AddTips(); AddCheckLines(stderr_, /*to_file_end=*/false); if (any_attached_stdout_lines_) { AddCheckLines(stdout_, /*to_file_end=*/false); diff --git a/testing/file_test/autoupdate.h b/testing/file_test/autoupdate.h index 128f7b67372b..4c5d00f1746a 100644 --- a/testing/file_test/autoupdate.h +++ b/testing/file_test/autoupdate.h @@ -34,8 +34,8 @@ class FileTestAutoupdater { }; explicit FileTestAutoupdater( - const std::filesystem::path& file_test_path, - llvm::StringRef input_content, + const std::filesystem::path& file_test_path, std::string test_command, + std::string dump_command, llvm::StringRef input_content, const llvm::SmallVector& filenames, int autoupdate_line_number, const llvm::SmallVector& non_check_lines, @@ -44,6 +44,8 @@ class FileTestAutoupdater { const llvm::SmallVector& line_number_replacements, std::function do_extra_check_replacements) : file_test_path_(file_test_path), + test_command_(std::move(test_command)), + dump_command_(std::move(dump_command)), input_content_(input_content), filenames_(filenames), autoupdate_line_number_(autoupdate_line_number), @@ -86,6 +88,20 @@ class FileTestAutoupdater { int line_number = -1; }; + // A TIP line added by autoupdate. Not associated with any line in output. + class TipLine : public FileTestLineBase { + public: + explicit TipLine(std::string line) + : FileTestLineBase(-1, -1), line_(std::move(line)) {} + + auto Print(llvm::raw_ostream& out) const -> void override { out << line_; } + + auto is_blank() const -> bool override { return line_.empty(); } + + private: + std::string line_; + }; + // A CHECK line which is integrated into autoupdate output. class CheckLine : public FileTestLineBase { public: @@ -150,6 +166,9 @@ class FileTestAutoupdater { // still needs to advance the cursor when ready. auto AddRemappedNonCheckLine() -> void; + // Adds TIP lines for file_test usage. + auto AddTips() -> void; + // Returns true if there's a CheckLine that should be added at // `to_line_number`. auto ShouldAddCheckLine(const CheckLines& check_lines, bool to_file_end) const @@ -171,6 +190,8 @@ class FileTestAutoupdater { // Passed-in state. const std::filesystem::path& file_test_path_; + std::string test_command_; + std::string dump_command_; llvm::StringRef input_content_; const llvm::SmallVector& filenames_; int autoupdate_line_number_; @@ -179,6 +200,9 @@ class FileTestAutoupdater { const llvm::SmallVector& line_number_replacements_; std::function do_extra_check_replacements_; + // Generated TIP lines, from AddTips. + llvm::SmallVector tips_; + // The constructed CheckLine list and cursor. CheckLines stdout_; CheckLines stderr_; diff --git a/testing/file_test/file_test_base.cpp b/testing/file_test/file_test_base.cpp index c2b8d903cf2c..8acd146ad2b8 100644 --- a/testing/file_test/file_test_base.cpp +++ b/testing/file_test/file_test_base.cpp @@ -49,10 +49,16 @@ using ::testing::MatchesRegex; using ::testing::StrEq; // Reads a file to string. -static auto ReadFile(std::string_view path) -> std::string { +static auto ReadFile(std::string_view path) -> ErrorOr { std::ifstream proto_file{std::string(path)}; + if (proto_file.fail()) { + return Error(llvm::formatv("Error opening file: {0}", path)); + } std::stringstream buffer; buffer << proto_file.rdbuf(); + if (proto_file.fail()) { + return Error(llvm::formatv("Error reading file: {0}", path)); + } proto_file.close(); return buffer.str(); } @@ -83,29 +89,50 @@ static auto CompareFailPrefix(llvm::StringRef filename, bool success) -> void { } } +// Modes for GetBazelCommand. +enum class BazelMode { + Autoupdate, + Dump, + Test, +}; + +// Returns the requested bazel command string for the given execution mode. +static auto GetBazelCommand(BazelMode mode, llvm::StringRef test_name) + -> std::string { + std::string args_str; + llvm::raw_string_ostream args(args_str); + + const char* target = getenv("TEST_TARGET"); + args << "bazel " << ((mode == BazelMode::Test) ? "test" : "run") << " " + << (target ? target : "") << " "; + + switch (mode) { + case BazelMode::Autoupdate: + args << "-- --autoupdate "; + break; + + case BazelMode::Dump: + args << "-- --dump_output "; + break; + + case BazelMode::Test: + args << "--test_arg="; + break; + } + + args << "--file_tests="; + args << test_name; + return args_str; +} + // Runs a test and compares output. This keeps output split by line so that // issues are a little easier to identify by the different line. auto FileTestBase::TestBody() -> void { - std::string test_command; - std::optional stack_trace_entry; - - // If we're being run from bazel, provide some assistance for understanding - // and reproducing failures. - const char* target = getenv("TEST_TARGET"); - if (target) { - constexpr const char* CommandFormat = - "bazel {0} {1} --test_arg=--file_tests={2}"; - test_command = llvm::formatv(CommandFormat, "test", target, test_name_); - // Add a crash trace entry with the run command. - stack_trace_entry.emplace(test_command.c_str()); - - // This advice overrides the --file_tests flag provided by the file_test - // rule. - llvm::errs() << "\nTo test this file alone, run:\n " << test_command - << "\n\nTo view output, run:\n " - << llvm::formatv(CommandFormat, "run", target, test_name_) - << " --test_arg=--dump_output\n\n"; - } + // Add a crash trace entry with the single-file test command. + std::string test_command = GetBazelCommand(BazelMode::Test, test_name_); + llvm::PrettyStackTraceString stack_trace_entry(test_command.c_str()); + llvm::errs() << "\nTo test this file alone, run:\n " << test_command + << "\n\n"; TestContext context; auto run_result = ProcessTestFileAndRun(context); @@ -140,11 +167,10 @@ auto FileTestBase::TestBody() -> void { // Check results. Include a reminder of the autoupdate command for any // stdout/stderr differences. std::string update_message; - if (target && context.autoupdate_line_number) { + if (context.autoupdate_line_number) { update_message = llvm::formatv( - "If these differences are expected, try the autoupdater:\n" - "\tbazel run {0} -- --autoupdate --file_tests={1}", - target, test_name_); + "If these differences are expected, try the autoupdater:\n {0}", + GetBazelCommand(BazelMode::Autoupdate, test_name_)); } else { update_message = "If these differences are expected, content must be updated manually."; @@ -193,8 +219,10 @@ auto FileTestBase::RunAutoupdater(const TestContext& context, bool dry_run) } return FileTestAutoupdater( - std::filesystem::absolute(test_name_.str()), context.input_content, - filenames, *context.autoupdate_line_number, + std::filesystem::absolute(test_name_.str()), + GetBazelCommand(BazelMode::Test, test_name_), + GetBazelCommand(BazelMode::Dump, test_name_), + context.input_content, filenames, *context.autoupdate_line_number, context.non_check_lines, context.stdout, context.stderr, GetDefaultFileRE(expected_filenames), GetLineNumberReplacements(expected_filenames), @@ -247,7 +275,7 @@ auto FileTestBase::GetLineNumberReplacements( auto FileTestBase::ProcessTestFileAndRun(TestContext& context) -> ErrorOr { // Store the file so that test_files can use references to content. - context.input_content = ReadFile(test_name_); + CARBON_ASSIGN_OR_RETURN(context.input_content, ReadFile(test_name_)); // Load expected output. CARBON_RETURN_IF_ERROR(ProcessTestFile(context)); @@ -370,9 +398,10 @@ static auto TryConsumeConflictMarker(llvm::StringRef line, return true; } - // Look for CHECK lines, which can be discarded. + // Look for CHECK and TIP lines, which can be discarded. if (line_trimmed.starts_with("// CHECK:STDOUT:") || - line_trimmed.starts_with("// CHECK:STDERR:")) { + line_trimmed.starts_with("// CHECK:STDERR:") || + line_trimmed.starts_with("// TIP:")) { return true; } @@ -738,6 +767,11 @@ auto FileTestBase::ProcessTestFile(TestContext& context) -> ErrorOr { ++line_index; + // TIP lines have no impact on validation. + if (line_trimmed.starts_with("// TIP:")) { + continue; + } + CARBON_ASSIGN_OR_RETURN( is_consumed, TryConsumeCheck(line_index, line, line_trimmed, @@ -801,8 +835,9 @@ static auto GetTests() -> llvm::SmallVector { CARBON_CHECK(!absl::GetFlag(FLAGS_test_targets_file).empty()) << "Missing --test_targets_file."; auto content = ReadFile(absl::GetFlag(FLAGS_test_targets_file)); + CARBON_CHECK(content.ok()) << content.error(); llvm::SmallVector all_tests; - for (llvm::StringRef file_ref : llvm::split(content, "\n")) { + for (llvm::StringRef file_ref : llvm::split(*content, "\n")) { if (file_ref.empty()) { continue; } diff --git a/testing/file_test/testdata/alternating_files.carbon b/testing/file_test/testdata/alternating_files.carbon index 775869befe3f..b726dcb84f3a 100644 --- a/testing/file_test/testdata/alternating_files.carbon +++ b/testing/file_test/testdata/alternating_files.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/alternating_files.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/alternating_files.carbon // CHECK:STDERR: unattached message 1 // CHECK:STDOUT: 3 args: `default_args`, `a.carbon`, `b.carbon` // CHECK:STDOUT: unattached message 1 diff --git a/testing/file_test/testdata/args.carbon b/testing/file_test/testdata/args.carbon index d1a21b5dd6ca..25e23471b307 100644 --- a/testing/file_test/testdata/args.carbon +++ b/testing/file_test/testdata/args.carbon @@ -4,5 +4,9 @@ // ARGS: abc file=%t %s // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/args.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/args.carbon // CHECK:STDOUT: 3 args: `abc`, `file={{.+}}/temp_file`, `args.carbon` diff --git a/testing/file_test/testdata/fail_example.carbon b/testing/file_test/testdata/fail_example.carbon index ca8e307d183c..9efcd9f681d3 100644 --- a/testing/file_test/testdata/fail_example.carbon +++ b/testing/file_test/testdata/fail_example.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/fail_example.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/fail_example.carbon // CHECK:STDERR: Oops // CHECK:STDOUT: 2 args: `default_args`, `fail_example.carbon` diff --git a/testing/file_test/testdata/fail_multi_success_overall_fail.carbon b/testing/file_test/testdata/fail_multi_success_overall_fail.carbon index 261cabec4bce..db2fc8266bc8 100644 --- a/testing/file_test/testdata/fail_multi_success_overall_fail.carbon +++ b/testing/file_test/testdata/fail_multi_success_overall_fail.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/fail_multi_success_overall_fail.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/fail_multi_success_overall_fail.carbon // --- a.carbon aaa diff --git a/testing/file_test/testdata/file_only_re_multi_file.carbon b/testing/file_test/testdata/file_only_re_multi_file.carbon index 02a3ad18386c..ede7d83dbda4 100644 --- a/testing/file_test/testdata/file_only_re_multi_file.carbon +++ b/testing/file_test/testdata/file_only_re_multi_file.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/file_only_re_multi_file.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/file_only_re_multi_file.carbon // CHECK:STDOUT: 3 args: `default_args`, `a.carbon`, `b.carbon` // CHECK:STDOUT: unattached message 1 diff --git a/testing/file_test/testdata/file_only_re_one_file.carbon b/testing/file_test/testdata/file_only_re_one_file.carbon index cd081ca3430b..4e49a753cef6 100644 --- a/testing/file_test/testdata/file_only_re_one_file.carbon +++ b/testing/file_test/testdata/file_only_re_one_file.carbon @@ -3,8 +3,12 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/file_only_re_one_file.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/file_only_re_one_file.carbon // CHECK:STDOUT: 2 args: `default_args`, `file_only_re_one_file.carbon` // CHECK:STDOUT: unattached message 1 // CHECK:STDOUT: file: file_only_re_one_file.carbon -// CHECK:STDOUT: line: [[@LINE-8]] +// CHECK:STDOUT: line: [[@LINE-12]] // CHECK:STDOUT: unattached message 2 diff --git a/testing/file_test/testdata/multi_success.carbon b/testing/file_test/testdata/multi_success.carbon index 261cabec4bce..8f6a77134e15 100644 --- a/testing/file_test/testdata/multi_success.carbon +++ b/testing/file_test/testdata/multi_success.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/multi_success.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/multi_success.carbon // --- a.carbon aaa diff --git a/testing/file_test/testdata/multi_success_and_fail.carbon b/testing/file_test/testdata/multi_success_and_fail.carbon index 45bc34f5c78d..558eb42f204f 100644 --- a/testing/file_test/testdata/multi_success_and_fail.carbon +++ b/testing/file_test/testdata/multi_success_and_fail.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/multi_success_and_fail.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/multi_success_and_fail.carbon // --- a.carbon aaa diff --git a/testing/file_test/testdata/not_split.carbon b/testing/file_test/testdata/not_split.carbon index 98115951922d..627c881d0691 100644 --- a/testing/file_test/testdata/not_split.carbon +++ b/testing/file_test/testdata/not_split.carbon @@ -3,5 +3,9 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/not_split.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/not_split.carbon // CHECK:STDOUT: 2 args: `default_args`, `not_split.carbon` -// CHECK:STDOUT: not_split.carbon:[[@LINE-6]]: starts with "// Part of the Carbon Language project, ", length 7 lines +// CHECK:STDOUT: not_split.carbon:[[@LINE-10]]: starts with "// Part of the Carbon Language project, ", length 11 lines diff --git a/testing/file_test/testdata/two_files.carbon b/testing/file_test/testdata/two_files.carbon index 7d5ae7b7f564..b3399ffb2632 100644 --- a/testing/file_test/testdata/two_files.carbon +++ b/testing/file_test/testdata/two_files.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/two_files.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/two_files.carbon // CHECK:STDOUT: 3 args: `default_args`, `a.carbon`, `b.carbon` // --- a.carbon diff --git a/testing/file_test/testdata/unattached_multi_file.carbon b/testing/file_test/testdata/unattached_multi_file.carbon index 7c54423489e3..b6d730f96009 100644 --- a/testing/file_test/testdata/unattached_multi_file.carbon +++ b/testing/file_test/testdata/unattached_multi_file.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //testing/file_test:file_test_base_test --test_arg=--file_tests=testing/file_test/testdata/unattached_multi_file.carbon +// TIP: To dump output, run: +// TIP: bazel run //testing/file_test:file_test_base_test -- --dump_output --file_tests=testing/file_test/testdata/unattached_multi_file.carbon // CHECK:STDERR: unattached message 3 // CHECK:STDERR: unattached message 4 diff --git a/toolchain/check/testdata/alias/fail_bool_value.carbon b/toolchain/check/testdata/alias/fail_bool_value.carbon index 72dc20c7ea29..575ca910440c 100644 --- a/toolchain/check/testdata/alias/fail_bool_value.carbon +++ b/toolchain/check/testdata/alias/fail_bool_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/fail_bool_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_bool_value.carbon // CHECK:STDERR: fail_bool_value.carbon:[[@LINE+3]]:11: ERROR: Alias initializer must be a name reference. // CHECK:STDERR: alias a = false; @@ -25,12 +29,12 @@ let a_test: bool = a; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10: bool = bool_literal false [template = constants.%.1] +// CHECK:STDOUT: %.loc14: bool = bool_literal false [template = constants.%.1] // CHECK:STDOUT: %a: = bind_alias a, [template = ] // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc11_13.2: type = converted %bool.make_type, %.loc11_13.1 [template = bool] +// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc15_13.2: type = converted %bool.make_type, %.loc15_13.1 [template = bool] // CHECK:STDOUT: %a.ref: = name_ref a, %a [template = ] // CHECK:STDOUT: %a_test: bool = bind_name a_test, // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/fail_builtins.carbon b/toolchain/check/testdata/alias/fail_builtins.carbon index abe6aefdfe91..eee1ea19bf16 100644 --- a/toolchain/check/testdata/alias/fail_builtins.carbon +++ b/toolchain/check/testdata/alias/fail_builtins.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/fail_builtins.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_builtins.carbon // CHECK:STDERR: fail_builtins.carbon:[[@LINE+4]]:11: ERROR: Alias initializer must be a name reference. // CHECK:STDERR: alias a = i32; diff --git a/toolchain/check/testdata/alias/fail_control_flow.carbon b/toolchain/check/testdata/alias/fail_control_flow.carbon index 2478d11a8352..290047f7e8e7 100644 --- a/toolchain/check/testdata/alias/fail_control_flow.carbon +++ b/toolchain/check/testdata/alias/fail_control_flow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/fail_control_flow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/fail_control_flow.carbon // CHECK:STDERR: fail_control_flow.carbon:[[@LINE+11]]:11: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: alias a = true or false; @@ -25,7 +29,7 @@ alias a = true or false; // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc18: bool = block_arg [template = constants.%.1] +// CHECK:STDOUT: %.loc22: bool = block_arg [template = constants.%.1] // CHECK:STDOUT: %a: = bind_alias a, [template = ] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon b/toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon index 4dbaf73bc89f..0ee363bc9c2a 100644 --- a/toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon +++ b/toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon class C {} alias a = C; @@ -35,13 +39,13 @@ let d: c = {}; // CHECK:STDOUT: %b.ref: type = name_ref b, %b [template = constants.%C] // CHECK:STDOUT: %c: type = bind_alias c, %b [template = constants.%C] // CHECK:STDOUT: %c.ref: type = name_ref c, %c [template = constants.%C] -// CHECK:STDOUT: %.loc11_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc11_13.2: ref C = temporary_storage -// CHECK:STDOUT: %.loc11_13.3: init C = class_init (), %.loc11_13.2 [template = constants.%struct] -// CHECK:STDOUT: %.loc11_13.4: ref C = temporary %.loc11_13.2, %.loc11_13.3 -// CHECK:STDOUT: %.loc11_14.1: ref C = converted %.loc11_13.1, %.loc11_13.4 -// CHECK:STDOUT: %.loc11_14.2: C = bind_value %.loc11_14.1 -// CHECK:STDOUT: %d: C = bind_name d, %.loc11_14.2 +// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc15_13.2: ref C = temporary_storage +// CHECK:STDOUT: %.loc15_13.3: init C = class_init (), %.loc15_13.2 [template = constants.%struct] +// CHECK:STDOUT: %.loc15_13.4: ref C = temporary %.loc15_13.2, %.loc15_13.3 +// CHECK:STDOUT: %.loc15_14.1: ref C = converted %.loc15_13.1, %.loc15_13.4 +// CHECK:STDOUT: %.loc15_14.2: C = bind_value %.loc15_14.1 +// CHECK:STDOUT: %d: C = bind_name d, %.loc15_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { diff --git a/toolchain/check/testdata/alias/no_prelude/export_name.carbon b/toolchain/check/testdata/alias/no_prelude/export_name.carbon index f71539908ede..d7d39bdc336e 100644 --- a/toolchain/check/testdata/alias/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/alias/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon b/toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon index 7112a3908aaf..85e20f13477b 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon class C {} class D {} @@ -57,10 +61,10 @@ let c_var: c = d; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc11_13.2: init D = class_init (), file.%d.var [template = constants.%struct] -// CHECK:STDOUT: %.loc11_14: init D = converted %.loc11_13.1, %.loc11_13.2 [template = constants.%struct] -// CHECK:STDOUT: assign file.%d.var, %.loc11_14 +// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc15_13.2: init D = class_init (), file.%d.var [template = constants.%struct] +// CHECK:STDOUT: %.loc15_14: init D = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct] +// CHECK:STDOUT: assign file.%d.var, %.loc15_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon b/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon index 411ca104789f..17841af31ae9 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon namespace NS; @@ -38,16 +42,16 @@ fn F() -> {} { // CHECK:STDOUT: } // CHECK:STDOUT: %NS: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc9_12.1: {} = struct_literal () -// CHECK:STDOUT: %.loc9_12.2: type = converted %.loc9_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_12.1: {} = struct_literal () +// CHECK:STDOUT: %.loc13_12.2: type = converted %.loc13_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> {} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_17: {} = struct_literal () -// CHECK:STDOUT: %.loc18_12: = bind_alias , [template = ] +// CHECK:STDOUT: %.loc22_17: {} = struct_literal () +// CHECK:STDOUT: %.loc22_12: = bind_alias , [template = ] // CHECK:STDOUT: %NS.ref: = name_ref NS, file.%NS [template = file.%NS] // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon index 0485d6fd5a3b..85677aad24ed 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon class Class {} @@ -59,11 +63,11 @@ extern alias C = Class; // CHECK:STDOUT: .C = %C // CHECK:STDOUT: } // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Class.ref.loc34: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc38: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %A: type = bind_alias A, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %Class.ref.loc40: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc44: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %B: type = bind_alias B, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc49: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %C: type = bind_alias C, %Class.decl [template = constants.%Class] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon b/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon index 04ec8347877d..97a8c1941e31 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon class C {} @@ -38,20 +42,20 @@ alias b = C; // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .a = %a.loc9 +// CHECK:STDOUT: .a = %a.loc13 // CHECK:STDOUT: .b = %b // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} -// CHECK:STDOUT: %C.ref.loc9: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc9: type = bind_alias a, %C.decl [template = constants.%C] -// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc13: type = bind_alias a, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a.var: ref C = var a -// CHECK:STDOUT: %a.loc17: ref C = bind_name a, %a.var -// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc21: ref C = bind_name a, %a.var +// CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %b.var: ref C = var b // CHECK:STDOUT: %b: ref C = bind_name b, %b.var -// CHECK:STDOUT: %C.ref.loc26: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = bind_alias , %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc30: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = bind_alias , %C.decl [template = constants.%C] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -61,14 +65,14 @@ alias b = C; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc17_13.2: init C = class_init (), file.%a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc17_14: init C = converted %.loc17_13.1, %.loc17_13.2 [template = constants.%struct] -// CHECK:STDOUT: assign file.%a.var, %.loc17_14 -// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), file.%b.var [template = constants.%struct] -// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct] -// CHECK:STDOUT: assign file.%b.var, %.loc19_14 +// CHECK:STDOUT: %.loc21_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc21_13.2: init C = class_init (), file.%a.var [template = constants.%struct] +// CHECK:STDOUT: %.loc21_14: init C = converted %.loc21_13.1, %.loc21_13.2 [template = constants.%struct] +// CHECK:STDOUT: assign file.%a.var, %.loc21_14 +// CHECK:STDOUT: %.loc23_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc23_13.2: init C = class_init (), file.%b.var [template = constants.%struct] +// CHECK:STDOUT: %.loc23_14: init C = converted %.loc23_13.1, %.loc23_13.2 [template = constants.%struct] +// CHECK:STDOUT: assign file.%b.var, %.loc23_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon b/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon index 194a0bf80493..611b0d51393e 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon fn F() { var a: () = (); @@ -32,25 +36,25 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_16.2: init () = tuple_init () to %a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_17: init () = converted %.loc8_16.1, %.loc8_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %a.var, %.loc8_17 -// CHECK:STDOUT: %.loc9_11: () = tuple_literal () -// CHECK:STDOUT: %.loc9_12.1: type = converted %.loc9_11, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_12.2: type = ptr_type () [template = constants.%.2] +// CHECK:STDOUT: %.loc12_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_16.2: init () = tuple_init () to %a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_17: init () = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %a.var, %.loc12_17 +// CHECK:STDOUT: %.loc13_11: () = tuple_literal () +// CHECK:STDOUT: %.loc13_12.1: type = converted %.loc13_11, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_12.2: type = ptr_type () [template = constants.%.2] // CHECK:STDOUT: %b.var: ref ()* = var b // CHECK:STDOUT: %b: ref ()* = bind_name b, %b.var // CHECK:STDOUT: %a.ref: ref () = name_ref a, %a -// CHECK:STDOUT: %.loc9_16: ()* = addr_of %a.ref -// CHECK:STDOUT: assign %b.var, %.loc9_16 +// CHECK:STDOUT: %.loc13_16: ()* = addr_of %a.ref +// CHECK:STDOUT: assign %b.var, %.loc13_16 // CHECK:STDOUT: %b.ref: ref ()* = name_ref b, %b -// CHECK:STDOUT: %.loc13_14: ()* = bind_value %b.ref -// CHECK:STDOUT: %.loc13_13: ref () = deref %.loc13_14 +// CHECK:STDOUT: %.loc17_14: ()* = bind_value %b.ref +// CHECK:STDOUT: %.loc17_13: ref () = deref %.loc17_14 // CHECK:STDOUT: %c: = bind_alias c, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/alias/no_prelude/fail_params.carbon b/toolchain/check/testdata/alias/no_prelude/fail_params.carbon index cdc0e240aa41..e3de0d7a71fd 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_params.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_params.carbon // CHECK:STDERR: fail_params.carbon:[[@LINE+7]]:8: ERROR: `alias` declaration cannot have parameters. // CHECK:STDERR: alias A(T:! type) = T*; @@ -24,10 +28,10 @@ alias A(T:! type) = T*; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .A = %A // CHECK:STDOUT: } -// CHECK:STDOUT: %T.loc14_9.1: type = param T -// CHECK:STDOUT: %T.loc14_9.2: type = bind_symbolic_name T 0, %T.loc14_9.1 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_9.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc14: type = ptr_type T [symbolic = constants.%.1] +// CHECK:STDOUT: %T.loc18_9.1: type = param T +// CHECK:STDOUT: %T.loc18_9.2: type = bind_symbolic_name T 0, %T.loc18_9.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc18_9.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc18: type = ptr_type T [symbolic = constants.%.1] // CHECK:STDOUT: %A: = bind_alias A, [template = ] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon b/toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon index 39153f0c7ecd..996306802f70 100644 --- a/toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon +++ b/toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon class C {} // CHECK:STDERR: fail_todo_private.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `access modifier`. diff --git a/toolchain/check/testdata/alias/no_prelude/import.carbon b/toolchain/check/testdata/alias/no_prelude/import.carbon index a59335e607fc..a5746f1f80e2 100644 --- a/toolchain/check/testdata/alias/no_prelude/import.carbon +++ b/toolchain/check/testdata/alias/no_prelude/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/import.carbon // --- class1.carbon diff --git a/toolchain/check/testdata/alias/no_prelude/import_order.carbon b/toolchain/check/testdata/alias/no_prelude/import_order.carbon index d183ea1e98bc..85e6ecec2f5f 100644 --- a/toolchain/check/testdata/alias/no_prelude/import_order.carbon +++ b/toolchain/check/testdata/alias/no_prelude/import_order.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/import_order.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/import_order.carbon // --- a.carbon diff --git a/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon b/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon index 1a0a581c4a23..26b52591fa65 100644 --- a/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon +++ b/toolchain/check/testdata/alias/no_prelude/in_namespace.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/in_namespace.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/in_namespace.carbon class C { var v: (); } @@ -41,45 +45,45 @@ fn F() -> NS.a { // CHECK:STDOUT: } // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %a: type = bind_alias a, %C.decl [template = constants.%C] -// CHECK:STDOUT: %NS.ref.loc12: = name_ref NS, %NS [template = %NS] -// CHECK:STDOUT: %a.ref.loc12: type = name_ref a, %a [template = constants.%C] -// CHECK:STDOUT: %.loc12_22.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_23.1: {.v: ()} = struct_literal (%.loc12_22.1) -// CHECK:STDOUT: %.loc12_23.2: ref C = temporary_storage -// CHECK:STDOUT: %.loc12_23.3: ref () = class_element_access %.loc12_23.2, element0 -// CHECK:STDOUT: %.loc12_22.2: init () = tuple_init () to %.loc12_23.3 [template = constants.%tuple] -// CHECK:STDOUT: %.loc12_23.4: init () = converted %.loc12_22.1, %.loc12_22.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc12_23.5: init C = class_init (%.loc12_23.4), %.loc12_23.2 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc12_23.6: ref C = temporary %.loc12_23.2, %.loc12_23.5 -// CHECK:STDOUT: %.loc12_24.1: ref C = converted %.loc12_23.1, %.loc12_23.6 -// CHECK:STDOUT: %.loc12_24.2: C = bind_value %.loc12_24.1 -// CHECK:STDOUT: %b: C = bind_name b, %.loc12_24.2 +// CHECK:STDOUT: %NS.ref.loc16: = name_ref NS, %NS [template = %NS] +// CHECK:STDOUT: %a.ref.loc16: type = name_ref a, %a [template = constants.%C] +// CHECK:STDOUT: %.loc16_22.1: () = tuple_literal () +// CHECK:STDOUT: %.loc16_23.1: {.v: ()} = struct_literal (%.loc16_22.1) +// CHECK:STDOUT: %.loc16_23.2: ref C = temporary_storage +// CHECK:STDOUT: %.loc16_23.3: ref () = class_element_access %.loc16_23.2, element0 +// CHECK:STDOUT: %.loc16_22.2: init () = tuple_init () to %.loc16_23.3 [template = constants.%tuple] +// CHECK:STDOUT: %.loc16_23.4: init () = converted %.loc16_22.1, %.loc16_22.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc16_23.5: init C = class_init (%.loc16_23.4), %.loc16_23.2 [template = constants.%struct.1] +// CHECK:STDOUT: %.loc16_23.6: ref C = temporary %.loc16_23.2, %.loc16_23.5 +// CHECK:STDOUT: %.loc16_24.1: ref C = converted %.loc16_23.1, %.loc16_23.6 +// CHECK:STDOUT: %.loc16_24.2: C = bind_value %.loc16_24.1 +// CHECK:STDOUT: %b: C = bind_name b, %.loc16_24.2 // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %NS.ref.loc14: = name_ref NS, %NS [template = %NS] -// CHECK:STDOUT: %a.ref.loc14: type = name_ref a, %a [template = constants.%C] +// CHECK:STDOUT: %NS.ref.loc18: = name_ref NS, %NS [template = %NS] +// CHECK:STDOUT: %a.ref.loc18: type = name_ref a, %a [template = constants.%C] // CHECK:STDOUT: @F.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc7_19.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_19.2: type = converted %.loc7_19.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_16: = field_decl v, element0 [template] +// CHECK:STDOUT: %.loc11_19.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_16: = field_decl v, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .v = %.loc7_16 +// CHECK:STDOUT: .v = %.loc11_16 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_17.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_18.1: {.v: ()} = struct_literal (%.loc15_17.1) -// CHECK:STDOUT: %.loc15_18.2: ref () = class_element_access %return, element0 -// CHECK:STDOUT: %.loc15_17.2: init () = tuple_init () to %.loc15_18.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_18.3: init () = converted %.loc15_17.1, %.loc15_17.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_18.4: init C = class_init (%.loc15_18.3), %return [template = constants.%struct.1] -// CHECK:STDOUT: %.loc15_19: init C = converted %.loc15_18.1, %.loc15_18.4 [template = constants.%struct.1] -// CHECK:STDOUT: return %.loc15_19 to %return +// CHECK:STDOUT: %.loc19_17.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_18.1: {.v: ()} = struct_literal (%.loc19_17.1) +// CHECK:STDOUT: %.loc19_18.2: ref () = class_element_access %return, element0 +// CHECK:STDOUT: %.loc19_17.2: init () = tuple_init () to %.loc19_18.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc19_18.3: init () = converted %.loc19_17.1, %.loc19_17.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc19_18.4: init C = class_init (%.loc19_18.3), %return [template = constants.%struct.1] +// CHECK:STDOUT: %.loc19_19: init C = converted %.loc19_18.1, %.loc19_18.4 [template = constants.%struct.1] +// CHECK:STDOUT: return %.loc19_19 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/alias/no_prelude/local.carbon b/toolchain/check/testdata/alias/no_prelude/local.carbon index 051927643ea5..b07f889f7a40 100644 --- a/toolchain/check/testdata/alias/no_prelude/local.carbon +++ b/toolchain/check/testdata/alias/no_prelude/local.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/alias/no_prelude/local.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/local.carbon fn F() -> () { var a: () = (); @@ -24,27 +28,27 @@ fn F() -> () { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> () { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_16.2: init () = tuple_init () to %a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_17: init () = converted %.loc8_16.1, %.loc8_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %a.var, %.loc8_17 +// CHECK:STDOUT: %.loc12_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_16.2: init () = tuple_init () to %a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_17: init () = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %a.var, %.loc12_17 // CHECK:STDOUT: %a.ref: ref () = name_ref a, %a // CHECK:STDOUT: %b: ref () = bind_alias b, %a // CHECK:STDOUT: %b.ref: ref () = name_ref b, %b // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc10: () = converted %b.ref, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc10 +// CHECK:STDOUT: %.loc14: () = converted %b.ref, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/array_in_place.carbon b/toolchain/check/testdata/array/array_in_place.carbon index af4fc07f90b8..9aa38d5147ed 100644 --- a/toolchain/check/testdata/array/array_in_place.carbon +++ b/toolchain/check/testdata/array/array_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/array_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/array_in_place.carbon fn F() -> (i32, i32, i32); @@ -42,17 +46,17 @@ fn G() { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17, %int.make_type_32.loc7_22) -// CHECK:STDOUT: %.loc7_25.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_25.3: type = converted %int.make_type_32.loc7_12, %.loc7_25.2 [template = i32] -// CHECK:STDOUT: %.loc7_25.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_25.5: type = converted %int.make_type_32.loc7_17, %.loc7_25.4 [template = i32] -// CHECK:STDOUT: %.loc7_25.6: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32] -// CHECK:STDOUT: %.loc7_25.7: type = converted %int.make_type_32.loc7_22, %.loc7_25.6 [template = i32] -// CHECK:STDOUT: %.loc7_25.8: type = converted %.loc7_25.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc11_12, %int.make_type_32.loc11_17, %int.make_type_32.loc11_22) +// CHECK:STDOUT: %.loc11_25.2: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_25.3: type = converted %int.make_type_32.loc11_12, %.loc11_25.2 [template = i32] +// CHECK:STDOUT: %.loc11_25.4: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_25.5: type = converted %int.make_type_32.loc11_17, %.loc11_25.4 [template = i32] +// CHECK:STDOUT: %.loc11_25.6: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_25.7: type = converted %int.make_type_32.loc11_22, %.loc11_25.6 [template = i32] +// CHECK:STDOUT: %.loc11_25.8: type = converted %.loc11_25.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} @@ -67,37 +71,37 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_12, %int.make_type_32.loc10_17, %int.make_type_32.loc10_22) -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_25.2: type = value_of_initializer %int.make_type_32.loc10_12 [template = i32] -// CHECK:STDOUT: %.loc10_25.3: type = converted %int.make_type_32.loc10_12, %.loc10_25.2 [template = i32] -// CHECK:STDOUT: %.loc10_25.4: type = value_of_initializer %int.make_type_32.loc10_17 [template = i32] -// CHECK:STDOUT: %.loc10_25.5: type = converted %int.make_type_32.loc10_17, %.loc10_25.4 [template = i32] -// CHECK:STDOUT: %.loc10_25.6: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] -// CHECK:STDOUT: %.loc10_25.7: type = converted %int.make_type_32.loc10_22, %.loc10_25.6 [template = i32] -// CHECK:STDOUT: %.loc10_25.8: type = converted %.loc10_25.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_29: type = array_type %.loc10_28, (i32, i32, i32) [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc14_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc14_12, %int.make_type_32.loc14_17, %int.make_type_32.loc14_22) +// CHECK:STDOUT: %.loc14_28: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_25.2: type = value_of_initializer %int.make_type_32.loc14_12 [template = i32] +// CHECK:STDOUT: %.loc14_25.3: type = converted %int.make_type_32.loc14_12, %.loc14_25.2 [template = i32] +// CHECK:STDOUT: %.loc14_25.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32] +// CHECK:STDOUT: %.loc14_25.5: type = converted %int.make_type_32.loc14_17, %.loc14_25.4 [template = i32] +// CHECK:STDOUT: %.loc14_25.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_25.7: type = converted %int.make_type_32.loc14_22, %.loc14_25.6 [template = i32] +// CHECK:STDOUT: %.loc14_25.8: type = converted %.loc14_25.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_29: type = array_type %.loc14_28, (i32, i32, i32) [template = constants.%.5] // CHECK:STDOUT: %v.var: ref [(i32, i32, i32); 2] = var v // CHECK:STDOUT: %v: ref [(i32, i32, i32); 2] = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_34: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_42.3: ref (i32, i32, i32) = splice_block %.loc10_42.2 { -// CHECK:STDOUT: %.loc10_42.1: i32 = int_literal 0 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.1 +// CHECK:STDOUT: %F.ref.loc14_34: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_42.3: ref (i32, i32, i32) = splice_block %.loc14_42.2 { +// CHECK:STDOUT: %.loc14_42.1: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_42.2: ref (i32, i32, i32) = array_index %v.var, %.loc14_42.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.call.loc10_35: init (i32, i32, i32) = call %F.ref.loc10_34() to %.loc10_42.3 -// CHECK:STDOUT: %F.ref.loc10_39: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_42.6: ref (i32, i32, i32) = splice_block %.loc10_42.5 { -// CHECK:STDOUT: %.loc10_42.4: i32 = int_literal 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc10_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc10_42.4 +// CHECK:STDOUT: %F.call.loc14_35: init (i32, i32, i32) = call %F.ref.loc14_34() to %.loc14_42.3 +// CHECK:STDOUT: %F.ref.loc14_39: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_42.6: ref (i32, i32, i32) = splice_block %.loc14_42.5 { +// CHECK:STDOUT: %.loc14_42.4: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc14_42.5: ref (i32, i32, i32) = array_index %v.var, %.loc14_42.4 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.call.loc10_40: init (i32, i32, i32) = call %F.ref.loc10_39() to %.loc10_42.6 -// CHECK:STDOUT: %.loc10_42.7: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc10_35, %F.call.loc10_40) -// CHECK:STDOUT: %.loc10_42.8: init [(i32, i32, i32); 2] = array_init (%F.call.loc10_35, %F.call.loc10_40) to %v.var -// CHECK:STDOUT: %.loc10_43: init [(i32, i32, i32); 2] = converted %.loc10_42.7, %.loc10_42.8 -// CHECK:STDOUT: assign %v.var, %.loc10_43 +// CHECK:STDOUT: %F.call.loc14_40: init (i32, i32, i32) = call %F.ref.loc14_39() to %.loc14_42.6 +// CHECK:STDOUT: %.loc14_42.7: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc14_35, %F.call.loc14_40) +// CHECK:STDOUT: %.loc14_42.8: init [(i32, i32, i32); 2] = array_init (%F.call.loc14_35, %F.call.loc14_40) to %v.var +// CHECK:STDOUT: %.loc14_43: init [(i32, i32, i32); 2] = converted %.loc14_42.7, %.loc14_42.8 +// CHECK:STDOUT: assign %v.var, %.loc14_43 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/array_vs_tuple.carbon b/toolchain/check/testdata/array/array_vs_tuple.carbon index a54c2fa3749c..45485ec809f4 100644 --- a/toolchain/check/testdata/array/array_vs_tuple.carbon +++ b/toolchain/check/testdata/array/array_vs_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/array_vs_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/array_vs_tuple.carbon fn G() { // These should have two different constant values. @@ -46,55 +50,55 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32.loc9, %.loc9_11.1 [template = i32] -// CHECK:STDOUT: %.loc9_17: type = array_type %.loc9_16, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] +// CHECK:STDOUT: %.loc13_17: type = array_type %.loc13_16, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc9_22: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_25: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_28: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_29.1: (i32, i32, i32) = tuple_literal (%.loc9_22, %.loc9_25, %.loc9_28) -// CHECK:STDOUT: %.loc9_29.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_29.3: ref i32 = array_index %a.var, %.loc9_29.2 -// CHECK:STDOUT: %.loc9_29.4: init i32 = initialize_from %.loc9_22 to %.loc9_29.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_29.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_29.6: ref i32 = array_index %a.var, %.loc9_29.5 -// CHECK:STDOUT: %.loc9_29.7: init i32 = initialize_from %.loc9_25 to %.loc9_29.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_29.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_29.9: ref i32 = array_index %a.var, %.loc9_29.8 -// CHECK:STDOUT: %.loc9_29.10: init i32 = initialize_from %.loc9_28 to %.loc9_29.9 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_29.11: init [i32; 3] = array_init (%.loc9_29.4, %.loc9_29.7, %.loc9_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc9_30: init [i32; 3] = converted %.loc9_29.1, %.loc9_29.11 [template = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc9_30 -// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_11, %int.make_type_32.loc10_16, %int.make_type_32.loc10_21) -// CHECK:STDOUT: %.loc10_24.2: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] -// CHECK:STDOUT: %.loc10_24.3: type = converted %int.make_type_32.loc10_11, %.loc10_24.2 [template = i32] -// CHECK:STDOUT: %.loc10_24.4: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] -// CHECK:STDOUT: %.loc10_24.5: type = converted %int.make_type_32.loc10_16, %.loc10_24.4 [template = i32] -// CHECK:STDOUT: %.loc10_24.6: type = value_of_initializer %int.make_type_32.loc10_21 [template = i32] -// CHECK:STDOUT: %.loc10_24.7: type = converted %int.make_type_32.loc10_21, %.loc10_24.6 [template = i32] -// CHECK:STDOUT: %.loc10_24.8: type = converted %.loc10_24.1, constants.%.7 [template = constants.%.7] +// CHECK:STDOUT: %.loc13_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_28: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_29.1: (i32, i32, i32) = tuple_literal (%.loc13_22, %.loc13_25, %.loc13_28) +// CHECK:STDOUT: %.loc13_29.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_29.3: ref i32 = array_index %a.var, %.loc13_29.2 +// CHECK:STDOUT: %.loc13_29.4: init i32 = initialize_from %.loc13_22 to %.loc13_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_29.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_29.6: ref i32 = array_index %a.var, %.loc13_29.5 +// CHECK:STDOUT: %.loc13_29.7: init i32 = initialize_from %.loc13_25 to %.loc13_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_29.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_29.9: ref i32 = array_index %a.var, %.loc13_29.8 +// CHECK:STDOUT: %.loc13_29.10: init i32 = initialize_from %.loc13_28 to %.loc13_29.9 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_29.11: init [i32; 3] = array_init (%.loc13_29.4, %.loc13_29.7, %.loc13_29.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_30: init [i32; 3] = converted %.loc13_29.1, %.loc13_29.11 [template = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc13_30 +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_21: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc14_11, %int.make_type_32.loc14_16, %int.make_type_32.loc14_21) +// CHECK:STDOUT: %.loc14_24.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_24.3: type = converted %int.make_type_32.loc14_11, %.loc14_24.2 [template = i32] +// CHECK:STDOUT: %.loc14_24.4: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_24.5: type = converted %int.make_type_32.loc14_16, %.loc14_24.4 [template = i32] +// CHECK:STDOUT: %.loc14_24.6: type = value_of_initializer %int.make_type_32.loc14_21 [template = i32] +// CHECK:STDOUT: %.loc14_24.7: type = converted %int.make_type_32.loc14_21, %.loc14_24.6 [template = i32] +// CHECK:STDOUT: %.loc14_24.8: type = converted %.loc14_24.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: %b.var: ref (i32, i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32, i32) = bind_name b, %b.var -// CHECK:STDOUT: %.loc10_29: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_32: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_36.1: (i32, i32, i32) = tuple_literal (%.loc10_29, %.loc10_32, %.loc10_35) -// CHECK:STDOUT: %.loc10_36.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc10_36.3: init i32 = initialize_from %.loc10_29 to %.loc10_36.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_36.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc10_36.5: init i32 = initialize_from %.loc10_32 to %.loc10_36.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_36.6: ref i32 = tuple_access %b.var, element2 -// CHECK:STDOUT: %.loc10_36.7: init i32 = initialize_from %.loc10_35 to %.loc10_36.6 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_36.8: init (i32, i32, i32) = tuple_init (%.loc10_36.3, %.loc10_36.5, %.loc10_36.7) to %b.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_37: init (i32, i32, i32) = converted %.loc10_36.1, %.loc10_36.8 [template = constants.%tuple] -// CHECK:STDOUT: assign %b.var, %.loc10_37 +// CHECK:STDOUT: %.loc14_29: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_32: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_35: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_36.1: (i32, i32, i32) = tuple_literal (%.loc14_29, %.loc14_32, %.loc14_35) +// CHECK:STDOUT: %.loc14_36.2: ref i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc14_36.3: init i32 = initialize_from %.loc14_29 to %.loc14_36.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_36.4: ref i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc14_36.5: init i32 = initialize_from %.loc14_32 to %.loc14_36.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_36.6: ref i32 = tuple_access %b.var, element2 +// CHECK:STDOUT: %.loc14_36.7: init i32 = initialize_from %.loc14_35 to %.loc14_36.6 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_36.8: init (i32, i32, i32) = tuple_init (%.loc14_36.3, %.loc14_36.5, %.loc14_36.7) to %b.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_37: init (i32, i32, i32) = converted %.loc14_36.1, %.loc14_36.8 [template = constants.%tuple] +// CHECK:STDOUT: assign %b.var, %.loc14_37 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/assign_return_value.carbon b/toolchain/check/testdata/array/assign_return_value.carbon index 98917a99dda7..0e0f931569c2 100644 --- a/toolchain/check/testdata/array/assign_return_value.carbon +++ b/toolchain/check/testdata/array/assign_return_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/assign_return_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/assign_return_value.carbon fn F() -> (i32,) { return (0,); } @@ -39,10 +43,10 @@ fn Run() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (%int.make_type_32) -// CHECK:STDOUT: %.loc7_16.2: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_16.3: type = converted %int.make_type_32, %.loc7_16.2 [template = i32] -// CHECK:STDOUT: %.loc7_16.4: type = converted %.loc7_16.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_16.1: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc11_16.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_16.3: type = converted %int.make_type_32, %.loc11_16.2 [template = i32] +// CHECK:STDOUT: %.loc11_16.4: type = converted %.loc11_16.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32,) = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] {} @@ -53,34 +57,34 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_30: (i32,) = tuple_literal (%.loc7_28) -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc7_28) [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_31: (i32,) = converted %.loc7_30, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc7_31 +// CHECK:STDOUT: %.loc11_28: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_30: (i32,) = tuple_literal (%.loc11_28) +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc11_28) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_31: (i32,) = converted %.loc11_30, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc11_31 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32, %.loc10_11.1 [template = i32] -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_16: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32, %.loc14_11.1 [template = i32] +// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, i32 [template = constants.%.6] // CHECK:STDOUT: %t.var: ref [i32; 1] = var t // CHECK:STDOUT: %t: ref [i32; 1] = bind_name t, %t.var // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_22.1: ref (i32,) = temporary_storage -// CHECK:STDOUT: %.loc10_22.2: ref (i32,) = temporary %.loc10_22.1, %F.call -// CHECK:STDOUT: %.loc10_22.3: ref i32 = tuple_access %.loc10_22.2, element0 -// CHECK:STDOUT: %.loc10_22.4: i32 = bind_value %.loc10_22.3 -// CHECK:STDOUT: %.loc10_22.5: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_22.6: ref i32 = array_index %t.var, %.loc10_22.5 -// CHECK:STDOUT: %.loc10_22.7: init i32 = initialize_from %.loc10_22.4 to %.loc10_22.6 -// CHECK:STDOUT: %.loc10_22.8: init [i32; 1] = array_init (%.loc10_22.7) to %t.var -// CHECK:STDOUT: %.loc10_24: init [i32; 1] = converted %F.call, %.loc10_22.8 -// CHECK:STDOUT: assign %t.var, %.loc10_24 +// CHECK:STDOUT: %.loc14_22.1: ref (i32,) = temporary_storage +// CHECK:STDOUT: %.loc14_22.2: ref (i32,) = temporary %.loc14_22.1, %F.call +// CHECK:STDOUT: %.loc14_22.3: ref i32 = tuple_access %.loc14_22.2, element0 +// CHECK:STDOUT: %.loc14_22.4: i32 = bind_value %.loc14_22.3 +// CHECK:STDOUT: %.loc14_22.5: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_22.6: ref i32 = array_index %t.var, %.loc14_22.5 +// CHECK:STDOUT: %.loc14_22.7: init i32 = initialize_from %.loc14_22.4 to %.loc14_22.6 +// CHECK:STDOUT: %.loc14_22.8: init [i32; 1] = array_init (%.loc14_22.7) to %t.var +// CHECK:STDOUT: %.loc14_24: init [i32; 1] = converted %F.call, %.loc14_22.8 +// CHECK:STDOUT: assign %t.var, %.loc14_24 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/assign_var.carbon b/toolchain/check/testdata/array/assign_var.carbon index 993173b62c7a..1925c85d10de 100644 --- a/toolchain/check/testdata/array/assign_var.carbon +++ b/toolchain/check/testdata/array/assign_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/assign_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/assign_var.carbon var a: (i32, i32, i32) = (1, 2, 3); var b: [i32; 3] = a; @@ -33,27 +37,27 @@ var b: [i32; 3] = a; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_22.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14, %int.make_type_32.loc7_19) -// CHECK:STDOUT: %.loc7_22.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_22.3: type = converted %int.make_type_32.loc7_9, %.loc7_22.2 [template = i32] -// CHECK:STDOUT: %.loc7_22.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_22.5: type = converted %int.make_type_32.loc7_14, %.loc7_22.4 [template = i32] -// CHECK:STDOUT: %.loc7_22.6: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_22.7: type = converted %int.make_type_32.loc7_19, %.loc7_22.6 [template = i32] -// CHECK:STDOUT: %.loc7_22.8: type = converted %.loc7_22.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_22.1: (type, type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14, %int.make_type_32.loc11_19) +// CHECK:STDOUT: %.loc11_22.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_22.3: type = converted %int.make_type_32.loc11_9, %.loc11_22.2 [template = i32] +// CHECK:STDOUT: %.loc11_22.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_22.5: type = converted %int.make_type_32.loc11_14, %.loc11_22.4 [template = i32] +// CHECK:STDOUT: %.loc11_22.6: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_22.7: type = converted %int.make_type_32.loc11_19, %.loc11_22.6 [template = i32] +// CHECK:STDOUT: %.loc11_22.8: type = converted %.loc11_22.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_9.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_9.2: type = converted %int.make_type_32.loc8, %.loc8_9.1 [template = i32] -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, i32 [template = constants.%.8] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_9.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_9.2: type = converted %int.make_type_32.loc12, %.loc12_9.1 [template = i32] +// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14, i32 [template = constants.%.8] // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: } @@ -62,38 +66,38 @@ var b: [i32; 3] = a; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_27: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_30: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_33: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_34.1: (i32, i32, i32) = tuple_literal (%.loc7_27, %.loc7_30, %.loc7_33) -// CHECK:STDOUT: %.loc7_34.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_34.3: init i32 = initialize_from %.loc7_27 to %.loc7_34.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_34.5: init i32 = initialize_from %.loc7_30 to %.loc7_34.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_34.6: ref i32 = tuple_access file.%a.var, element2 -// CHECK:STDOUT: %.loc7_34.7: init i32 = initialize_from %.loc7_33 to %.loc7_34.6 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_34.8: init (i32, i32, i32) = tuple_init (%.loc7_34.3, %.loc7_34.5, %.loc7_34.7) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_35: init (i32, i32, i32) = converted %.loc7_34.1, %.loc7_34.8 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_35 +// CHECK:STDOUT: %.loc11_27: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_30: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_33: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_34.1: (i32, i32, i32) = tuple_literal (%.loc11_27, %.loc11_30, %.loc11_33) +// CHECK:STDOUT: %.loc11_34.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_34.3: init i32 = initialize_from %.loc11_27 to %.loc11_34.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_34.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_34.5: init i32 = initialize_from %.loc11_30 to %.loc11_34.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_34.6: ref i32 = tuple_access file.%a.var, element2 +// CHECK:STDOUT: %.loc11_34.7: init i32 = initialize_from %.loc11_33 to %.loc11_34.6 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_34.8: init (i32, i32, i32) = tuple_init (%.loc11_34.3, %.loc11_34.5, %.loc11_34.7) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_35: init (i32, i32, i32) = converted %.loc11_34.1, %.loc11_34.8 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_35 // CHECK:STDOUT: %a.ref: ref (i32, i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_19.1: ref i32 = tuple_access %a.ref, element0 -// CHECK:STDOUT: %.loc8_19.2: i32 = bind_value %.loc8_19.1 -// CHECK:STDOUT: %.loc8_19.3: i32 = int_literal 0 [template = constants.%.10] -// CHECK:STDOUT: %.loc8_19.4: ref i32 = array_index file.%b.var, %.loc8_19.3 -// CHECK:STDOUT: %.loc8_19.5: init i32 = initialize_from %.loc8_19.2 to %.loc8_19.4 -// CHECK:STDOUT: %.loc8_19.6: ref i32 = tuple_access %a.ref, element1 -// CHECK:STDOUT: %.loc8_19.7: i32 = bind_value %.loc8_19.6 -// CHECK:STDOUT: %.loc8_19.8: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_19.9: ref i32 = array_index file.%b.var, %.loc8_19.8 -// CHECK:STDOUT: %.loc8_19.10: init i32 = initialize_from %.loc8_19.7 to %.loc8_19.9 -// CHECK:STDOUT: %.loc8_19.11: ref i32 = tuple_access %a.ref, element2 -// CHECK:STDOUT: %.loc8_19.12: i32 = bind_value %.loc8_19.11 -// CHECK:STDOUT: %.loc8_19.13: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_19.14: ref i32 = array_index file.%b.var, %.loc8_19.13 -// CHECK:STDOUT: %.loc8_19.15: init i32 = initialize_from %.loc8_19.12 to %.loc8_19.14 -// CHECK:STDOUT: %.loc8_19.16: init [i32; 3] = array_init (%.loc8_19.5, %.loc8_19.10, %.loc8_19.15) to file.%b.var -// CHECK:STDOUT: %.loc8_20: init [i32; 3] = converted %a.ref, %.loc8_19.16 -// CHECK:STDOUT: assign file.%b.var, %.loc8_20 +// CHECK:STDOUT: %.loc12_19.1: ref i32 = tuple_access %a.ref, element0 +// CHECK:STDOUT: %.loc12_19.2: i32 = bind_value %.loc12_19.1 +// CHECK:STDOUT: %.loc12_19.3: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc12_19.4: ref i32 = array_index file.%b.var, %.loc12_19.3 +// CHECK:STDOUT: %.loc12_19.5: init i32 = initialize_from %.loc12_19.2 to %.loc12_19.4 +// CHECK:STDOUT: %.loc12_19.6: ref i32 = tuple_access %a.ref, element1 +// CHECK:STDOUT: %.loc12_19.7: i32 = bind_value %.loc12_19.6 +// CHECK:STDOUT: %.loc12_19.8: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_19.9: ref i32 = array_index file.%b.var, %.loc12_19.8 +// CHECK:STDOUT: %.loc12_19.10: init i32 = initialize_from %.loc12_19.7 to %.loc12_19.9 +// CHECK:STDOUT: %.loc12_19.11: ref i32 = tuple_access %a.ref, element2 +// CHECK:STDOUT: %.loc12_19.12: i32 = bind_value %.loc12_19.11 +// CHECK:STDOUT: %.loc12_19.13: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_19.14: ref i32 = array_index file.%b.var, %.loc12_19.13 +// CHECK:STDOUT: %.loc12_19.15: init i32 = initialize_from %.loc12_19.12 to %.loc12_19.14 +// CHECK:STDOUT: %.loc12_19.16: init [i32; 3] = array_init (%.loc12_19.5, %.loc12_19.10, %.loc12_19.15) to file.%b.var +// CHECK:STDOUT: %.loc12_20: init [i32; 3] = converted %a.ref, %.loc12_19.16 +// CHECK:STDOUT: assign file.%b.var, %.loc12_20 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/base.carbon b/toolchain/check/testdata/array/base.carbon index ec7f07734f2e..c7574a88dffb 100644 --- a/toolchain/check/testdata/array/base.carbon +++ b/toolchain/check/testdata/array/base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/base.carbon var a: [i32; 1] = (1,); var b: [f64; 2] = (11.1, 2.2,); @@ -50,25 +54,25 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_9.1: i32 = int_literal 64 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_9.1: i32 = int_literal 64 [template = constants.%.7] // CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.2(%.loc8_9.1) [template = f64] -// CHECK:STDOUT: %.loc8_14: i32 = int_literal 2 [template = constants.%.8] -// CHECK:STDOUT: %.loc8_9.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc8_9.3: type = converted %float.make_type, %.loc8_9.2 [template = f64] -// CHECK:STDOUT: %.loc8_15: type = array_type %.loc8_14, f64 [template = constants.%.9] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.2(%.loc12_9.1) [template = f64] +// CHECK:STDOUT: %.loc12_14: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc12_9.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc12_9.3: type = converted %float.make_type, %.loc12_9.2 [template = f64] +// CHECK:STDOUT: %.loc12_15: type = array_type %.loc12_14, f64 [template = constants.%.9] // CHECK:STDOUT: %b.var: ref [f64; 2] = var b // CHECK:STDOUT: %b: ref [f64; 2] = bind_name b, %b.var -// CHECK:STDOUT: %.loc9_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_13: i32 = int_literal 5 [template = constants.%.14] -// CHECK:STDOUT: %.loc9_10.2: type = converted %.loc9_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc9_14: type = array_type %.loc9_13, () [template = constants.%.15] +// CHECK:STDOUT: %.loc13_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_13: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc13_10.2: type = converted %.loc13_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc13_14: type = array_type %.loc13_13, () [template = constants.%.15] // CHECK:STDOUT: %c.var: ref [(); 5] = var c // CHECK:STDOUT: %c: ref [(); 5] = bind_name c, %c.var // CHECK:STDOUT: } @@ -79,55 +83,55 @@ var c: [(); 5] = ((), (), (), (), (),); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_22.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_22.2: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_22.3: ref i32 = array_index file.%a.var, %.loc7_22.2 -// CHECK:STDOUT: %.loc7_22.4: init i32 = initialize_from %.loc7_20 to %.loc7_22.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_22.5: init [i32; 1] = array_init (%.loc7_22.4) to file.%a.var [template = constants.%array.1] -// CHECK:STDOUT: %.loc7_23: init [i32; 1] = converted %.loc7_22.1, %.loc7_22.5 [template = constants.%array.1] -// CHECK:STDOUT: assign file.%a.var, %.loc7_23 -// CHECK:STDOUT: %.loc8_20: f64 = float_literal 11.100000000000001 [template = constants.%.11] -// CHECK:STDOUT: %.loc8_26: f64 = float_literal 2.2000000000000002 [template = constants.%.12] -// CHECK:STDOUT: %.loc8_30.1: (f64, f64) = tuple_literal (%.loc8_20, %.loc8_26) -// CHECK:STDOUT: %.loc8_30.2: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_30.3: ref f64 = array_index file.%b.var, %.loc8_30.2 -// CHECK:STDOUT: %.loc8_30.4: init f64 = initialize_from %.loc8_20 to %.loc8_30.3 [template = constants.%.11] -// CHECK:STDOUT: %.loc8_30.5: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_30.6: ref f64 = array_index file.%b.var, %.loc8_30.5 -// CHECK:STDOUT: %.loc8_30.7: init f64 = initialize_from %.loc8_26 to %.loc8_30.6 [template = constants.%.12] -// CHECK:STDOUT: %.loc8_30.8: init [f64; 2] = array_init (%.loc8_30.4, %.loc8_30.7) to file.%b.var [template = constants.%array.2] -// CHECK:STDOUT: %.loc8_31: init [f64; 2] = converted %.loc8_30.1, %.loc8_30.8 [template = constants.%array.2] -// CHECK:STDOUT: assign file.%b.var, %.loc8_31 -// CHECK:STDOUT: %.loc9_20.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_24.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_28.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_32.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_36.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_38.1: ((), (), (), (), ()) = tuple_literal (%.loc9_20.1, %.loc9_24.1, %.loc9_28.1, %.loc9_32.1, %.loc9_36.1) -// CHECK:STDOUT: %.loc9_38.2: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_38.3: ref () = array_index file.%c.var, %.loc9_38.2 -// CHECK:STDOUT: %.loc9_20.2: init () = tuple_init () to %.loc9_38.3 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.4: init () = converted %.loc9_20.1, %.loc9_20.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.5: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_38.6: ref () = array_index file.%c.var, %.loc9_38.5 -// CHECK:STDOUT: %.loc9_24.2: init () = tuple_init () to %.loc9_38.6 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.7: init () = converted %.loc9_24.1, %.loc9_24.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.8: i32 = int_literal 2 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_38.9: ref () = array_index file.%c.var, %.loc9_38.8 -// CHECK:STDOUT: %.loc9_28.2: init () = tuple_init () to %.loc9_38.9 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.10: init () = converted %.loc9_28.1, %.loc9_28.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.11: i32 = int_literal 3 [template = constants.%.18] -// CHECK:STDOUT: %.loc9_38.12: ref () = array_index file.%c.var, %.loc9_38.11 -// CHECK:STDOUT: %.loc9_32.2: init () = tuple_init () to %.loc9_38.12 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.13: init () = converted %.loc9_32.1, %.loc9_32.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.14: i32 = int_literal 4 [template = constants.%.19] -// CHECK:STDOUT: %.loc9_38.15: ref () = array_index file.%c.var, %.loc9_38.14 -// CHECK:STDOUT: %.loc9_36.2: init () = tuple_init () to %.loc9_38.15 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.16: init () = converted %.loc9_36.1, %.loc9_36.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_38.17: init [(); 5] = array_init (%.loc9_38.4, %.loc9_38.7, %.loc9_38.10, %.loc9_38.13, %.loc9_38.16) to file.%c.var [template = constants.%array.3] -// CHECK:STDOUT: %.loc9_39: init [(); 5] = converted %.loc9_38.1, %.loc9_38.17 [template = constants.%array.3] -// CHECK:STDOUT: assign file.%c.var, %.loc9_39 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_22.1: (i32,) = tuple_literal (%.loc11_20) +// CHECK:STDOUT: %.loc11_22.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_22.3: ref i32 = array_index file.%a.var, %.loc11_22.2 +// CHECK:STDOUT: %.loc11_22.4: init i32 = initialize_from %.loc11_20 to %.loc11_22.3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_22.5: init [i32; 1] = array_init (%.loc11_22.4) to file.%a.var [template = constants.%array.1] +// CHECK:STDOUT: %.loc11_23: init [i32; 1] = converted %.loc11_22.1, %.loc11_22.5 [template = constants.%array.1] +// CHECK:STDOUT: assign file.%a.var, %.loc11_23 +// CHECK:STDOUT: %.loc12_20: f64 = float_literal 11.100000000000001 [template = constants.%.11] +// CHECK:STDOUT: %.loc12_26: f64 = float_literal 2.2000000000000002 [template = constants.%.12] +// CHECK:STDOUT: %.loc12_30.1: (f64, f64) = tuple_literal (%.loc12_20, %.loc12_26) +// CHECK:STDOUT: %.loc12_30.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_30.3: ref f64 = array_index file.%b.var, %.loc12_30.2 +// CHECK:STDOUT: %.loc12_30.4: init f64 = initialize_from %.loc12_20 to %.loc12_30.3 [template = constants.%.11] +// CHECK:STDOUT: %.loc12_30.5: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_30.6: ref f64 = array_index file.%b.var, %.loc12_30.5 +// CHECK:STDOUT: %.loc12_30.7: init f64 = initialize_from %.loc12_26 to %.loc12_30.6 [template = constants.%.12] +// CHECK:STDOUT: %.loc12_30.8: init [f64; 2] = array_init (%.loc12_30.4, %.loc12_30.7) to file.%b.var [template = constants.%array.2] +// CHECK:STDOUT: %.loc12_31: init [f64; 2] = converted %.loc12_30.1, %.loc12_30.8 [template = constants.%array.2] +// CHECK:STDOUT: assign file.%b.var, %.loc12_31 +// CHECK:STDOUT: %.loc13_20.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_24.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_28.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_32.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_36.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_38.1: ((), (), (), (), ()) = tuple_literal (%.loc13_20.1, %.loc13_24.1, %.loc13_28.1, %.loc13_32.1, %.loc13_36.1) +// CHECK:STDOUT: %.loc13_38.2: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_38.3: ref () = array_index file.%c.var, %.loc13_38.2 +// CHECK:STDOUT: %.loc13_20.2: init () = tuple_init () to %.loc13_38.3 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.4: init () = converted %.loc13_20.1, %.loc13_20.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.5: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_38.6: ref () = array_index file.%c.var, %.loc13_38.5 +// CHECK:STDOUT: %.loc13_24.2: init () = tuple_init () to %.loc13_38.6 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.7: init () = converted %.loc13_24.1, %.loc13_24.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.8: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_38.9: ref () = array_index file.%c.var, %.loc13_38.8 +// CHECK:STDOUT: %.loc13_28.2: init () = tuple_init () to %.loc13_38.9 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.10: init () = converted %.loc13_28.1, %.loc13_28.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.11: i32 = int_literal 3 [template = constants.%.18] +// CHECK:STDOUT: %.loc13_38.12: ref () = array_index file.%c.var, %.loc13_38.11 +// CHECK:STDOUT: %.loc13_32.2: init () = tuple_init () to %.loc13_38.12 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.13: init () = converted %.loc13_32.1, %.loc13_32.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.14: i32 = int_literal 4 [template = constants.%.19] +// CHECK:STDOUT: %.loc13_38.15: ref () = array_index file.%c.var, %.loc13_38.14 +// CHECK:STDOUT: %.loc13_36.2: init () = tuple_init () to %.loc13_38.15 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.16: init () = converted %.loc13_36.1, %.loc13_36.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_38.17: init [(); 5] = array_init (%.loc13_38.4, %.loc13_38.7, %.loc13_38.10, %.loc13_38.13, %.loc13_38.16) to file.%c.var [template = constants.%array.3] +// CHECK:STDOUT: %.loc13_39: init [(); 5] = converted %.loc13_38.1, %.loc13_38.17 [template = constants.%array.3] +// CHECK:STDOUT: assign file.%c.var, %.loc13_39 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/canonicalize_index.carbon b/toolchain/check/testdata/array/canonicalize_index.carbon index aa8c5452942d..da3d3fa2490a 100644 --- a/toolchain/check/testdata/array/canonicalize_index.carbon +++ b/toolchain/check/testdata/array/canonicalize_index.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/canonicalize_index.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/canonicalize_index.carbon fn Add(a: i32, b: i32) -> i32 = "int.sadd"; @@ -31,49 +35,49 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Add = %Add.decl -// CHECK:STDOUT: .a = %a.loc9 +// CHECK:STDOUT: .a = %a.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %int.make_type_32.loc7_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %int.make_type_32.loc7_27 [template = i32] -// CHECK:STDOUT: %.loc7_27.2: type = converted %int.make_type_32.loc7_27, %.loc7_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc11_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_27.1: type = value_of_initializer %int.make_type_32.loc11_27 [template = i32] +// CHECK:STDOUT: %.loc11_27.2: type = converted %int.make_type_32.loc11_27, %.loc11_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_18: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_21: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_18, %.loc9_21) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_9.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_9.2: type = converted %int.make_type_32.loc9, %.loc9_9.1 [template = i32] -// CHECK:STDOUT: %.loc9_23: type = array_type %int.sadd, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_18: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_21: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc13_18, %.loc13_21) [template = constants.%.4] +// CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_32.loc13, %.loc13_9.1 [template = i32] +// CHECK:STDOUT: %.loc13_23: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a -// CHECK:STDOUT: %a.loc9: ref [i32; 3] = bind_name a, %a.var +// CHECK:STDOUT: %a.loc13: ref [i32; 3] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32.loc10, %.loc10_9.1 [template = i32] -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_16: type = ptr_type [i32; 3] [template = constants.%.6] -// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a.loc9 -// CHECK:STDOUT: %.loc10_20: [i32; 3]* = addr_of %a.ref -// CHECK:STDOUT: %b.loc10: [i32; 3]* = bind_name b, %.loc10_20 +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_14: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14, %.loc14_9.1 [template = i32] +// CHECK:STDOUT: %.loc14_15: type = array_type %.loc14_14, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_16: type = ptr_type [i32; 3] [template = constants.%.6] +// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a.loc13 +// CHECK:STDOUT: %.loc14_20: [i32; 3]* = addr_of %a.ref +// CHECK:STDOUT: %b.loc14: [i32; 3]* = bind_name b, %.loc14_20 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -82,22 +86,22 @@ let b: [i32; 3]* = &a; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_28: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_31: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_34: i32 = int_literal 3 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_35.1: (i32, i32, i32) = tuple_literal (%.loc9_28, %.loc9_31, %.loc9_34) -// CHECK:STDOUT: %.loc9_35.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_35.3: ref i32 = array_index file.%a.var, %.loc9_35.2 -// CHECK:STDOUT: %.loc9_35.4: init i32 = initialize_from %.loc9_28 to %.loc9_35.3 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_35.5: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_35.6: ref i32 = array_index file.%a.var, %.loc9_35.5 -// CHECK:STDOUT: %.loc9_35.7: init i32 = initialize_from %.loc9_31 to %.loc9_35.6 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_35.8: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc9_35.9: ref i32 = array_index file.%a.var, %.loc9_35.8 -// CHECK:STDOUT: %.loc9_35.10: init i32 = initialize_from %.loc9_34 to %.loc9_35.9 [template = constants.%.4] -// CHECK:STDOUT: %.loc9_35.11: init [i32; 3] = array_init (%.loc9_35.4, %.loc9_35.7, %.loc9_35.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc9_36: init [i32; 3] = converted %.loc9_35.1, %.loc9_35.11 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc9_36 +// CHECK:STDOUT: %.loc13_28: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_31: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_34: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_35.1: (i32, i32, i32) = tuple_literal (%.loc13_28, %.loc13_31, %.loc13_34) +// CHECK:STDOUT: %.loc13_35.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_35.3: ref i32 = array_index file.%a.var, %.loc13_35.2 +// CHECK:STDOUT: %.loc13_35.4: init i32 = initialize_from %.loc13_28 to %.loc13_35.3 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_35.5: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_35.6: ref i32 = array_index file.%a.var, %.loc13_35.5 +// CHECK:STDOUT: %.loc13_35.7: init i32 = initialize_from %.loc13_31 to %.loc13_35.6 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_35.8: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc13_35.9: ref i32 = array_index file.%a.var, %.loc13_35.8 +// CHECK:STDOUT: %.loc13_35.10: init i32 = initialize_from %.loc13_34 to %.loc13_35.9 [template = constants.%.4] +// CHECK:STDOUT: %.loc13_35.11: init [i32; 3] = array_init (%.loc13_35.4, %.loc13_35.7, %.loc13_35.10) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc13_36: init [i32; 3] = converted %.loc13_35.1, %.loc13_35.11 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc13_36 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/fail_bound_negative.carbon b/toolchain/check/testdata/array/fail_bound_negative.carbon index d631e4c864ea..f3c4d6c68b97 100644 --- a/toolchain/check/testdata/array/fail_bound_negative.carbon +++ b/toolchain/check/testdata/array/fail_bound_negative.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_bound_negative.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_bound_negative.carbon fn Negate(n: i32) -> i32 = "int.snegate"; @@ -33,24 +37,24 @@ var a: [i32; Negate(1)]; // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Negate.decl: Negate = fn_decl @Negate [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32.loc7_14, %.loc7_14.1 [template = i32] -// CHECK:STDOUT: %n.loc7_11.1: i32 = param n -// CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc7_11.1 -// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_22.1: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32] -// CHECK:STDOUT: %.loc7_22.2: type = converted %int.make_type_32.loc7_22, %.loc7_22.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11_14, %.loc11_14.1 [template = i32] +// CHECK:STDOUT: %n.loc11_11.1: i32 = param n +// CHECK:STDOUT: @Negate.%n: i32 = bind_name n, %n.loc11_11.1 +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_22.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_22.2: type = converted %int.make_type_32.loc11_22, %.loc11_22.1 [template = i32] // CHECK:STDOUT: @Negate.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %Negate.ref: Negate = name_ref Negate, %Negate.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc12_21) [template = constants.%.3] -// CHECK:STDOUT: %.loc12_9.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_9.2: type = converted %int.make_type_32.loc12, %.loc12_9.1 [template = i32] -// CHECK:STDOUT: %.loc12_23: type = array_type %int.snegate, i32 [template = ] +// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %int.snegate: init i32 = call %Negate.ref(%.loc16_21) [template = constants.%.3] +// CHECK:STDOUT: %.loc16_9.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_9.2: type = converted %int.make_type_32.loc16, %.loc16_9.1 [template = i32] +// CHECK:STDOUT: %.loc16_23: type = array_type %int.snegate, i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_bound_overflow.carbon b/toolchain/check/testdata/array/fail_bound_overflow.carbon index 8dfe35f2c5a5..6cfe687e4b67 100644 --- a/toolchain/check/testdata/array/fail_bound_overflow.carbon +++ b/toolchain/check/testdata/array/fail_bound_overflow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_bound_overflow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_bound_overflow.carbon // TODO: Once we preserve the full value of integer literals in SemIR, check // that we reject the array bound being too large. @@ -40,13 +44,13 @@ var b: [1; 39999999999999999993]; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32, %.loc14_9.1 [template = i32] -// CHECK:STDOUT: %.loc14_34: type = array_type , i32 [template = ] +// CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32, %.loc18_9.1 [template = i32] +// CHECK:STDOUT: %.loc18_34: type = array_type , i32 [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %.loc23_9: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc23_32: type = array_type , [template = ] +// CHECK:STDOUT: %.loc27_9: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc27_32: type = array_type , [template = ] // CHECK:STDOUT: %b.var: ref = var b // CHECK:STDOUT: %b: ref = bind_name b, %b.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_incomplete_element.carbon b/toolchain/check/testdata/array/fail_incomplete_element.carbon index d53e963287a4..0bdf9f74f41c 100644 --- a/toolchain/check/testdata/array/fail_incomplete_element.carbon +++ b/toolchain/check/testdata/array/fail_incomplete_element.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_incomplete_element.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_incomplete_element.carbon class Incomplete; @@ -35,13 +39,13 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc15_22: type = array_type %.loc15_21, Incomplete [template = constants.%.2] +// CHECK:STDOUT: %Incomplete.ref.loc19: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc19_21: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_22: type = array_type %.loc19_21, Incomplete [template = constants.%.2] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.3] +// CHECK:STDOUT: %Incomplete.ref.loc21: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc21: type = ptr_type Incomplete [template = constants.%.3] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: } @@ -51,8 +55,8 @@ var p: Incomplete* = &a[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: ref = name_ref a, file.%a -// CHECK:STDOUT: %.loc17_25: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_22: = addr_of [template = ] +// CHECK:STDOUT: %.loc21_25: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc21_22: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_invalid_type.carbon b/toolchain/check/testdata/array/fail_invalid_type.carbon index 9e90c28fd948..60d828bcb82b 100644 --- a/toolchain/check/testdata/array/fail_invalid_type.carbon +++ b/toolchain/check/testdata/array/fail_invalid_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_invalid_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_invalid_type.carbon // CHECK:STDERR: fail_invalid_type.carbon:[[@LINE+3]]:9: ERROR: Cannot implicitly convert from `i32` to `type`. // CHECK:STDERR: var a: [1; 1]; @@ -21,9 +25,9 @@ var a: [1; 1]; // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_12: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_13: type = array_type %.loc10_12, [template = ] +// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_12: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_13: type = array_type %.loc14_12, [template = ] // CHECK:STDOUT: %a.var: ref = var a // CHECK:STDOUT: %a: ref = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_out_of_bound.carbon b/toolchain/check/testdata/array/fail_out_of_bound.carbon index 5be48b859cf2..70ed9674f083 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_out_of_bound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound.carbon // CHECK:STDERR: fail_out_of_bound.carbon:[[@LINE+3]]:19: ERROR: Cannot initialize array of 1 element(s) from 3 initializer(s). // CHECK:STDERR: var a: [i32; 1] = (1, 2, 3); @@ -31,10 +35,10 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32, %.loc10_9.1 [template = i32] -// CHECK:STDOUT: %.loc10_15: type = array_type %.loc10_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32, %.loc14_9.1 [template = i32] +// CHECK:STDOUT: %.loc14_15: type = array_type %.loc14_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var // CHECK:STDOUT: } @@ -43,10 +47,10 @@ var a: [i32; 1] = (1, 2, 3); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_23: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_26: i32 = int_literal 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_27: (i32, i32, i32) = tuple_literal (%.loc10_20, %.loc10_23, %.loc10_26) +// CHECK:STDOUT: %.loc14_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_23: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_26: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_27: (i32, i32, i32) = tuple_literal (%.loc14_20, %.loc14_23, %.loc14_26) // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon index 62039573a52e..db90d2b728c3 100644 --- a/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon +++ b/toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon var a: [i32; 3] = (1, 2, 3); // CHECK:STDERR: fail_out_of_bound_non_literal.carbon:[[@LINE+3]]:16: ERROR: Array index `3` is past the end of type `[i32; 3]`. @@ -36,17 +40,17 @@ var b: i32 = a[{.index = 3}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -55,31 +59,31 @@ var b: i32 = a[{.index = 3}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_27.3: ref i32 = array_index file.%a.var, %.loc7_27.2 -// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.6: ref i32 = array_index file.%a.var, %.loc7_27.5 -// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.9: ref i32 = array_index file.%a.var, %.loc7_27.8 -// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_27.11: init [i32; 3] = array_init (%.loc7_27.4, %.loc7_27.7, %.loc7_27.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_28: init [i32; 3] = converted %.loc7_27.1, %.loc7_27.11 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 -// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, file.%a +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23: i32 = int_literal 2 [template = constants.%.6] // CHECK:STDOUT: %.loc11_26: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_27.1: {.index: i32} = struct_literal (%.loc11_26) -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc11_26) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11_27.2: {.index: i32} = converted %.loc11_27.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11_28: i32 = struct_access %.loc11_27.2, element0 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_34.1: ref i32 = array_index %a.ref, %.loc11_28 [template = ] -// CHECK:STDOUT: %.loc11_34.2: i32 = bind_value %.loc11_34.1 -// CHECK:STDOUT: assign file.%b.var, %.loc11_34.2 +// CHECK:STDOUT: %.loc11_27.1: (i32, i32, i32) = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_27.3: ref i32 = array_index file.%a.var, %.loc11_27.2 +// CHECK:STDOUT: %.loc11_27.4: init i32 = initialize_from %.loc11_20 to %.loc11_27.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.6: ref i32 = array_index file.%a.var, %.loc11_27.5 +// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_23 to %.loc11_27.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.9: ref i32 = array_index file.%a.var, %.loc11_27.8 +// CHECK:STDOUT: %.loc11_27.10: init i32 = initialize_from %.loc11_26 to %.loc11_27.9 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_27.11: init [i32; 3] = array_init (%.loc11_27.4, %.loc11_27.7, %.loc11_27.10) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_28: init [i32; 3] = converted %.loc11_27.1, %.loc11_27.11 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 +// CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, file.%a +// CHECK:STDOUT: %.loc15_26: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_27.1: {.index: i32} = struct_literal (%.loc15_26) +// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc15_26) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_27.2: {.index: i32} = converted %.loc15_27.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_28: i32 = struct_access %.loc15_27.2, element0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_34.1: ref i32 = array_index %a.ref, %.loc15_28 [template = ] +// CHECK:STDOUT: %.loc15_34.2: i32 = bind_value %.loc15_34.1 +// CHECK:STDOUT: assign file.%b.var, %.loc15_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/fail_type_mismatch.carbon b/toolchain/check/testdata/array/fail_type_mismatch.carbon index 1f3a94f1daed..40873fb76a1b 100644 --- a/toolchain/check/testdata/array/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/array/fail_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_type_mismatch.carbon // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+4]]:19: ERROR: Cannot implicitly convert from `String` to `i32`. // CHECK:STDERR: var a: [i32; 3] = (1, "Hello", "World"); @@ -65,55 +69,55 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15, %.loc15_9.1 [template = i32] +// CHECK:STDOUT: %.loc15_15: type = array_type %.loc15_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc13_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc13, String, String) -// CHECK:STDOUT: %.loc13_29.2: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_29.3: type = converted %int.make_type_32.loc13, %.loc13_29.2 [template = i32] -// CHECK:STDOUT: %.loc13_29.4: type = converted %.loc13_29.1, constants.%.9 [template = constants.%.9] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc17, String, String) +// CHECK:STDOUT: %.loc17_29.2: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_29.3: type = converted %int.make_type_32.loc17, %.loc17_29.2 [template = i32] +// CHECK:STDOUT: %.loc17_29.4: type = converted %.loc17_29.1, constants.%.9 [template = constants.%.9] // CHECK:STDOUT: %t1.var: ref (i32, String, String) = var t1 // CHECK:STDOUT: %t1: ref (i32, String, String) = bind_name t1, %t1.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc18_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32.loc18, %.loc18_9.1 [template = i32] -// CHECK:STDOUT: %.loc18_15: type = array_type %.loc18_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc22_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_9.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_9.2: type = converted %int.make_type_32.loc22, %.loc22_9.1 [template = i32] +// CHECK:STDOUT: %.loc22_15: type = array_type %.loc22_14, i32 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref [i32; 3] = var b // CHECK:STDOUT: %b: ref [i32; 3] = bind_name b, %b.var // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc24_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc24_9.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] -// CHECK:STDOUT: %.loc24_9.2: type = converted %int.make_type_32.loc24, %.loc24_9.1 [template = i32] -// CHECK:STDOUT: %.loc24_15: type = array_type %.loc24_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc28_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc28_9.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_9.2: type = converted %int.make_type_32.loc28, %.loc28_9.1 [template = i32] +// CHECK:STDOUT: %.loc28_15: type = array_type %.loc28_14, i32 [template = constants.%.3] // CHECK:STDOUT: %c.var: ref [i32; 3] = var c // CHECK:STDOUT: %c: ref [i32; 3] = bind_name c, %c.var // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc26_10: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc30_10: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc26_15: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc26_18.1: (type, type) = tuple_literal (%int.make_type_32.loc26_10, %int.make_type_32.loc26_15) -// CHECK:STDOUT: %.loc26_18.2: type = value_of_initializer %int.make_type_32.loc26_10 [template = i32] -// CHECK:STDOUT: %.loc26_18.3: type = converted %int.make_type_32.loc26_10, %.loc26_18.2 [template = i32] -// CHECK:STDOUT: %.loc26_18.4: type = value_of_initializer %int.make_type_32.loc26_15 [template = i32] -// CHECK:STDOUT: %.loc26_18.5: type = converted %int.make_type_32.loc26_15, %.loc26_18.4 [template = i32] -// CHECK:STDOUT: %.loc26_18.6: type = converted %.loc26_18.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %int.make_type_32.loc30_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc30_18.1: (type, type) = tuple_literal (%int.make_type_32.loc30_10, %int.make_type_32.loc30_15) +// CHECK:STDOUT: %.loc30_18.2: type = value_of_initializer %int.make_type_32.loc30_10 [template = i32] +// CHECK:STDOUT: %.loc30_18.3: type = converted %int.make_type_32.loc30_10, %.loc30_18.2 [template = i32] +// CHECK:STDOUT: %.loc30_18.4: type = value_of_initializer %int.make_type_32.loc30_15 [template = i32] +// CHECK:STDOUT: %.loc30_18.5: type = converted %int.make_type_32.loc30_15, %.loc30_18.4 [template = i32] +// CHECK:STDOUT: %.loc30_18.6: type = converted %.loc30_18.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: %t2.var: ref (i32, i32) = var t2 // CHECK:STDOUT: %t2: ref (i32, i32) = bind_name t2, %t2.var // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc30_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_9.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] -// CHECK:STDOUT: %.loc30_9.2: type = converted %int.make_type_32.loc30, %.loc30_9.1 [template = i32] -// CHECK:STDOUT: %.loc30_15: type = array_type %.loc30_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc34_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc34_9.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_9.2: type = converted %int.make_type_32.loc34, %.loc34_9.1 [template = i32] +// CHECK:STDOUT: %.loc34_15: type = array_type %.loc34_14, i32 [template = constants.%.3] // CHECK:STDOUT: %d.var: ref [i32; 3] = var d // CHECK:STDOUT: %d: ref [i32; 3] = bind_name d, %d.var // CHECK:STDOUT: } @@ -122,25 +126,25 @@ var d: [i32; 3] = t2; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_23: String = string_literal "Hello" [template = constants.%.7] -// CHECK:STDOUT: %.loc11_32: String = string_literal "World" [template = constants.%.8] -// CHECK:STDOUT: %.loc11_39.1: (i32, String, String) = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_32) -// CHECK:STDOUT: %.loc11_39.2: i32 = int_literal 0 [template = constants.%.10] -// CHECK:STDOUT: %.loc11_39.3: ref i32 = array_index file.%a.var, %.loc11_39.2 -// CHECK:STDOUT: %.loc11_39.4: init i32 = initialize_from %.loc11_20 to %.loc11_39.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_20: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_23: String = string_literal "Hello" [template = constants.%.7] +// CHECK:STDOUT: %.loc15_32: String = string_literal "World" [template = constants.%.8] +// CHECK:STDOUT: %.loc15_39.1: (i32, String, String) = tuple_literal (%.loc15_20, %.loc15_23, %.loc15_32) +// CHECK:STDOUT: %.loc15_39.2: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc15_39.3: ref i32 = array_index file.%a.var, %.loc15_39.2 +// CHECK:STDOUT: %.loc15_39.4: init i32 = initialize_from %.loc15_20 to %.loc15_39.3 [template = constants.%.5] // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %t1.ref: ref (i32, String, String) = name_ref t1, file.%t1 -// CHECK:STDOUT: %.loc18_19.1: ref i32 = tuple_access %t1.ref, element0 -// CHECK:STDOUT: %.loc18_19.2: i32 = bind_value %.loc18_19.1 -// CHECK:STDOUT: %.loc18_19.3: i32 = int_literal 0 [template = constants.%.10] -// CHECK:STDOUT: %.loc18_19.4: ref i32 = array_index file.%b.var, %.loc18_19.3 -// CHECK:STDOUT: %.loc18_19.5: init i32 = initialize_from %.loc18_19.2 to %.loc18_19.4 -// CHECK:STDOUT: %.loc18_19.6: ref String = tuple_access %t1.ref, element1 +// CHECK:STDOUT: %.loc22_19.1: ref i32 = tuple_access %t1.ref, element0 +// CHECK:STDOUT: %.loc22_19.2: i32 = bind_value %.loc22_19.1 +// CHECK:STDOUT: %.loc22_19.3: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc22_19.4: ref i32 = array_index file.%b.var, %.loc22_19.3 +// CHECK:STDOUT: %.loc22_19.5: init i32 = initialize_from %.loc22_19.2 to %.loc22_19.4 +// CHECK:STDOUT: %.loc22_19.6: ref String = tuple_access %t1.ref, element1 // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %.loc24_20: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc24_23: i32 = int_literal 2 [template = constants.%.14] -// CHECK:STDOUT: %.loc24_24: (i32, i32) = tuple_literal (%.loc24_20, %.loc24_23) +// CHECK:STDOUT: %.loc28_20: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc28_23: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc28_24: (i32, i32) = tuple_literal (%.loc28_20, %.loc28_23) // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: %t2.ref: ref (i32, i32) = name_ref t2, file.%t2 // CHECK:STDOUT: assign file.%d.var, diff --git a/toolchain/check/testdata/array/fail_undefined_bound.carbon b/toolchain/check/testdata/array/fail_undefined_bound.carbon index 1f21ae9a58cd..5e97ae6c2ffa 100644 --- a/toolchain/check/testdata/array/fail_undefined_bound.carbon +++ b/toolchain/check/testdata/array/fail_undefined_bound.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/fail_undefined_bound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/fail_undefined_bound.carbon // CHECK:STDERR: fail_undefined_bound.carbon:[[@LINE+3]]:8: ERROR: Semantics TODO: `HandleArrayExprWithoutBounds`. // CHECK:STDERR: var a: [i32; ]; diff --git a/toolchain/check/testdata/array/function_param.carbon b/toolchain/check/testdata/array/function_param.carbon index 2e974911025a..57e49a3aa219 100644 --- a/toolchain/check/testdata/array/function_param.carbon +++ b/toolchain/check/testdata/array/function_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/function_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/function_param.carbon fn F(arr: [i32; 3], i: i32) -> i32 { return arr[i]; @@ -43,28 +47,28 @@ fn G() -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7_12, %.loc7_12.1 [template = i32] -// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3] -// CHECK:STDOUT: %arr.loc7_6.1: [i32; 3] = param arr -// CHECK:STDOUT: @F.%arr: [i32; 3] = bind_name arr, %arr.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_24.1: type = value_of_initializer %int.make_type_32.loc7_24 [template = i32] -// CHECK:STDOUT: %.loc7_24.2: type = converted %int.make_type_32.loc7_24, %.loc7_24.1 [template = i32] -// CHECK:STDOUT: %i.loc7_21.1: i32 = param i -// CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc7_21.1 -// CHECK:STDOUT: %int.make_type_32.loc7_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_32.1: type = value_of_initializer %int.make_type_32.loc7_32 [template = i32] -// CHECK:STDOUT: %.loc7_32.2: type = converted %int.make_type_32.loc7_32, %.loc7_32.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11_12, %.loc11_12.1 [template = i32] +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.3] +// CHECK:STDOUT: %arr.loc11_6.1: [i32; 3] = param arr +// CHECK:STDOUT: @F.%arr: [i32; 3] = bind_name arr, %arr.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_24.1: type = value_of_initializer %int.make_type_32.loc11_24 [template = i32] +// CHECK:STDOUT: %.loc11_24.2: type = converted %int.make_type_32.loc11_24, %.loc11_24.1 [template = i32] +// CHECK:STDOUT: %i.loc11_21.1: i32 = param i +// CHECK:STDOUT: @F.%i: i32 = bind_name i, %i.loc11_21.1 +// CHECK:STDOUT: %int.make_type_32.loc11_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_32 [template = i32] +// CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_32, %.loc11_32.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -75,37 +79,37 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %arr.ref: [i32; 3] = name_ref arr, %arr // CHECK:STDOUT: %i.ref: i32 = name_ref i, %i -// CHECK:STDOUT: %.loc8_15.1: ref [i32; 3] = value_as_ref %arr.ref -// CHECK:STDOUT: %.loc8_15.2: ref i32 = array_index %.loc8_15.1, %i.ref -// CHECK:STDOUT: %.loc8_15.3: i32 = bind_value %.loc8_15.2 -// CHECK:STDOUT: return %.loc8_15.3 +// CHECK:STDOUT: %.loc12_15.1: ref [i32; 3] = value_as_ref %arr.ref +// CHECK:STDOUT: %.loc12_15.2: ref i32 = array_index %.loc12_15.1, %i.ref +// CHECK:STDOUT: %.loc12_15.3: i32 = bind_value %.loc12_15.2 +// CHECK:STDOUT: return %.loc12_15.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_16: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_19: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_20.1: (i32, i32, i32) = tuple_literal (%.loc12_13, %.loc12_16, %.loc12_19) -// CHECK:STDOUT: %.loc12_23: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_20.2: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %.loc12_20.3: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_20.4: ref i32 = array_index %.loc12_20.2, %.loc12_20.3 -// CHECK:STDOUT: %.loc12_20.5: init i32 = initialize_from %.loc12_13 to %.loc12_20.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_20.6: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_20.7: ref i32 = array_index %.loc12_20.2, %.loc12_20.6 -// CHECK:STDOUT: %.loc12_20.8: init i32 = initialize_from %.loc12_16 to %.loc12_20.7 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_20.9: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_20.10: ref i32 = array_index %.loc12_20.2, %.loc12_20.9 -// CHECK:STDOUT: %.loc12_20.11: init i32 = initialize_from %.loc12_19 to %.loc12_20.10 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_20.12: init [i32; 3] = array_init (%.loc12_20.5, %.loc12_20.8, %.loc12_20.11) to %.loc12_20.2 [template = constants.%array] -// CHECK:STDOUT: %.loc12_11.1: init [i32; 3] = converted %.loc12_20.1, %.loc12_20.12 [template = constants.%array] -// CHECK:STDOUT: %.loc12_11.2: ref [i32; 3] = temporary %.loc12_20.2, %.loc12_11.1 -// CHECK:STDOUT: %.loc12_11.3: [i32; 3] = bind_value %.loc12_11.2 -// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc12_11.3, %.loc12_23) -// CHECK:STDOUT: %.loc12_25.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc12_25.2: i32 = converted %F.call, %.loc12_25.1 -// CHECK:STDOUT: return %.loc12_25.2 +// CHECK:STDOUT: %.loc16_13: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_16: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_19: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_20.1: (i32, i32, i32) = tuple_literal (%.loc16_13, %.loc16_16, %.loc16_19) +// CHECK:STDOUT: %.loc16_23: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_20.2: ref [i32; 3] = temporary_storage +// CHECK:STDOUT: %.loc16_20.3: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc16_20.4: ref i32 = array_index %.loc16_20.2, %.loc16_20.3 +// CHECK:STDOUT: %.loc16_20.5: init i32 = initialize_from %.loc16_13 to %.loc16_20.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_20.6: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_20.7: ref i32 = array_index %.loc16_20.2, %.loc16_20.6 +// CHECK:STDOUT: %.loc16_20.8: init i32 = initialize_from %.loc16_16 to %.loc16_20.7 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_20.9: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_20.10: ref i32 = array_index %.loc16_20.2, %.loc16_20.9 +// CHECK:STDOUT: %.loc16_20.11: init i32 = initialize_from %.loc16_19 to %.loc16_20.10 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_20.12: init [i32; 3] = array_init (%.loc16_20.5, %.loc16_20.8, %.loc16_20.11) to %.loc16_20.2 [template = constants.%array] +// CHECK:STDOUT: %.loc16_11.1: init [i32; 3] = converted %.loc16_20.1, %.loc16_20.12 [template = constants.%array] +// CHECK:STDOUT: %.loc16_11.2: ref [i32; 3] = temporary %.loc16_20.2, %.loc16_11.1 +// CHECK:STDOUT: %.loc16_11.3: [i32; 3] = bind_value %.loc16_11.2 +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc16_11.3, %.loc16_23) +// CHECK:STDOUT: %.loc16_25.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc16_25.2: i32 = converted %F.call, %.loc16_25.1 +// CHECK:STDOUT: return %.loc16_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/index_not_literal.carbon b/toolchain/check/testdata/array/index_not_literal.carbon index 1cc9885b222c..6bd8f4733b10 100644 --- a/toolchain/check/testdata/array/index_not_literal.carbon +++ b/toolchain/check/testdata/array/index_not_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/index_not_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/index_not_literal.carbon var a: [i32; 3] = (1, 2, 3); var b: i32 = a[{.index = 2}.index]; @@ -33,17 +37,17 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -52,31 +56,31 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_27.3: ref i32 = array_index file.%a.var, %.loc7_27.2 -// CHECK:STDOUT: %.loc7_27.4: init i32 = initialize_from %.loc7_20 to %.loc7_27.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.6: ref i32 = array_index file.%a.var, %.loc7_27.5 -// CHECK:STDOUT: %.loc7_27.7: init i32 = initialize_from %.loc7_23 to %.loc7_27.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.9: ref i32 = array_index file.%a.var, %.loc7_27.8 -// CHECK:STDOUT: %.loc7_27.10: init i32 = initialize_from %.loc7_26 to %.loc7_27.9 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_27.11: init [i32; 3] = array_init (%.loc7_27.4, %.loc7_27.7, %.loc7_27.10) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_28: init [i32; 3] = converted %.loc7_27.1, %.loc7_27.11 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_27.1: (i32, i32, i32) = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_27.3: ref i32 = array_index file.%a.var, %.loc11_27.2 +// CHECK:STDOUT: %.loc11_27.4: init i32 = initialize_from %.loc11_20 to %.loc11_27.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.6: ref i32 = array_index file.%a.var, %.loc11_27.5 +// CHECK:STDOUT: %.loc11_27.7: init i32 = initialize_from %.loc11_23 to %.loc11_27.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.9: ref i32 = array_index file.%a.var, %.loc11_27.8 +// CHECK:STDOUT: %.loc11_27.10: init i32 = initialize_from %.loc11_26 to %.loc11_27.9 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_27.11: init [i32; 3] = array_init (%.loc11_27.4, %.loc11_27.7, %.loc11_27.10) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_28: init [i32; 3] = converted %.loc11_27.1, %.loc11_27.11 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_26: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_27.1: {.index: i32} = struct_literal (%.loc8_26) -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc8_26) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_27.2: {.index: i32} = converted %.loc8_27.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_28: i32 = struct_access %.loc8_27.2, element0 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_34.1: ref i32 = array_index %a.ref, %.loc8_28 -// CHECK:STDOUT: %.loc8_34.2: i32 = bind_value %.loc8_34.1 -// CHECK:STDOUT: assign file.%b.var, %.loc8_34.2 +// CHECK:STDOUT: %.loc12_26: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_27.1: {.index: i32} = struct_literal (%.loc12_26) +// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc12_26) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_27.2: {.index: i32} = converted %.loc12_27.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_28: i32 = struct_access %.loc12_27.2, element0 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_34.1: ref i32 = array_index %a.ref, %.loc12_28 +// CHECK:STDOUT: %.loc12_34.2: i32 = bind_value %.loc12_34.1 +// CHECK:STDOUT: assign file.%b.var, %.loc12_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/array/nine_elements.carbon b/toolchain/check/testdata/array/nine_elements.carbon index c91582db225b..7c1acd87e601 100644 --- a/toolchain/check/testdata/array/nine_elements.carbon +++ b/toolchain/check/testdata/array/nine_elements.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/array/nine_elements.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/array/nine_elements.carbon var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); @@ -36,10 +40,10 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 9 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 9 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 9] = var a // CHECK:STDOUT: %a: ref [i32; 9] = bind_name a, %a.var // CHECK:STDOUT: } @@ -48,46 +52,46 @@ var a: [i32; 9] = (1, 2, 3, 4, 5, 6, 7, 8, 9); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_29: i32 = int_literal 4 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_32: i32 = int_literal 5 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 6 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 7 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_41: i32 = int_literal 8 [template = constants.%.12] -// CHECK:STDOUT: %.loc7_44: i32 = int_literal 9 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc7_20, %.loc7_23, %.loc7_26, %.loc7_29, %.loc7_32, %.loc7_35, %.loc7_38, %.loc7_41, %.loc7_44) -// CHECK:STDOUT: %.loc7_45.2: i32 = int_literal 0 [template = constants.%.14] -// CHECK:STDOUT: %.loc7_45.3: ref i32 = array_index file.%a.var, %.loc7_45.2 -// CHECK:STDOUT: %.loc7_45.4: init i32 = initialize_from %.loc7_20 to %.loc7_45.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_45.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_45.6: ref i32 = array_index file.%a.var, %.loc7_45.5 -// CHECK:STDOUT: %.loc7_45.7: init i32 = initialize_from %.loc7_23 to %.loc7_45.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_45.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_45.9: ref i32 = array_index file.%a.var, %.loc7_45.8 -// CHECK:STDOUT: %.loc7_45.10: init i32 = initialize_from %.loc7_26 to %.loc7_45.9 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_45.11: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_45.12: ref i32 = array_index file.%a.var, %.loc7_45.11 -// CHECK:STDOUT: %.loc7_45.13: init i32 = initialize_from %.loc7_29 to %.loc7_45.12 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_45.14: i32 = int_literal 4 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_45.15: ref i32 = array_index file.%a.var, %.loc7_45.14 -// CHECK:STDOUT: %.loc7_45.16: init i32 = initialize_from %.loc7_32 to %.loc7_45.15 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_45.17: i32 = int_literal 5 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_45.18: ref i32 = array_index file.%a.var, %.loc7_45.17 -// CHECK:STDOUT: %.loc7_45.19: init i32 = initialize_from %.loc7_35 to %.loc7_45.18 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_45.20: i32 = int_literal 6 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_45.21: ref i32 = array_index file.%a.var, %.loc7_45.20 -// CHECK:STDOUT: %.loc7_45.22: init i32 = initialize_from %.loc7_38 to %.loc7_45.21 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_45.23: i32 = int_literal 7 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_45.24: ref i32 = array_index file.%a.var, %.loc7_45.23 -// CHECK:STDOUT: %.loc7_45.25: init i32 = initialize_from %.loc7_41 to %.loc7_45.24 [template = constants.%.12] -// CHECK:STDOUT: %.loc7_45.26: i32 = int_literal 8 [template = constants.%.12] -// CHECK:STDOUT: %.loc7_45.27: ref i32 = array_index file.%a.var, %.loc7_45.26 -// CHECK:STDOUT: %.loc7_45.28: init i32 = initialize_from %.loc7_44 to %.loc7_45.27 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_45.29: init [i32; 9] = array_init (%.loc7_45.4, %.loc7_45.7, %.loc7_45.10, %.loc7_45.13, %.loc7_45.16, %.loc7_45.19, %.loc7_45.22, %.loc7_45.25, %.loc7_45.28) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_46: init [i32; 9] = converted %.loc7_45.1, %.loc7_45.29 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_46 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_29: i32 = int_literal 4 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_32: i32 = int_literal 5 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_35: i32 = int_literal 6 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_38: i32 = int_literal 7 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_41: i32 = int_literal 8 [template = constants.%.12] +// CHECK:STDOUT: %.loc11_44: i32 = int_literal 9 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_45.1: (i32, i32, i32, i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc11_20, %.loc11_23, %.loc11_26, %.loc11_29, %.loc11_32, %.loc11_35, %.loc11_38, %.loc11_41, %.loc11_44) +// CHECK:STDOUT: %.loc11_45.2: i32 = int_literal 0 [template = constants.%.14] +// CHECK:STDOUT: %.loc11_45.3: ref i32 = array_index file.%a.var, %.loc11_45.2 +// CHECK:STDOUT: %.loc11_45.4: init i32 = initialize_from %.loc11_20 to %.loc11_45.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_45.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_45.6: ref i32 = array_index file.%a.var, %.loc11_45.5 +// CHECK:STDOUT: %.loc11_45.7: init i32 = initialize_from %.loc11_23 to %.loc11_45.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_45.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_45.9: ref i32 = array_index file.%a.var, %.loc11_45.8 +// CHECK:STDOUT: %.loc11_45.10: init i32 = initialize_from %.loc11_26 to %.loc11_45.9 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_45.11: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_45.12: ref i32 = array_index file.%a.var, %.loc11_45.11 +// CHECK:STDOUT: %.loc11_45.13: init i32 = initialize_from %.loc11_29 to %.loc11_45.12 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_45.14: i32 = int_literal 4 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_45.15: ref i32 = array_index file.%a.var, %.loc11_45.14 +// CHECK:STDOUT: %.loc11_45.16: init i32 = initialize_from %.loc11_32 to %.loc11_45.15 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_45.17: i32 = int_literal 5 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_45.18: ref i32 = array_index file.%a.var, %.loc11_45.17 +// CHECK:STDOUT: %.loc11_45.19: init i32 = initialize_from %.loc11_35 to %.loc11_45.18 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_45.20: i32 = int_literal 6 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_45.21: ref i32 = array_index file.%a.var, %.loc11_45.20 +// CHECK:STDOUT: %.loc11_45.22: init i32 = initialize_from %.loc11_38 to %.loc11_45.21 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_45.23: i32 = int_literal 7 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_45.24: ref i32 = array_index file.%a.var, %.loc11_45.23 +// CHECK:STDOUT: %.loc11_45.25: init i32 = initialize_from %.loc11_41 to %.loc11_45.24 [template = constants.%.12] +// CHECK:STDOUT: %.loc11_45.26: i32 = int_literal 8 [template = constants.%.12] +// CHECK:STDOUT: %.loc11_45.27: ref i32 = array_index file.%a.var, %.loc11_45.26 +// CHECK:STDOUT: %.loc11_45.28: init i32 = initialize_from %.loc11_44 to %.loc11_45.27 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_45.29: init [i32; 9] = array_init (%.loc11_45.4, %.loc11_45.7, %.loc11_45.10, %.loc11_45.13, %.loc11_45.16, %.loc11_45.19, %.loc11_45.22, %.loc11_45.25, %.loc11_45.28) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_46: init [i32; 9] = converted %.loc11_45.1, %.loc11_45.29 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_46 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/adapter_conversion.carbon b/toolchain/check/testdata/as/adapter_conversion.carbon index b5718ac797a3..299994b8417b 100644 --- a/toolchain/check/testdata/as/adapter_conversion.carbon +++ b/toolchain/check/testdata/as/adapter_conversion.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/adapter_conversion.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/adapter_conversion.carbon // --- adapt_class.carbon diff --git a/toolchain/check/testdata/as/as_type.carbon b/toolchain/check/testdata/as/as_type.carbon index 3924b2a24d38..b09f7bd7303b 100644 --- a/toolchain/check/testdata/as/as_type.carbon +++ b/toolchain/check/testdata/as/as_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/as_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/as_type.carbon let t: type = (i32, i32) as type; @@ -22,16 +26,16 @@ let t: type = (i32, i32) as type; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_21: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_24: (type, type) = tuple_literal (%int.make_type_32.loc7_16, %int.make_type_32.loc7_21) -// CHECK:STDOUT: %.loc7_26.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] -// CHECK:STDOUT: %.loc7_26.2: type = converted %int.make_type_32.loc7_16, %.loc7_26.1 [template = i32] -// CHECK:STDOUT: %.loc7_26.3: type = value_of_initializer %int.make_type_32.loc7_21 [template = i32] -// CHECK:STDOUT: %.loc7_26.4: type = converted %int.make_type_32.loc7_21, %.loc7_26.3 [template = i32] -// CHECK:STDOUT: %.loc7_26.5: type = converted %.loc7_24, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %t: type = bind_name t, %.loc7_26.5 +// CHECK:STDOUT: %int.make_type_32.loc11_21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_24: (type, type) = tuple_literal (%int.make_type_32.loc11_16, %int.make_type_32.loc11_21) +// CHECK:STDOUT: %.loc11_26.1: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] +// CHECK:STDOUT: %.loc11_26.2: type = converted %int.make_type_32.loc11_16, %.loc11_26.1 [template = i32] +// CHECK:STDOUT: %.loc11_26.3: type = value_of_initializer %int.make_type_32.loc11_21 [template = i32] +// CHECK:STDOUT: %.loc11_26.4: type = converted %int.make_type_32.loc11_21, %.loc11_26.3 [template = i32] +// CHECK:STDOUT: %.loc11_26.5: type = converted %.loc11_24, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %t: type = bind_name t, %.loc11_26.5 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/as/basic.carbon b/toolchain/check/testdata/as/basic.carbon index bfa996c2afe9..67888fed0f22 100644 --- a/toolchain/check/testdata/as/basic.carbon +++ b/toolchain/check/testdata/as/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/basic.carbon fn Main() -> i32 { return 1 as i32; @@ -28,8 +32,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -39,10 +43,10 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_10: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_15.2: type = converted %int.make_type_32, %.loc8_15.1 [template = i32] -// CHECK:STDOUT: return %.loc8_10 +// CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_15.2: type = converted %int.make_type_32, %.loc12_15.1 [template = i32] +// CHECK:STDOUT: return %.loc12_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_no_conversion.carbon b/toolchain/check/testdata/as/fail_no_conversion.carbon index 58d375cb1d17..767e6c1dea2c 100644 --- a/toolchain/check/testdata/as/fail_no_conversion.carbon +++ b/toolchain/check/testdata/as/fail_no_conversion.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/fail_no_conversion.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_no_conversion.carbon // CHECK:STDERR: fail_no_conversion.carbon:[[@LINE+3]]:21: ERROR: Cannot convert from `i32` to `(i32, i32)` with `as`. // CHECK:STDERR: let n: (i32, i32) = 1 as (i32, i32); @@ -27,26 +31,26 @@ let n: (i32, i32) = 1 as (i32, i32); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) -// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] -// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] -// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] -// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] -// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_21: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc14_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: (type, type) = tuple_literal (%int.make_type_32.loc14_9, %int.make_type_32.loc14_14) +// CHECK:STDOUT: %.loc14_17.2: type = value_of_initializer %int.make_type_32.loc14_9 [template = i32] +// CHECK:STDOUT: %.loc14_17.3: type = converted %int.make_type_32.loc14_9, %.loc14_17.2 [template = i32] +// CHECK:STDOUT: %.loc14_17.4: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32] +// CHECK:STDOUT: %.loc14_17.5: type = converted %int.make_type_32.loc14_14, %.loc14_17.4 [template = i32] +// CHECK:STDOUT: %.loc14_17.6: type = converted %.loc14_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_21: i32 = int_literal 1 [template = constants.%.5] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_35.1: (type, type) = tuple_literal (%int.make_type_32.loc10_27, %int.make_type_32.loc10_32) -// CHECK:STDOUT: %.loc10_35.2: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] -// CHECK:STDOUT: %.loc10_35.3: type = converted %int.make_type_32.loc10_27, %.loc10_35.2 [template = i32] -// CHECK:STDOUT: %.loc10_35.4: type = value_of_initializer %int.make_type_32.loc10_32 [template = i32] -// CHECK:STDOUT: %.loc10_35.5: type = converted %int.make_type_32.loc10_32, %.loc10_35.4 [template = i32] -// CHECK:STDOUT: %.loc10_35.6: type = converted %.loc10_35.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_35.1: (type, type) = tuple_literal (%int.make_type_32.loc14_27, %int.make_type_32.loc14_32) +// CHECK:STDOUT: %.loc14_35.2: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] +// CHECK:STDOUT: %.loc14_35.3: type = converted %int.make_type_32.loc14_27, %.loc14_35.2 [template = i32] +// CHECK:STDOUT: %.loc14_35.4: type = value_of_initializer %int.make_type_32.loc14_32 [template = i32] +// CHECK:STDOUT: %.loc14_35.5: type = converted %int.make_type_32.loc14_32, %.loc14_35.4 [template = i32] +// CHECK:STDOUT: %.loc14_35.6: type = converted %.loc14_35.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %n: (i32, i32) = bind_name n, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/fail_not_type.carbon b/toolchain/check/testdata/as/fail_not_type.carbon index 1110bda816a5..ba90b23e9d5c 100644 --- a/toolchain/check/testdata/as/fail_not_type.carbon +++ b/toolchain/check/testdata/as/fail_not_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/fail_not_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/fail_not_type.carbon // CHECK:STDERR: fail_not_type.carbon:[[@LINE+3]]:19: ERROR: Cannot implicitly convert from `i32` to `type`. // CHECK:STDERR: let n: i32 = 1 as 2; @@ -26,10 +30,10 @@ let n: i32 = 1 as 2; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32, %.loc10_8.1 [template = i32] -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_8.2: type = converted %int.make_type_32, %.loc14_8.1 [template = i32] +// CHECK:STDOUT: %.loc14_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_19: i32 = int_literal 2 [template = constants.%.3] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/as/identity.carbon b/toolchain/check/testdata/as/identity.carbon index 88ceb8ff9bc9..9f626b7cb5b2 100644 --- a/toolchain/check/testdata/as/identity.carbon +++ b/toolchain/check/testdata/as/identity.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/identity.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/identity.carbon // `expr as T` should behave the same as `expr` if `T` is the type of `expr`. @@ -54,18 +58,18 @@ fn Initializing() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} // CHECK:STDOUT: %Value.decl: Value = fn_decl @Value [template = constants.%struct.1] { -// CHECK:STDOUT: %X.ref.loc13: type = name_ref X, %X.decl [template = constants.%X] -// CHECK:STDOUT: %n.loc13_10.1: X = param n -// CHECK:STDOUT: @Value.%n: X = bind_name n, %n.loc13_10.1 +// CHECK:STDOUT: %X.ref.loc17: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %n.loc17_10.1: X = param n +// CHECK:STDOUT: @Value.%n: X = bind_name n, %n.loc17_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Reference.decl: Reference = fn_decl @Reference [template = constants.%struct.2] { -// CHECK:STDOUT: %X.ref.loc17: type = name_ref X, %X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc17: type = ptr_type X [template = constants.%.4] -// CHECK:STDOUT: %p.loc17_14.1: X* = param p -// CHECK:STDOUT: @Reference.%p: X* = bind_name p, %p.loc17_14.1 +// CHECK:STDOUT: %X.ref.loc21: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc21: type = ptr_type X [template = constants.%.4] +// CHECK:STDOUT: %p.loc21_14.1: X* = param p +// CHECK:STDOUT: @Reference.%p: X* = bind_name p, %p.loc21_14.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.3] { -// CHECK:STDOUT: %X.ref.loc21: type = name_ref X, %X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc25: type = name_ref X, %X.decl [template = constants.%X] // CHECK:STDOUT: @Make.%return: ref X = var // CHECK:STDOUT: } // CHECK:STDOUT: %Initializing.decl: Initializing = fn_decl @Initializing [template = constants.%struct.4] {} @@ -78,22 +82,22 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Value(%n: X) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc14_10: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %n.ref: X = name_ref n, %n -// CHECK:STDOUT: %X.ref.loc14_19: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc18_19: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %m: X = bind_name m, %n.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Reference(%p: X*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc18_10: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc18_11: type = ptr_type X [template = constants.%.4] +// CHECK:STDOUT: %X.ref.loc22_10: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc22_11: type = ptr_type X [template = constants.%.4] // CHECK:STDOUT: %p.ref: X* = name_ref p, %p -// CHECK:STDOUT: %.loc18_17: ref X = deref %p.ref -// CHECK:STDOUT: %X.ref.loc18_23: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc18_15: X* = addr_of %.loc18_17 -// CHECK:STDOUT: %q: X* = bind_name q, %.loc18_15 +// CHECK:STDOUT: %.loc22_17: ref X = deref %p.ref +// CHECK:STDOUT: %X.ref.loc22_23: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc22_15: X* = addr_of %.loc22_17 +// CHECK:STDOUT: %q: X* = bind_name q, %.loc22_15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -101,13 +105,13 @@ fn Initializing() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Initializing() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc24_10: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc28_10: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %x.var: ref X = var x // CHECK:STDOUT: %x: ref X = bind_name x, %x.var // CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc24: ref X = splice_block %x.var {} -// CHECK:STDOUT: %Make.call: init X = call %Make.ref() to %.loc24 -// CHECK:STDOUT: %X.ref.loc24_25: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc28: ref X = splice_block %x.var {} +// CHECK:STDOUT: %Make.call: init X = call %Make.ref() to %.loc28 +// CHECK:STDOUT: %X.ref.loc28_25: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: assign %x.var, %Make.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/as/no_prelude/tuple.carbon b/toolchain/check/testdata/as/no_prelude/tuple.carbon index a900e679ac43..358ec09aaa70 100644 --- a/toolchain/check/testdata/as/no_prelude/tuple.carbon +++ b/toolchain/check/testdata/as/no_prelude/tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/as/no_prelude/tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/as/no_prelude/tuple.carbon class X { // ... @@ -64,53 +68,53 @@ fn Var() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Let() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc15_11: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc15_14: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc15_15.1: (type, type) = tuple_literal (%X.ref.loc15_11, %X.ref.loc15_14) -// CHECK:STDOUT: %.loc15_15.2: type = converted %.loc15_15.1, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %Make.ref.loc15_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc15_24.1: ref X = temporary_storage -// CHECK:STDOUT: %Make.call.loc15_24: init X = call %Make.ref.loc15_20() to %.loc15_24.1 -// CHECK:STDOUT: %Make.ref.loc15_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc15_32.1: ref X = temporary_storage -// CHECK:STDOUT: %Make.call.loc15_32: init X = call %Make.ref.loc15_28() to %.loc15_32.1 -// CHECK:STDOUT: %.loc15_34: (X, X) = tuple_literal (%Make.call.loc15_24, %Make.call.loc15_32) -// CHECK:STDOUT: %X.ref.loc15_40: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc15_43: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc15_44.1: (type, type) = tuple_literal (%X.ref.loc15_40, %X.ref.loc15_43) -// CHECK:STDOUT: %.loc15_44.2: type = converted %.loc15_44.1, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc15_24.2: ref X = temporary %.loc15_24.1, %Make.call.loc15_24 -// CHECK:STDOUT: %.loc15_24.3: X = bind_value %.loc15_24.2 -// CHECK:STDOUT: %.loc15_32.2: ref X = temporary %.loc15_32.1, %Make.call.loc15_32 -// CHECK:STDOUT: %.loc15_32.3: X = bind_value %.loc15_32.2 -// CHECK:STDOUT: %tuple: (X, X) = tuple_value (%.loc15_24.3, %.loc15_32.3) -// CHECK:STDOUT: %.loc15_45: (X, X) = converted %.loc15_34, %tuple -// CHECK:STDOUT: %a: (X, X) = bind_name a, %.loc15_45 +// CHECK:STDOUT: %X.ref.loc19_11: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc19_14: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc19_15.1: (type, type) = tuple_literal (%X.ref.loc19_11, %X.ref.loc19_14) +// CHECK:STDOUT: %.loc19_15.2: type = converted %.loc19_15.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %Make.ref.loc19_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc19_24.1: ref X = temporary_storage +// CHECK:STDOUT: %Make.call.loc19_24: init X = call %Make.ref.loc19_20() to %.loc19_24.1 +// CHECK:STDOUT: %Make.ref.loc19_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc19_32.1: ref X = temporary_storage +// CHECK:STDOUT: %Make.call.loc19_32: init X = call %Make.ref.loc19_28() to %.loc19_32.1 +// CHECK:STDOUT: %.loc19_34: (X, X) = tuple_literal (%Make.call.loc19_24, %Make.call.loc19_32) +// CHECK:STDOUT: %X.ref.loc19_40: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc19_43: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc19_44.1: (type, type) = tuple_literal (%X.ref.loc19_40, %X.ref.loc19_43) +// CHECK:STDOUT: %.loc19_44.2: type = converted %.loc19_44.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc19_24.2: ref X = temporary %.loc19_24.1, %Make.call.loc19_24 +// CHECK:STDOUT: %.loc19_24.3: X = bind_value %.loc19_24.2 +// CHECK:STDOUT: %.loc19_32.2: ref X = temporary %.loc19_32.1, %Make.call.loc19_32 +// CHECK:STDOUT: %.loc19_32.3: X = bind_value %.loc19_32.2 +// CHECK:STDOUT: %tuple: (X, X) = tuple_value (%.loc19_24.3, %.loc19_32.3) +// CHECK:STDOUT: %.loc19_45: (X, X) = converted %.loc19_34, %tuple +// CHECK:STDOUT: %a: (X, X) = bind_name a, %.loc19_45 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Var() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %X.ref.loc20_11: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc20_14: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc20_15.1: (type, type) = tuple_literal (%X.ref.loc20_11, %X.ref.loc20_14) -// CHECK:STDOUT: %.loc20_15.2: type = converted %.loc20_15.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %X.ref.loc24_11: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc24_14: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc24_15.1: (type, type) = tuple_literal (%X.ref.loc24_11, %X.ref.loc24_14) +// CHECK:STDOUT: %.loc24_15.2: type = converted %.loc24_15.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %b.var: ref (X, X) = var b // CHECK:STDOUT: %b: ref (X, X) = bind_name b, %b.var -// CHECK:STDOUT: %Make.ref.loc20_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc20_34.1: ref X = tuple_access %b.var, element0 -// CHECK:STDOUT: %Make.call.loc20_24: init X = call %Make.ref.loc20_20() to %.loc20_34.1 -// CHECK:STDOUT: %Make.ref.loc20_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc20_34.2: ref X = tuple_access %b.var, element1 -// CHECK:STDOUT: %Make.call.loc20_32: init X = call %Make.ref.loc20_28() to %.loc20_34.2 -// CHECK:STDOUT: %.loc20_34.3: (X, X) = tuple_literal (%Make.call.loc20_24, %Make.call.loc20_32) -// CHECK:STDOUT: %X.ref.loc20_40: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %X.ref.loc20_43: type = name_ref X, file.%X.decl [template = constants.%X] -// CHECK:STDOUT: %.loc20_44.1: (type, type) = tuple_literal (%X.ref.loc20_40, %X.ref.loc20_43) -// CHECK:STDOUT: %.loc20_44.2: type = converted %.loc20_44.1, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc20_34.4: init (X, X) = tuple_init (%Make.call.loc20_24, %Make.call.loc20_32) to %b.var -// CHECK:STDOUT: %.loc20_45: init (X, X) = converted %.loc20_34.3, %.loc20_34.4 -// CHECK:STDOUT: assign %b.var, %.loc20_45 +// CHECK:STDOUT: %Make.ref.loc24_20: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc24_34.1: ref X = tuple_access %b.var, element0 +// CHECK:STDOUT: %Make.call.loc24_24: init X = call %Make.ref.loc24_20() to %.loc24_34.1 +// CHECK:STDOUT: %Make.ref.loc24_28: Make = name_ref Make, file.%Make.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc24_34.2: ref X = tuple_access %b.var, element1 +// CHECK:STDOUT: %Make.call.loc24_32: init X = call %Make.ref.loc24_28() to %.loc24_34.2 +// CHECK:STDOUT: %.loc24_34.3: (X, X) = tuple_literal (%Make.call.loc24_24, %Make.call.loc24_32) +// CHECK:STDOUT: %X.ref.loc24_40: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %X.ref.loc24_43: type = name_ref X, file.%X.decl [template = constants.%X] +// CHECK:STDOUT: %.loc24_44.1: (type, type) = tuple_literal (%X.ref.loc24_40, %X.ref.loc24_43) +// CHECK:STDOUT: %.loc24_44.2: type = converted %.loc24_44.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc24_34.4: init (X, X) = tuple_init (%Make.call.loc24_24, %Make.call.loc24_32) to %b.var +// CHECK:STDOUT: %.loc24_45: init (X, X) = converted %.loc24_34.3, %.loc24_34.4 +// CHECK:STDOUT: assign %b.var, %.loc24_45 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/builtin_insts.carbon b/toolchain/check/testdata/basics/builtin_insts.carbon index c81266b8d5a4..349978be107c 100644 --- a/toolchain/check/testdata/basics/builtin_insts.carbon +++ b/toolchain/check/testdata/basics/builtin_insts.carbon @@ -5,6 +5,10 @@ // ARGS: compile --no-prelude-import --phase=check --dump-raw-sem-ir --builtin-sem-ir %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/builtin_insts.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/builtin_insts.carbon // CHECK:STDOUT: --- // CHECK:STDOUT: filename: builtin_insts.carbon diff --git a/toolchain/check/testdata/basics/builtin_types.carbon b/toolchain/check/testdata/basics/builtin_types.carbon index 76b07c0539b9..5b747f6af72d 100644 --- a/toolchain/check/testdata/basics/builtin_types.carbon +++ b/toolchain/check/testdata/basics/builtin_types.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/builtin_types.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/builtin_types.carbon var test_i32: i32 = 0; var test_f64: f64 = 0.1; @@ -34,19 +38,19 @@ var test_type: type = i32; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_15.2: type = converted %int.make_type_32, %.loc7_15.1 [template = i32] +// CHECK:STDOUT: %.loc11_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_15.2: type = converted %int.make_type_32, %.loc11_15.1 [template = i32] // CHECK:STDOUT: %test_i32.var: ref i32 = var test_i32 // CHECK:STDOUT: %test_i32: ref i32 = bind_name test_i32, %test_i32.var -// CHECK:STDOUT: %.loc8_15.1: i32 = int_literal 64 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_15.1: i32 = int_literal 64 [template = constants.%.3] // CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.2(%.loc8_15.1) [template = f64] -// CHECK:STDOUT: %.loc8_15.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc8_15.3: type = converted %float.make_type, %.loc8_15.2 [template = f64] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.2(%.loc12_15.1) [template = f64] +// CHECK:STDOUT: %.loc12_15.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc12_15.3: type = converted %float.make_type, %.loc12_15.2 [template = f64] // CHECK:STDOUT: %test_f64.var: ref f64 = var test_f64 // CHECK:STDOUT: %test_f64: ref f64 = bind_name test_f64, %test_f64.var -// CHECK:STDOUT: %.loc9: String = string_literal "Test" [template = constants.%.6] -// CHECK:STDOUT: %test_str: String = bind_name test_str, %.loc9 +// CHECK:STDOUT: %.loc13: String = string_literal "Test" [template = constants.%.6] +// CHECK:STDOUT: %test_str: String = bind_name test_str, %.loc13 // CHECK:STDOUT: %test_type.var: ref type = var test_type // CHECK:STDOUT: %test_type: ref type = bind_name test_type, %test_type.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -58,10 +62,10 @@ var test_type: type = i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign file.%test_i32.var, %.loc7 -// CHECK:STDOUT: %.loc8: f64 = float_literal 0.10000000000000001 [template = constants.%.4] -// CHECK:STDOUT: assign file.%test_f64.var, %.loc8 +// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign file.%test_i32.var, %.loc11 +// CHECK:STDOUT: %.loc12: f64 = float_literal 0.10000000000000001 [template = constants.%.4] +// CHECK:STDOUT: assign file.%test_f64.var, %.loc12 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: assign file.%test_type.var, %int.make_type_32 // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/basics/fail_bad_run.carbon b/toolchain/check/testdata/basics/fail_bad_run.carbon index f43006ac2b75..1232270585a8 100644 --- a/toolchain/check/testdata/basics/fail_bad_run.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run.carbon // CHECK:STDERR: fail_bad_run.carbon:[[@LINE+7]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`. // CHECK:STDERR: fn Run() -> String {} diff --git a/toolchain/check/testdata/basics/fail_bad_run_2.carbon b/toolchain/check/testdata/basics/fail_bad_run_2.carbon index aaadbf31ff93..06870890ae5a 100644 --- a/toolchain/check/testdata/basics/fail_bad_run_2.carbon +++ b/toolchain/check/testdata/basics/fail_bad_run_2.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_bad_run_2.carbon // CHECK:STDERR: fail_bad_run_2.carbon:[[@LINE+3]]:1: ERROR: Invalid signature for `Main.Run` function. Expected `fn ()` or `fn () -> i32`. // CHECK:STDERR: fn Run(n: i32) {} @@ -28,10 +32,10 @@ fn Run(n: i32) {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32, %.loc10_11.1 [template = i32] -// CHECK:STDOUT: %n.loc10_8.1: i32 = param n -// CHECK:STDOUT: @Run.%n: i32 = bind_name n, %n.loc10_8.1 +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32, %.loc14_11.1 [template = i32] +// CHECK:STDOUT: %n.loc14_8.1: i32 = param n +// CHECK:STDOUT: @Run.%n: i32 = bind_name n, %n.loc14_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon index e5f67ac5e8a0..99f6788cf144 100644 --- a/toolchain/check/testdata/basics/fail_non_type_as_type.carbon +++ b/toolchain/check/testdata/basics/fail_non_type_as_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_non_type_as_type.carbon // CHECK:STDERR: fail_non_type_as_type.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `i32` to `type`. // CHECK:STDERR: var x: type = 42; @@ -27,7 +31,7 @@ var x: type = 42; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: i32 = int_literal 42 [template = constants.%.1] +// CHECK:STDOUT: %.loc14: i32 = int_literal 42 [template = constants.%.1] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon index a88b335e81e0..6410c24164e3 100644 --- a/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +++ b/toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon // CHECK:STDERR: fail_numeric_literal_overflow.carbon:[[@LINE+4]]:14: ERROR: Integer literal with value 39999999999999999993 does not fit in i32. // CHECK:STDERR: let a: i32 = 39999999999999999993; @@ -50,31 +54,31 @@ let e: f64 = 5.0e39999999999999999993; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %a: i32 = bind_name a, // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_8.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_8.2: type = converted %int.make_type_32.loc21, %.loc21_8.1 [template = i32] // CHECK:STDOUT: %b: i32 = bind_name b, // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc23_8.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] -// CHECK:STDOUT: %.loc23_8.2: type = converted %int.make_type_32.loc23, %.loc23_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_8.1: type = value_of_initializer %int.make_type_32.loc27 [template = i32] +// CHECK:STDOUT: %.loc27_8.2: type = converted %int.make_type_32.loc27, %.loc27_8.1 [template = i32] // CHECK:STDOUT: %c: i32 = bind_name c, -// CHECK:STDOUT: %.loc29_8.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %.loc33_8.1: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %float.make_type.loc29: init type = call constants.%struct.2(%.loc29_8.1) [template = f64] -// CHECK:STDOUT: %.loc29_8.2: type = value_of_initializer %float.make_type.loc29 [template = f64] -// CHECK:STDOUT: %.loc29_8.3: type = converted %float.make_type.loc29, %.loc29_8.2 [template = f64] +// CHECK:STDOUT: %float.make_type.loc33: init type = call constants.%struct.2(%.loc33_8.1) [template = f64] +// CHECK:STDOUT: %.loc33_8.2: type = value_of_initializer %float.make_type.loc33 [template = f64] +// CHECK:STDOUT: %.loc33_8.3: type = converted %float.make_type.loc33, %.loc33_8.2 [template = f64] // CHECK:STDOUT: %d: f64 = bind_name d, -// CHECK:STDOUT: %.loc34_8.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %.loc38_8.1: i32 = int_literal 64 [template = constants.%.2] // CHECK:STDOUT: %import_ref.5: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %float.make_type.loc34: init type = call constants.%struct.2(%.loc34_8.1) [template = f64] -// CHECK:STDOUT: %.loc34_8.2: type = value_of_initializer %float.make_type.loc34 [template = f64] -// CHECK:STDOUT: %.loc34_8.3: type = converted %float.make_type.loc34, %.loc34_8.2 [template = f64] +// CHECK:STDOUT: %float.make_type.loc38: init type = call constants.%struct.2(%.loc38_8.1) [template = f64] +// CHECK:STDOUT: %.loc38_8.2: type = value_of_initializer %float.make_type.loc38 [template = f64] +// CHECK:STDOUT: %.loc38_8.3: type = converted %float.make_type.loc38, %.loc38_8.2 [template = f64] // CHECK:STDOUT: %e: f64 = bind_name e, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon b/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon index 31dc5d2cf78c..4d5192fdbdd8 100644 --- a/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon +++ b/toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon var x: i32; // CHECK:STDERR: fail_qualifier_unsupported.carbon:[[@LINE+3]]:14: ERROR: Type `i32` does not support qualified expressions. @@ -26,15 +30,15 @@ var y: i32 = x.b; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] -// CHECK:STDOUT: %x.var: ref i32 = var x -// CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] // CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %x.var: ref i32 = var x +// CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/multifile.carbon b/toolchain/check/testdata/basics/multifile.carbon index 52b370147a7a..67c8286c9e2e 100644 --- a/toolchain/check/testdata/basics/multifile.carbon +++ b/toolchain/check/testdata/basics/multifile.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/multifile.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/multifile.carbon // --- a.carbon package A; diff --git a/toolchain/check/testdata/basics/no_prelude/empty.carbon b/toolchain/check/testdata/basics/no_prelude/empty.carbon index 55039f0e3c12..d94dd7a11eb0 100644 --- a/toolchain/check/testdata/basics/no_prelude/empty.carbon +++ b/toolchain/check/testdata/basics/no_prelude/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/empty.carbon // CHECK:STDOUT: --- empty.carbon // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/no_prelude/empty_decl.carbon b/toolchain/check/testdata/basics/no_prelude/empty_decl.carbon index 50110a1d6161..d2cac6b28f7f 100644 --- a/toolchain/check/testdata/basics/no_prelude/empty_decl.carbon +++ b/toolchain/check/testdata/basics/no_prelude/empty_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/empty_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/empty_decl.carbon ; diff --git a/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon b/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon index 7fdb58eda481..cbb8d36624b1 100644 --- a/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon +++ b/toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon fn Main() { // CHECK:STDERR: fail_name_lookup.carbon:[[@LINE+3]]:3: ERROR: Name `x` not found. diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon index 8692c02d4d5f..247df256fdf7 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon @@ -7,6 +7,10 @@ // Check that we can combine textual IR and raw IR dumping in one compile. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon // --- a.carbon package A; diff --git a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon b/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon index f11781721dad..319293c5bce2 100644 --- a/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon @@ -7,6 +7,10 @@ // Check that raw IR dumping works as expected. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon // --- a.carbon package A; diff --git a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon index 4d81c4653d03..cccc03d7d7a6 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon @@ -7,6 +7,10 @@ // Check that we can combine textual IR and raw IR dumping in one compile. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon fn Foo(n: ()) -> ((), ()) { return (n, ()); @@ -155,16 +159,16 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { -// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %n.loc11_8.1: () = param n -// CHECK:STDOUT: @Foo.%n: () = bind_name n, %n.loc11_8.1 -// CHECK:STDOUT: %.loc11_20: () = tuple_literal () -// CHECK:STDOUT: %.loc11_24: () = tuple_literal () -// CHECK:STDOUT: %.loc11_25.1: ((), ()) = tuple_literal (%.loc11_20, %.loc11_24) -// CHECK:STDOUT: %.loc11_25.2: type = converted %.loc11_20, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25.3: type = converted %.loc11_24, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25.4: type = converted %.loc11_25.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %n.loc15_8.1: () = param n +// CHECK:STDOUT: @Foo.%n: () = bind_name n, %n.loc15_8.1 +// CHECK:STDOUT: %.loc15_20: () = tuple_literal () +// CHECK:STDOUT: %.loc15_24: () = tuple_literal () +// CHECK:STDOUT: %.loc15_25.1: ((), ()) = tuple_literal (%.loc15_20, %.loc15_24) +// CHECK:STDOUT: %.loc15_25.2: type = converted %.loc15_20, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_25.3: type = converted %.loc15_24, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_25.4: type = converted %.loc15_25.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: @Foo.%return: ref ((), ()) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -172,16 +176,16 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: fn @Foo(%n: ()) -> %return: ((), ()) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: () = name_ref n, %n -// CHECK:STDOUT: %.loc12_15.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_16.1: ((), ()) = tuple_literal (%n.ref, %.loc12_15.1) -// CHECK:STDOUT: %.loc12_16.2: ref () = tuple_access %return, element0 -// CHECK:STDOUT: %.loc12_11: init () = tuple_init () to %.loc12_16.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.3: init () = converted %n.ref, %.loc12_11 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.4: ref () = tuple_access %return, element1 -// CHECK:STDOUT: %.loc12_15.2: init () = tuple_init () to %.loc12_16.4 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.5: init () = converted %.loc12_15.1, %.loc12_15.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.6: init ((), ()) = tuple_init (%.loc12_16.3, %.loc12_16.5) to %return [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc12_17: init ((), ()) = converted %.loc12_16.1, %.loc12_16.6 [template = constants.%tuple.2] -// CHECK:STDOUT: return %.loc12_17 to %return +// CHECK:STDOUT: %.loc16_15.1: () = tuple_literal () +// CHECK:STDOUT: %.loc16_16.1: ((), ()) = tuple_literal (%n.ref, %.loc16_15.1) +// CHECK:STDOUT: %.loc16_16.2: ref () = tuple_access %return, element0 +// CHECK:STDOUT: %.loc16_11: init () = tuple_init () to %.loc16_16.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.3: init () = converted %n.ref, %.loc16_11 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.4: ref () = tuple_access %return, element1 +// CHECK:STDOUT: %.loc16_15.2: init () = tuple_init () to %.loc16_16.4 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.5: init () = converted %.loc16_15.1, %.loc16_15.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.6: init ((), ()) = tuple_init (%.loc16_16.3, %.loc16_16.5) to %return [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc16_17: init ((), ()) = converted %.loc16_16.1, %.loc16_16.6 [template = constants.%tuple.2] +// CHECK:STDOUT: return %.loc16_17 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon index 10dac04ea701..7cb758ff870e 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon @@ -7,6 +7,10 @@ // Check that the command-line flag to dump textual IR works. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon fn A(n: ()) -> () { return r#n; @@ -39,30 +43,30 @@ fn C(r#if: ()) -> () { // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc11_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_10.2: type = converted %.loc11_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %n.loc11_6.1: () = param n -// CHECK:STDOUT: @A.%n: () = bind_name n, %n.loc11_6.1 -// CHECK:STDOUT: %.loc11_17.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_17.2: type = converted %.loc11_17.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_10.2: type = converted %.loc15_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %n.loc15_6.1: () = param n +// CHECK:STDOUT: @A.%n: () = bind_name n, %n.loc15_6.1 +// CHECK:STDOUT: %.loc15_17.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_17.2: type = converted %.loc15_17.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @A.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %n.loc15_6.1: () = param n -// CHECK:STDOUT: @B.%n: () = bind_name n, %n.loc15_6.1 -// CHECK:STDOUT: %.loc15_19.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc19_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_12.2: type = converted %.loc19_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %n.loc19_6.1: () = param n +// CHECK:STDOUT: @B.%n: () = bind_name n, %n.loc19_6.1 +// CHECK:STDOUT: %.loc19_19.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_19.2: type = converted %.loc19_19.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @B.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc19_13.1: () = tuple_literal () -// CHECK:STDOUT: %.loc19_13.2: type = converted %.loc19_13.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %if.loc19_6.1: () = param r#if -// CHECK:STDOUT: @C.%if: () = bind_name r#if, %if.loc19_6.1 -// CHECK:STDOUT: %.loc19_20.1: () = tuple_literal () -// CHECK:STDOUT: %.loc19_20.2: type = converted %.loc19_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_13.1: () = tuple_literal () +// CHECK:STDOUT: %.loc23_13.2: type = converted %.loc23_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %if.loc23_6.1: () = param r#if +// CHECK:STDOUT: @C.%if: () = bind_name r#if, %if.loc23_6.1 +// CHECK:STDOUT: %.loc23_20.1: () = tuple_literal () +// CHECK:STDOUT: %.loc23_20.2: type = converted %.loc23_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @C.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon b/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon index ef978d5dfc7d..7b1b4e623bd2 100644 --- a/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/raw_ir.carbon @@ -7,6 +7,10 @@ // Check that raw IR dumping works as expected. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/raw_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/raw_ir.carbon fn Foo(n: ()) -> ((), ()) { return (n, ()); diff --git a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon b/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon index 3836ce9e3521..b49af1bb85ee 100644 --- a/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +++ b/toolchain/check/testdata/basics/no_prelude/textual_ir.carbon @@ -7,6 +7,10 @@ // Check that the command-line flag to dump textual IR works. // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/textual_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/textual_ir.carbon fn Foo(n: ()) -> ((), ()) { return (n, ()); @@ -29,16 +33,16 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: .Foo = %Foo.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct] { -// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %n.loc11_8.1: () = param n -// CHECK:STDOUT: @Foo.%n: () = bind_name n, %n.loc11_8.1 -// CHECK:STDOUT: %.loc11_20: () = tuple_literal () -// CHECK:STDOUT: %.loc11_24: () = tuple_literal () -// CHECK:STDOUT: %.loc11_25.1: ((), ()) = tuple_literal (%.loc11_20, %.loc11_24) -// CHECK:STDOUT: %.loc11_25.2: type = converted %.loc11_20, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25.3: type = converted %.loc11_24, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc11_25.4: type = converted %.loc11_25.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %n.loc15_8.1: () = param n +// CHECK:STDOUT: @Foo.%n: () = bind_name n, %n.loc15_8.1 +// CHECK:STDOUT: %.loc15_20: () = tuple_literal () +// CHECK:STDOUT: %.loc15_24: () = tuple_literal () +// CHECK:STDOUT: %.loc15_25.1: ((), ()) = tuple_literal (%.loc15_20, %.loc15_24) +// CHECK:STDOUT: %.loc15_25.2: type = converted %.loc15_20, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_25.3: type = converted %.loc15_24, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_25.4: type = converted %.loc15_25.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: @Foo.%return: ref ((), ()) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -46,16 +50,16 @@ fn Foo(n: ()) -> ((), ()) { // CHECK:STDOUT: fn @Foo(%n: ()) -> %return: ((), ()) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: () = name_ref n, %n -// CHECK:STDOUT: %.loc12_15.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_16.1: ((), ()) = tuple_literal (%n.ref, %.loc12_15.1) -// CHECK:STDOUT: %.loc12_16.2: ref () = tuple_access %return, element0 -// CHECK:STDOUT: %.loc12_11: init () = tuple_init () to %.loc12_16.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.3: init () = converted %n.ref, %.loc12_11 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.4: ref () = tuple_access %return, element1 -// CHECK:STDOUT: %.loc12_15.2: init () = tuple_init () to %.loc12_16.4 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.5: init () = converted %.loc12_15.1, %.loc12_15.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc12_16.6: init ((), ()) = tuple_init (%.loc12_16.3, %.loc12_16.5) to %return [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc12_17: init ((), ()) = converted %.loc12_16.1, %.loc12_16.6 [template = constants.%tuple.2] -// CHECK:STDOUT: return %.loc12_17 to %return +// CHECK:STDOUT: %.loc16_15.1: () = tuple_literal () +// CHECK:STDOUT: %.loc16_16.1: ((), ()) = tuple_literal (%n.ref, %.loc16_15.1) +// CHECK:STDOUT: %.loc16_16.2: ref () = tuple_access %return, element0 +// CHECK:STDOUT: %.loc16_11: init () = tuple_init () to %.loc16_16.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.3: init () = converted %n.ref, %.loc16_11 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.4: ref () = tuple_access %return, element1 +// CHECK:STDOUT: %.loc16_15.2: init () = tuple_init () to %.loc16_16.4 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.5: init () = converted %.loc16_15.1, %.loc16_15.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc16_16.6: init ((), ()) = tuple_init (%.loc16_16.3, %.loc16_16.5) to %return [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc16_17: init ((), ()) = converted %.loc16_16.1, %.loc16_16.6 [template = constants.%tuple.2] +// CHECK:STDOUT: return %.loc16_17 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/numeric_literals.carbon b/toolchain/check/testdata/basics/numeric_literals.carbon index c424e00185ba..3459270979e7 100644 --- a/toolchain/check/testdata/basics/numeric_literals.carbon +++ b/toolchain/check/testdata/basics/numeric_literals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/numeric_literals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/numeric_literals.carbon fn F() { // 8 and 9 trigger special behavior in APInt when mishandling signed versus @@ -76,76 +80,76 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 6 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_14.2: type = converted %int.make_type_32, %.loc10_14.1 [template = i32] -// CHECK:STDOUT: %.loc10_20: type = array_type %.loc10_19, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_19: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_14.2: type = converted %int.make_type_32, %.loc14_14.1 [template = i32] +// CHECK:STDOUT: %.loc14_20: type = array_type %.loc14_19, i32 [template = constants.%.3] // CHECK:STDOUT: %ints.var: ref [i32; 6] = var ints // CHECK:STDOUT: %ints: ref [i32; 6] = bind_name ints, %ints.var -// CHECK:STDOUT: %.loc11: i32 = int_literal 8 [template = constants.%.5] -// CHECK:STDOUT: %.loc12: i32 = int_literal 9 [template = constants.%.6] -// CHECK:STDOUT: %.loc13: i32 = int_literal 8 [template = constants.%.5] -// CHECK:STDOUT: %.loc14: i32 = int_literal 8 [template = constants.%.5] -// CHECK:STDOUT: %.loc15: i32 = int_literal 2147483647 [template = constants.%.7] -// CHECK:STDOUT: %.loc16: i32 = int_literal 2147483647 [template = constants.%.7] -// CHECK:STDOUT: %.loc17_3.1: (i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc11, %.loc12, %.loc13, %.loc14, %.loc15, %.loc16) -// CHECK:STDOUT: %.loc17_3.2: i32 = int_literal 0 [template = constants.%.9] -// CHECK:STDOUT: %.loc17_3.3: ref i32 = array_index %ints.var, %.loc17_3.2 -// CHECK:STDOUT: %.loc17_3.4: init i32 = initialize_from %.loc11 to %.loc17_3.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_3.5: i32 = int_literal 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc17_3.6: ref i32 = array_index %ints.var, %.loc17_3.5 -// CHECK:STDOUT: %.loc17_3.7: init i32 = initialize_from %.loc12 to %.loc17_3.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_3.8: i32 = int_literal 2 [template = constants.%.11] -// CHECK:STDOUT: %.loc17_3.9: ref i32 = array_index %ints.var, %.loc17_3.8 -// CHECK:STDOUT: %.loc17_3.10: init i32 = initialize_from %.loc13 to %.loc17_3.9 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_3.11: i32 = int_literal 3 [template = constants.%.12] -// CHECK:STDOUT: %.loc17_3.12: ref i32 = array_index %ints.var, %.loc17_3.11 -// CHECK:STDOUT: %.loc17_3.13: init i32 = initialize_from %.loc14 to %.loc17_3.12 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_3.14: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc17_3.15: ref i32 = array_index %ints.var, %.loc17_3.14 -// CHECK:STDOUT: %.loc17_3.16: init i32 = initialize_from %.loc15 to %.loc17_3.15 [template = constants.%.7] -// CHECK:STDOUT: %.loc17_3.17: i32 = int_literal 5 [template = constants.%.14] -// CHECK:STDOUT: %.loc17_3.18: ref i32 = array_index %ints.var, %.loc17_3.17 -// CHECK:STDOUT: %.loc17_3.19: init i32 = initialize_from %.loc16 to %.loc17_3.18 [template = constants.%.7] -// CHECK:STDOUT: %.loc17_3.20: init [i32; 6] = array_init (%.loc17_3.4, %.loc17_3.7, %.loc17_3.10, %.loc17_3.13, %.loc17_3.16, %.loc17_3.19) to %ints.var [template = constants.%array.1] -// CHECK:STDOUT: %.loc17_4: init [i32; 6] = converted %.loc17_3.1, %.loc17_3.20 [template = constants.%array.1] -// CHECK:STDOUT: assign %ints.var, %.loc17_4 -// CHECK:STDOUT: %.loc18_16.1: i32 = int_literal 64 [template = constants.%.15] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc18_16.1) [template = f64] -// CHECK:STDOUT: %.loc18_21: i32 = int_literal 6 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_16.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc18_16.3: type = converted %float.make_type, %.loc18_16.2 [template = f64] -// CHECK:STDOUT: %.loc18_22: type = array_type %.loc18_21, f64 [template = constants.%.16] +// CHECK:STDOUT: %.loc15: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc16: i32 = int_literal 9 [template = constants.%.6] +// CHECK:STDOUT: %.loc17: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc18: i32 = int_literal 8 [template = constants.%.5] +// CHECK:STDOUT: %.loc19: i32 = int_literal 2147483647 [template = constants.%.7] +// CHECK:STDOUT: %.loc20: i32 = int_literal 2147483647 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_3.1: (i32, i32, i32, i32, i32, i32) = tuple_literal (%.loc15, %.loc16, %.loc17, %.loc18, %.loc19, %.loc20) +// CHECK:STDOUT: %.loc21_3.2: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc21_3.3: ref i32 = array_index %ints.var, %.loc21_3.2 +// CHECK:STDOUT: %.loc21_3.4: init i32 = initialize_from %.loc15 to %.loc21_3.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_3.5: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc21_3.6: ref i32 = array_index %ints.var, %.loc21_3.5 +// CHECK:STDOUT: %.loc21_3.7: init i32 = initialize_from %.loc16 to %.loc21_3.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_3.8: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc21_3.9: ref i32 = array_index %ints.var, %.loc21_3.8 +// CHECK:STDOUT: %.loc21_3.10: init i32 = initialize_from %.loc17 to %.loc21_3.9 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_3.11: i32 = int_literal 3 [template = constants.%.12] +// CHECK:STDOUT: %.loc21_3.12: ref i32 = array_index %ints.var, %.loc21_3.11 +// CHECK:STDOUT: %.loc21_3.13: init i32 = initialize_from %.loc18 to %.loc21_3.12 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_3.14: i32 = int_literal 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc21_3.15: ref i32 = array_index %ints.var, %.loc21_3.14 +// CHECK:STDOUT: %.loc21_3.16: init i32 = initialize_from %.loc19 to %.loc21_3.15 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_3.17: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc21_3.18: ref i32 = array_index %ints.var, %.loc21_3.17 +// CHECK:STDOUT: %.loc21_3.19: init i32 = initialize_from %.loc20 to %.loc21_3.18 [template = constants.%.7] +// CHECK:STDOUT: %.loc21_3.20: init [i32; 6] = array_init (%.loc21_3.4, %.loc21_3.7, %.loc21_3.10, %.loc21_3.13, %.loc21_3.16, %.loc21_3.19) to %ints.var [template = constants.%array.1] +// CHECK:STDOUT: %.loc21_4: init [i32; 6] = converted %.loc21_3.1, %.loc21_3.20 [template = constants.%array.1] +// CHECK:STDOUT: assign %ints.var, %.loc21_4 +// CHECK:STDOUT: %.loc22_16.1: i32 = int_literal 64 [template = constants.%.15] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc22_16.1) [template = f64] +// CHECK:STDOUT: %.loc22_21: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_16.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc22_16.3: type = converted %float.make_type, %.loc22_16.2 [template = f64] +// CHECK:STDOUT: %.loc22_22: type = array_type %.loc22_21, f64 [template = constants.%.16] // CHECK:STDOUT: %floats.var: ref [f64; 6] = var floats // CHECK:STDOUT: %floats: ref [f64; 6] = bind_name floats, %floats.var -// CHECK:STDOUT: %.loc19: f64 = float_literal 0.90000000000000002 [template = constants.%.18] -// CHECK:STDOUT: %.loc20: f64 = float_literal 8 [template = constants.%.19] -// CHECK:STDOUT: %.loc21: f64 = float_literal 80 [template = constants.%.20] -// CHECK:STDOUT: %.loc22: f64 = float_literal 1.0E+7 [template = constants.%.21] -// CHECK:STDOUT: %.loc23: f64 = float_literal 1.0E+8 [template = constants.%.22] -// CHECK:STDOUT: %.loc24: f64 = float_literal 1.0E-8 [template = constants.%.23] -// CHECK:STDOUT: %.loc25_3.1: (f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc19, %.loc20, %.loc21, %.loc22, %.loc23, %.loc24) -// CHECK:STDOUT: %.loc25_3.2: i32 = int_literal 0 [template = constants.%.9] -// CHECK:STDOUT: %.loc25_3.3: ref f64 = array_index %floats.var, %.loc25_3.2 -// CHECK:STDOUT: %.loc25_3.4: init f64 = initialize_from %.loc19 to %.loc25_3.3 [template = constants.%.18] -// CHECK:STDOUT: %.loc25_3.5: i32 = int_literal 1 [template = constants.%.10] -// CHECK:STDOUT: %.loc25_3.6: ref f64 = array_index %floats.var, %.loc25_3.5 -// CHECK:STDOUT: %.loc25_3.7: init f64 = initialize_from %.loc20 to %.loc25_3.6 [template = constants.%.19] -// CHECK:STDOUT: %.loc25_3.8: i32 = int_literal 2 [template = constants.%.11] -// CHECK:STDOUT: %.loc25_3.9: ref f64 = array_index %floats.var, %.loc25_3.8 -// CHECK:STDOUT: %.loc25_3.10: init f64 = initialize_from %.loc21 to %.loc25_3.9 [template = constants.%.20] -// CHECK:STDOUT: %.loc25_3.11: i32 = int_literal 3 [template = constants.%.12] -// CHECK:STDOUT: %.loc25_3.12: ref f64 = array_index %floats.var, %.loc25_3.11 -// CHECK:STDOUT: %.loc25_3.13: init f64 = initialize_from %.loc22 to %.loc25_3.12 [template = constants.%.21] -// CHECK:STDOUT: %.loc25_3.14: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc25_3.15: ref f64 = array_index %floats.var, %.loc25_3.14 -// CHECK:STDOUT: %.loc25_3.16: init f64 = initialize_from %.loc23 to %.loc25_3.15 [template = constants.%.22] -// CHECK:STDOUT: %.loc25_3.17: i32 = int_literal 5 [template = constants.%.14] -// CHECK:STDOUT: %.loc25_3.18: ref f64 = array_index %floats.var, %.loc25_3.17 -// CHECK:STDOUT: %.loc25_3.19: init f64 = initialize_from %.loc24 to %.loc25_3.18 [template = constants.%.23] -// CHECK:STDOUT: %.loc25_3.20: init [f64; 6] = array_init (%.loc25_3.4, %.loc25_3.7, %.loc25_3.10, %.loc25_3.13, %.loc25_3.16, %.loc25_3.19) to %floats.var [template = constants.%array.2] -// CHECK:STDOUT: %.loc25_4: init [f64; 6] = converted %.loc25_3.1, %.loc25_3.20 [template = constants.%array.2] -// CHECK:STDOUT: assign %floats.var, %.loc25_4 +// CHECK:STDOUT: %.loc23: f64 = float_literal 0.90000000000000002 [template = constants.%.18] +// CHECK:STDOUT: %.loc24: f64 = float_literal 8 [template = constants.%.19] +// CHECK:STDOUT: %.loc25: f64 = float_literal 80 [template = constants.%.20] +// CHECK:STDOUT: %.loc26: f64 = float_literal 1.0E+7 [template = constants.%.21] +// CHECK:STDOUT: %.loc27: f64 = float_literal 1.0E+8 [template = constants.%.22] +// CHECK:STDOUT: %.loc28: f64 = float_literal 1.0E-8 [template = constants.%.23] +// CHECK:STDOUT: %.loc29_3.1: (f64, f64, f64, f64, f64, f64) = tuple_literal (%.loc23, %.loc24, %.loc25, %.loc26, %.loc27, %.loc28) +// CHECK:STDOUT: %.loc29_3.2: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc29_3.3: ref f64 = array_index %floats.var, %.loc29_3.2 +// CHECK:STDOUT: %.loc29_3.4: init f64 = initialize_from %.loc23 to %.loc29_3.3 [template = constants.%.18] +// CHECK:STDOUT: %.loc29_3.5: i32 = int_literal 1 [template = constants.%.10] +// CHECK:STDOUT: %.loc29_3.6: ref f64 = array_index %floats.var, %.loc29_3.5 +// CHECK:STDOUT: %.loc29_3.7: init f64 = initialize_from %.loc24 to %.loc29_3.6 [template = constants.%.19] +// CHECK:STDOUT: %.loc29_3.8: i32 = int_literal 2 [template = constants.%.11] +// CHECK:STDOUT: %.loc29_3.9: ref f64 = array_index %floats.var, %.loc29_3.8 +// CHECK:STDOUT: %.loc29_3.10: init f64 = initialize_from %.loc25 to %.loc29_3.9 [template = constants.%.20] +// CHECK:STDOUT: %.loc29_3.11: i32 = int_literal 3 [template = constants.%.12] +// CHECK:STDOUT: %.loc29_3.12: ref f64 = array_index %floats.var, %.loc29_3.11 +// CHECK:STDOUT: %.loc29_3.13: init f64 = initialize_from %.loc26 to %.loc29_3.12 [template = constants.%.21] +// CHECK:STDOUT: %.loc29_3.14: i32 = int_literal 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc29_3.15: ref f64 = array_index %floats.var, %.loc29_3.14 +// CHECK:STDOUT: %.loc29_3.16: init f64 = initialize_from %.loc27 to %.loc29_3.15 [template = constants.%.22] +// CHECK:STDOUT: %.loc29_3.17: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc29_3.18: ref f64 = array_index %floats.var, %.loc29_3.17 +// CHECK:STDOUT: %.loc29_3.19: init f64 = initialize_from %.loc28 to %.loc29_3.18 [template = constants.%.23] +// CHECK:STDOUT: %.loc29_3.20: init [f64; 6] = array_init (%.loc29_3.4, %.loc29_3.7, %.loc29_3.10, %.loc29_3.13, %.loc29_3.16, %.loc29_3.19) to %floats.var [template = constants.%array.2] +// CHECK:STDOUT: %.loc29_4: init [f64; 6] = converted %.loc29_3.1, %.loc29_3.20 [template = constants.%array.2] +// CHECK:STDOUT: assign %floats.var, %.loc29_4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/parens.carbon b/toolchain/check/testdata/basics/parens.carbon index 04be58b03aba..710a1ed6c8ad 100644 --- a/toolchain/check/testdata/basics/parens.carbon +++ b/toolchain/check/testdata/basics/parens.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/parens.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/parens.carbon var a: i32 = (1); var b: i32 = ((2)); @@ -25,15 +29,15 @@ var b: i32 = ((2)); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -42,10 +46,10 @@ var b: i32 = ((2)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: assign file.%a.var, %.loc7 -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: assign file.%b.var, %.loc8 +// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: assign file.%a.var, %.loc11 +// CHECK:STDOUT: %.loc12: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: assign file.%b.var, %.loc12 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/run.carbon b/toolchain/check/testdata/basics/run.carbon index 651e05bb29de..a9fc08900572 100644 --- a/toolchain/check/testdata/basics/run.carbon +++ b/toolchain/check/testdata/basics/run.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/run.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/run.carbon fn Run() {} diff --git a/toolchain/check/testdata/basics/run_i32.carbon b/toolchain/check/testdata/basics/run_i32.carbon index 0c5fd570b184..74a8eeb01d9b 100644 --- a/toolchain/check/testdata/basics/run_i32.carbon +++ b/toolchain/check/testdata/basics/run_i32.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/run_i32.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/run_i32.carbon fn Run() -> i32 { return 0; } @@ -26,8 +30,8 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32, %.loc11_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -36,7 +40,7 @@ fn Run() -> i32 { return 0; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/basics/type_literals.carbon b/toolchain/check/testdata/basics/type_literals.carbon index 597fd42e0c05..1cbed44613e3 100644 --- a/toolchain/check/testdata/basics/type_literals.carbon +++ b/toolchain/check/testdata/basics/type_literals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/type_literals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/type_literals.carbon // --- iN.carbon library "iN"; diff --git a/toolchain/check/testdata/builtins/bool/make_type.carbon b/toolchain/check/testdata/builtins/bool/make_type.carbon index e869ab210cf1..ef02639fde29 100644 --- a/toolchain/check/testdata/builtins/bool/make_type.carbon +++ b/toolchain/check/testdata/builtins/bool/make_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/bool/make_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/bool/make_type.carbon // --- types.carbon diff --git a/toolchain/check/testdata/builtins/float/add.carbon b/toolchain/check/testdata/builtins/float/add.carbon index 5ca9279d221a..90588497bd7e 100644 --- a/toolchain/check/testdata/builtins/float/add.carbon +++ b/toolchain/check/testdata/builtins/float/add.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/add.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/add.carbon // --- float_add.carbon diff --git a/toolchain/check/testdata/builtins/float/div.carbon b/toolchain/check/testdata/builtins/float/div.carbon index 466c0b651a76..3c06efbea305 100644 --- a/toolchain/check/testdata/builtins/float/div.carbon +++ b/toolchain/check/testdata/builtins/float/div.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/div.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/div.carbon // --- float_div.carbon diff --git a/toolchain/check/testdata/builtins/float/eq.carbon b/toolchain/check/testdata/builtins/float/eq.carbon index 4920d360ad3a..fc7566fd4fac 100644 --- a/toolchain/check/testdata/builtins/float/eq.carbon +++ b/toolchain/check/testdata/builtins/float/eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/eq.carbon // --- float_eq.carbon diff --git a/toolchain/check/testdata/builtins/float/greater.carbon b/toolchain/check/testdata/builtins/float/greater.carbon index 92f140b3ef81..5a6a5b4c8ad1 100644 --- a/toolchain/check/testdata/builtins/float/greater.carbon +++ b/toolchain/check/testdata/builtins/float/greater.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/greater.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/greater.carbon // --- float_greater.carbon diff --git a/toolchain/check/testdata/builtins/float/greater_eq.carbon b/toolchain/check/testdata/builtins/float/greater_eq.carbon index 24f9b3cad9eb..82387eaa60b9 100644 --- a/toolchain/check/testdata/builtins/float/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/float/greater_eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/greater_eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/greater_eq.carbon // --- float_greater_eq.carbon diff --git a/toolchain/check/testdata/builtins/float/less.carbon b/toolchain/check/testdata/builtins/float/less.carbon index 6d33b967eebb..277aaffe6b77 100644 --- a/toolchain/check/testdata/builtins/float/less.carbon +++ b/toolchain/check/testdata/builtins/float/less.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/less.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/less.carbon // --- float_less.carbon diff --git a/toolchain/check/testdata/builtins/float/less_eq.carbon b/toolchain/check/testdata/builtins/float/less_eq.carbon index cfadbc60a27b..7b4fb21c0edc 100644 --- a/toolchain/check/testdata/builtins/float/less_eq.carbon +++ b/toolchain/check/testdata/builtins/float/less_eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/less_eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/less_eq.carbon // --- float_less_eq.carbon diff --git a/toolchain/check/testdata/builtins/float/make_type.carbon b/toolchain/check/testdata/builtins/float/make_type.carbon index 935ac9631540..fbcf4713683a 100644 --- a/toolchain/check/testdata/builtins/float/make_type.carbon +++ b/toolchain/check/testdata/builtins/float/make_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/make_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/make_type.carbon // --- types.carbon diff --git a/toolchain/check/testdata/builtins/float/mul.carbon b/toolchain/check/testdata/builtins/float/mul.carbon index ac802dd40b83..015011f4a2a9 100644 --- a/toolchain/check/testdata/builtins/float/mul.carbon +++ b/toolchain/check/testdata/builtins/float/mul.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/mul.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/mul.carbon // --- mul_sub.carbon diff --git a/toolchain/check/testdata/builtins/float/negate.carbon b/toolchain/check/testdata/builtins/float/negate.carbon index eb73f6b94825..79ee46b767eb 100644 --- a/toolchain/check/testdata/builtins/float/negate.carbon +++ b/toolchain/check/testdata/builtins/float/negate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/negate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/negate.carbon // --- float_negate.carbon diff --git a/toolchain/check/testdata/builtins/float/neq.carbon b/toolchain/check/testdata/builtins/float/neq.carbon index c6377187cad5..34f1a689db1a 100644 --- a/toolchain/check/testdata/builtins/float/neq.carbon +++ b/toolchain/check/testdata/builtins/float/neq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/neq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/neq.carbon // --- float_neq.carbon diff --git a/toolchain/check/testdata/builtins/float/sub.carbon b/toolchain/check/testdata/builtins/float/sub.carbon index 58785f466c82..1b0e16f140a0 100644 --- a/toolchain/check/testdata/builtins/float/sub.carbon +++ b/toolchain/check/testdata/builtins/float/sub.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/float/sub.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/float/sub.carbon // --- float_sub.carbon diff --git a/toolchain/check/testdata/builtins/int/and.carbon b/toolchain/check/testdata/builtins/int/and.carbon index ceaa44730ce6..4c37ec7c144f 100644 --- a/toolchain/check/testdata/builtins/int/and.carbon +++ b/toolchain/check/testdata/builtins/int/and.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/and.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/and.carbon // --- int_and.carbon diff --git a/toolchain/check/testdata/builtins/int/complement.carbon b/toolchain/check/testdata/builtins/int/complement.carbon index d91c6d54e8b0..f0378d792fdb 100644 --- a/toolchain/check/testdata/builtins/int/complement.carbon +++ b/toolchain/check/testdata/builtins/int/complement.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/complement.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/complement.carbon // --- int_complement.carbon diff --git a/toolchain/check/testdata/builtins/int/eq.carbon b/toolchain/check/testdata/builtins/int/eq.carbon index 4fe728af6905..386c89d26854 100644 --- a/toolchain/check/testdata/builtins/int/eq.carbon +++ b/toolchain/check/testdata/builtins/int/eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/eq.carbon // --- int_eq.carbon diff --git a/toolchain/check/testdata/builtins/int/greater.carbon b/toolchain/check/testdata/builtins/int/greater.carbon index 96332830688d..94fe10a91523 100644 --- a/toolchain/check/testdata/builtins/int/greater.carbon +++ b/toolchain/check/testdata/builtins/int/greater.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/greater.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/greater.carbon // --- int_greater.carbon diff --git a/toolchain/check/testdata/builtins/int/greater_eq.carbon b/toolchain/check/testdata/builtins/int/greater_eq.carbon index 70636bfb0b08..bfa666353e81 100644 --- a/toolchain/check/testdata/builtins/int/greater_eq.carbon +++ b/toolchain/check/testdata/builtins/int/greater_eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/greater_eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/greater_eq.carbon // --- int_greater_eq.carbon diff --git a/toolchain/check/testdata/builtins/int/left_shift.carbon b/toolchain/check/testdata/builtins/int/left_shift.carbon index e4938273defd..4ff5ae588788 100644 --- a/toolchain/check/testdata/builtins/int/left_shift.carbon +++ b/toolchain/check/testdata/builtins/int/left_shift.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/left_shift.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/left_shift.carbon // --- int_left_shift.carbon diff --git a/toolchain/check/testdata/builtins/int/less.carbon b/toolchain/check/testdata/builtins/int/less.carbon index 765ae175812d..00dad4e97c23 100644 --- a/toolchain/check/testdata/builtins/int/less.carbon +++ b/toolchain/check/testdata/builtins/int/less.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/less.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/less.carbon // --- int_less.carbon diff --git a/toolchain/check/testdata/builtins/int/less_eq.carbon b/toolchain/check/testdata/builtins/int/less_eq.carbon index 1bec83f426b6..8a49c113c818 100644 --- a/toolchain/check/testdata/builtins/int/less_eq.carbon +++ b/toolchain/check/testdata/builtins/int/less_eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/less_eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/less_eq.carbon // --- int_less_eq.carbon diff --git a/toolchain/check/testdata/builtins/int/make_type_32.carbon b/toolchain/check/testdata/builtins/int/make_type_32.carbon index 839f9384ed31..cc9c068088f7 100644 --- a/toolchain/check/testdata/builtins/int/make_type_32.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_32.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/make_type_32.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/make_type_32.carbon // --- types.carbon diff --git a/toolchain/check/testdata/builtins/int/make_type_signed.carbon b/toolchain/check/testdata/builtins/int/make_type_signed.carbon index 48613f740d3b..fcf4b6bad9ec 100644 --- a/toolchain/check/testdata/builtins/int/make_type_signed.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_signed.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/make_type_signed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/make_type_signed.carbon // --- types.carbon diff --git a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon index 99e1a24eaff7..455ef078e0ad 100644 --- a/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +++ b/toolchain/check/testdata/builtins/int/make_type_unsigned.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/make_type_unsigned.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/make_type_unsigned.carbon // --- types.carbon diff --git a/toolchain/check/testdata/builtins/int/neq.carbon b/toolchain/check/testdata/builtins/int/neq.carbon index b7a2f81456a5..cc1980d88a42 100644 --- a/toolchain/check/testdata/builtins/int/neq.carbon +++ b/toolchain/check/testdata/builtins/int/neq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/neq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/neq.carbon // --- int_neq.carbon diff --git a/toolchain/check/testdata/builtins/int/or.carbon b/toolchain/check/testdata/builtins/int/or.carbon index ea51ae9762b1..8a38028a3728 100644 --- a/toolchain/check/testdata/builtins/int/or.carbon +++ b/toolchain/check/testdata/builtins/int/or.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/or.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/or.carbon // --- int_or.carbon diff --git a/toolchain/check/testdata/builtins/int/right_shift.carbon b/toolchain/check/testdata/builtins/int/right_shift.carbon index c8134c0d614f..1b20393f9124 100644 --- a/toolchain/check/testdata/builtins/int/right_shift.carbon +++ b/toolchain/check/testdata/builtins/int/right_shift.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/right_shift.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/right_shift.carbon // --- int_right_shift.carbon diff --git a/toolchain/check/testdata/builtins/int/sadd.carbon b/toolchain/check/testdata/builtins/int/sadd.carbon index f9901dcfc61c..6458b63f82d9 100644 --- a/toolchain/check/testdata/builtins/int/sadd.carbon +++ b/toolchain/check/testdata/builtins/int/sadd.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/sadd.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/sadd.carbon // --- int_add.carbon diff --git a/toolchain/check/testdata/builtins/int/sdiv.carbon b/toolchain/check/testdata/builtins/int/sdiv.carbon index 2b2b3f2a7882..f4a764e30f19 100644 --- a/toolchain/check/testdata/builtins/int/sdiv.carbon +++ b/toolchain/check/testdata/builtins/int/sdiv.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/sdiv.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/sdiv.carbon // --- int_div.carbon diff --git a/toolchain/check/testdata/builtins/int/smod.carbon b/toolchain/check/testdata/builtins/int/smod.carbon index 05aafb25953f..3f989a6c3dda 100644 --- a/toolchain/check/testdata/builtins/int/smod.carbon +++ b/toolchain/check/testdata/builtins/int/smod.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/smod.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/smod.carbon // --- int_div.carbon diff --git a/toolchain/check/testdata/builtins/int/smul.carbon b/toolchain/check/testdata/builtins/int/smul.carbon index cf9e6bd4508b..0a78b89c3d82 100644 --- a/toolchain/check/testdata/builtins/int/smul.carbon +++ b/toolchain/check/testdata/builtins/int/smul.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/smul.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/smul.carbon // --- int_mul.carbon diff --git a/toolchain/check/testdata/builtins/int/snegate.carbon b/toolchain/check/testdata/builtins/int/snegate.carbon index a47c13387f09..e51f8b3cfdf3 100644 --- a/toolchain/check/testdata/builtins/int/snegate.carbon +++ b/toolchain/check/testdata/builtins/int/snegate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/snegate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/snegate.carbon // --- int_negate.carbon diff --git a/toolchain/check/testdata/builtins/int/ssub.carbon b/toolchain/check/testdata/builtins/int/ssub.carbon index 1ccbf99937e7..61e451533d32 100644 --- a/toolchain/check/testdata/builtins/int/ssub.carbon +++ b/toolchain/check/testdata/builtins/int/ssub.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/ssub.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/ssub.carbon // --- int_sub.carbon diff --git a/toolchain/check/testdata/builtins/int/uadd.carbon b/toolchain/check/testdata/builtins/int/uadd.carbon index c4384c8b6107..8385c0789863 100644 --- a/toolchain/check/testdata/builtins/int/uadd.carbon +++ b/toolchain/check/testdata/builtins/int/uadd.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/uadd.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/uadd.carbon // --- int_add.carbon diff --git a/toolchain/check/testdata/builtins/int/udiv.carbon b/toolchain/check/testdata/builtins/int/udiv.carbon index 3a2560ca1f33..d6567c985302 100644 --- a/toolchain/check/testdata/builtins/int/udiv.carbon +++ b/toolchain/check/testdata/builtins/int/udiv.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/udiv.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/udiv.carbon // --- int_div.carbon diff --git a/toolchain/check/testdata/builtins/int/umod.carbon b/toolchain/check/testdata/builtins/int/umod.carbon index c69bf51d9135..1b2df04f3f33 100644 --- a/toolchain/check/testdata/builtins/int/umod.carbon +++ b/toolchain/check/testdata/builtins/int/umod.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/umod.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/umod.carbon // --- int_div.carbon diff --git a/toolchain/check/testdata/builtins/int/umul.carbon b/toolchain/check/testdata/builtins/int/umul.carbon index ab9115459caf..3cdb90b72fd0 100644 --- a/toolchain/check/testdata/builtins/int/umul.carbon +++ b/toolchain/check/testdata/builtins/int/umul.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/umul.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/umul.carbon // --- int_mul.carbon diff --git a/toolchain/check/testdata/builtins/int/unegate.carbon b/toolchain/check/testdata/builtins/int/unegate.carbon index 7271a9f0e11b..75ee94ff30fb 100644 --- a/toolchain/check/testdata/builtins/int/unegate.carbon +++ b/toolchain/check/testdata/builtins/int/unegate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/unegate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/unegate.carbon // --- int_negate.carbon diff --git a/toolchain/check/testdata/builtins/int/usub.carbon b/toolchain/check/testdata/builtins/int/usub.carbon index 72caf73651f8..24d02e58c68f 100644 --- a/toolchain/check/testdata/builtins/int/usub.carbon +++ b/toolchain/check/testdata/builtins/int/usub.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/usub.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/usub.carbon // --- int_sub.carbon diff --git a/toolchain/check/testdata/builtins/int/xor.carbon b/toolchain/check/testdata/builtins/int/xor.carbon index 20354eecd5f7..05168c9022de 100644 --- a/toolchain/check/testdata/builtins/int/xor.carbon +++ b/toolchain/check/testdata/builtins/int/xor.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/builtins/int/xor.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/builtins/int/xor.carbon // --- int_xor.carbon diff --git a/toolchain/check/testdata/class/adapt.carbon b/toolchain/check/testdata/class/adapt.carbon index 9fc79f680f88..c655e48ae932 100644 --- a/toolchain/check/testdata/class/adapt.carbon +++ b/toolchain/check/testdata/class/adapt.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/adapt.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/adapt.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/class/base.carbon b/toolchain/check/testdata/class/base.carbon index 15f7f6812dcf..fab9d3f0515b 100644 --- a/toolchain/check/testdata/class/base.carbon +++ b/toolchain/check/testdata/class/base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base.carbon base class Base { var b: i32; @@ -67,50 +71,50 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { -// CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.5] { -// CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.loc21_11.1: Derived = param d -// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc21_11.1 -// CHECK:STDOUT: %int.make_type_32.loc21_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc21_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc21_35.1: (type, type) = tuple_literal (%int.make_type_32.loc21_27, %int.make_type_32.loc21_32) -// CHECK:STDOUT: %.loc21_35.2: type = value_of_initializer %int.make_type_32.loc21_27 [template = i32] -// CHECK:STDOUT: %.loc21_35.3: type = converted %int.make_type_32.loc21_27, %.loc21_35.2 [template = i32] -// CHECK:STDOUT: %.loc21_35.4: type = value_of_initializer %int.make_type_32.loc21_32 [template = i32] -// CHECK:STDOUT: %.loc21_35.5: type = converted %int.make_type_32.loc21_32, %.loc21_35.4 [template = i32] -// CHECK:STDOUT: %.loc21_35.6: type = converted %.loc21_35.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc25_11.1: Derived = param d +// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc25_11.1 +// CHECK:STDOUT: %int.make_type_32.loc25_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc25_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_35.1: (type, type) = tuple_literal (%int.make_type_32.loc25_27, %int.make_type_32.loc25_32) +// CHECK:STDOUT: %.loc25_35.2: type = value_of_initializer %int.make_type_32.loc25_27 [template = i32] +// CHECK:STDOUT: %.loc25_35.3: type = converted %int.make_type_32.loc25_27, %.loc25_35.2 [template = i32] +// CHECK:STDOUT: %.loc25_35.4: type = value_of_initializer %int.make_type_32.loc25_32 [template = i32] +// CHECK:STDOUT: %.loc25_35.5: type = converted %int.make_type_32.loc25_32, %.loc25_35.4 [template = i32] +// CHECK:STDOUT: %.loc25_35.6: type = converted %.loc25_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl b, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .b = %.loc8_8 +// CHECK:STDOUT: .b = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl Base, element0 [template] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] -// CHECK:STDOUT: %.loc14_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %.loc18_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_10.2: type = converted %int.make_type_32, %.loc18_10.1 [template = i32] +// CHECK:STDOUT: %.loc18_8: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .d = %.loc14_8 +// CHECK:STDOUT: .base = %.loc16 +// CHECK:STDOUT: .d = %.loc18_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -118,42 +122,42 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: %.loc18_26.1: {.b: i32} = struct_literal (%.loc18_25) -// CHECK:STDOUT: %.loc18_34: i32 = int_literal 7 [template = constants.%.12] -// CHECK:STDOUT: %.loc18_35.1: {.base: {.b: i32}, .d: i32} = struct_literal (%.loc18_26.1, %.loc18_34) -// CHECK:STDOUT: %.loc18_35.2: ref Base = class_element_access %return, element0 -// CHECK:STDOUT: %.loc18_26.2: ref i32 = class_element_access %.loc18_35.2, element0 -// CHECK:STDOUT: %.loc18_26.3: init i32 = initialize_from %.loc18_25 to %.loc18_26.2 [template = constants.%.11] -// CHECK:STDOUT: %.loc18_26.4: init Base = class_init (%.loc18_26.3), %.loc18_35.2 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc18_35.3: init Base = converted %.loc18_26.1, %.loc18_26.4 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc18_35.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc18_35.5: init i32 = initialize_from %.loc18_34 to %.loc18_35.4 [template = constants.%.12] -// CHECK:STDOUT: %.loc18_35.6: init Derived = class_init (%.loc18_35.3, %.loc18_35.5), %return [template = constants.%struct.4] -// CHECK:STDOUT: %.loc18_36: init Derived = converted %.loc18_35.1, %.loc18_35.6 [template = constants.%struct.4] -// CHECK:STDOUT: return %.loc18_36 to %return +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: %.loc22_26.1: {.b: i32} = struct_literal (%.loc22_25) +// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.12] +// CHECK:STDOUT: %.loc22_35.1: {.base: {.b: i32}, .d: i32} = struct_literal (%.loc22_26.1, %.loc22_34) +// CHECK:STDOUT: %.loc22_35.2: ref Base = class_element_access %return, element0 +// CHECK:STDOUT: %.loc22_26.2: ref i32 = class_element_access %.loc22_35.2, element0 +// CHECK:STDOUT: %.loc22_26.3: init i32 = initialize_from %.loc22_25 to %.loc22_26.2 [template = constants.%.11] +// CHECK:STDOUT: %.loc22_26.4: init Base = class_init (%.loc22_26.3), %.loc22_35.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc22_35.3: init Base = converted %.loc22_26.1, %.loc22_26.4 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc22_35.4: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc22_35.5: init i32 = initialize_from %.loc22_34 to %.loc22_35.4 [template = constants.%.12] +// CHECK:STDOUT: %.loc22_35.6: init Derived = class_init (%.loc22_35.3, %.loc22_35.5), %return [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_36: init Derived = converted %.loc22_35.1, %.loc22_35.6 [template = constants.%struct.4] +// CHECK:STDOUT: return %.loc22_36 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Access(%d: Derived) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %d.ref.loc22_11: Derived = name_ref d, %d -// CHECK:STDOUT: %d.ref.loc22_12: = name_ref d, @Derived.%.loc14_8 [template = @Derived.%.loc14_8] -// CHECK:STDOUT: %.loc22_12.1: ref i32 = class_element_access %d.ref.loc22_11, element1 -// CHECK:STDOUT: %.loc22_12.2: i32 = bind_value %.loc22_12.1 -// CHECK:STDOUT: %d.ref.loc22_16: Derived = name_ref d, %d -// CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc12 [template = @Derived.%.loc12] -// CHECK:STDOUT: %.loc22_17.1: ref Base = class_element_access %d.ref.loc22_16, element0 -// CHECK:STDOUT: %.loc22_17.2: Base = bind_value %.loc22_17.1 -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc8_8 [template = @Base.%.loc8_8] -// CHECK:STDOUT: %.loc22_22.1: ref i32 = class_element_access %.loc22_17.2, element0 -// CHECK:STDOUT: %.loc22_22.2: i32 = bind_value %.loc22_22.1 -// CHECK:STDOUT: %.loc22_24.1: (i32, i32) = tuple_literal (%.loc22_12.2, %.loc22_22.2) -// CHECK:STDOUT: %.loc22_24.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc22_24.3: init i32 = initialize_from %.loc22_12.2 to %.loc22_24.2 -// CHECK:STDOUT: %.loc22_24.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc22_24.5: init i32 = initialize_from %.loc22_22.2 to %.loc22_24.4 -// CHECK:STDOUT: %.loc22_24.6: init (i32, i32) = tuple_init (%.loc22_24.3, %.loc22_24.5) to %return -// CHECK:STDOUT: %.loc22_25: init (i32, i32) = converted %.loc22_24.1, %.loc22_24.6 -// CHECK:STDOUT: return %.loc22_25 to %return +// CHECK:STDOUT: %d.ref.loc26_11: Derived = name_ref d, %d +// CHECK:STDOUT: %d.ref.loc26_12: = name_ref d, @Derived.%.loc18_8 [template = @Derived.%.loc18_8] +// CHECK:STDOUT: %.loc26_12.1: ref i32 = class_element_access %d.ref.loc26_11, element1 +// CHECK:STDOUT: %.loc26_12.2: i32 = bind_value %.loc26_12.1 +// CHECK:STDOUT: %d.ref.loc26_16: Derived = name_ref d, %d +// CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc16 [template = @Derived.%.loc16] +// CHECK:STDOUT: %.loc26_17.1: ref Base = class_element_access %d.ref.loc26_16, element0 +// CHECK:STDOUT: %.loc26_17.2: Base = bind_value %.loc26_17.1 +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc12_8 [template = @Base.%.loc12_8] +// CHECK:STDOUT: %.loc26_22.1: ref i32 = class_element_access %.loc26_17.2, element0 +// CHECK:STDOUT: %.loc26_22.2: i32 = bind_value %.loc26_22.1 +// CHECK:STDOUT: %.loc26_24.1: (i32, i32) = tuple_literal (%.loc26_12.2, %.loc26_22.2) +// CHECK:STDOUT: %.loc26_24.2: ref i32 = tuple_access %return, element0 +// CHECK:STDOUT: %.loc26_24.3: init i32 = initialize_from %.loc26_12.2 to %.loc26_24.2 +// CHECK:STDOUT: %.loc26_24.4: ref i32 = tuple_access %return, element1 +// CHECK:STDOUT: %.loc26_24.5: init i32 = initialize_from %.loc26_22.2 to %.loc26_24.4 +// CHECK:STDOUT: %.loc26_24.6: init (i32, i32) = tuple_init (%.loc26_24.3, %.loc26_24.5) to %return +// CHECK:STDOUT: %.loc26_25: init (i32, i32) = converted %.loc26_24.1, %.loc26_24.6 +// CHECK:STDOUT: return %.loc26_25 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_field.carbon b/toolchain/check/testdata/class/base_field.carbon index b1dbb269bfb9..d14ca812cd9f 100644 --- a/toolchain/check/testdata/class/base_field.carbon +++ b/toolchain/check/testdata/class/base_field.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_field.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_field.carbon base class Base { var a: i32; @@ -62,55 +66,55 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.2] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc20_21: type = ptr_type Derived [template = constants.%.8] -// CHECK:STDOUT: %p.loc20_11.1: Derived* = param p -// CHECK:STDOUT: @Access.%p: Derived* = bind_name p, %p.loc20_11.1 +// CHECK:STDOUT: %.loc24_21: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %p.loc24_11.1: Derived* = param p +// CHECK:STDOUT: @Access.%p: Derived* = bind_name p, %p.loc24_11.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc20_30.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc20_30.2: type = converted %int.make_type_32, %.loc20_30.1 [template = i32] -// CHECK:STDOUT: %.loc20_30.3: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: %.loc24_30.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc24_30.2: type = converted %int.make_type_32, %.loc24_30.1 [template = i32] +// CHECK:STDOUT: %.loc24_30.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: @Access.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] -// CHECK:STDOUT: %.loc10_8: = field_decl c, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl c, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 -// CHECK:STDOUT: .c = %.loc10_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 +// CHECK:STDOUT: .c = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc14: = base_decl Base, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32.loc16, %.loc16_10.1 [template = i32] -// CHECK:STDOUT: %.loc16_8: = field_decl d, element1 [template] -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32.loc17, %.loc17_10.1 [template = i32] -// CHECK:STDOUT: %.loc17_8: = field_decl e, element2 [template] +// CHECK:STDOUT: %.loc18: = base_decl Base, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_10.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_10.2: type = converted %int.make_type_32.loc20, %.loc20_10.1 [template = i32] +// CHECK:STDOUT: %.loc20_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_10.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_10.2: type = converted %int.make_type_32.loc21, %.loc21_10.1 [template = i32] +// CHECK:STDOUT: %.loc21_8: = field_decl e, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc14 -// CHECK:STDOUT: .d = %.loc16_8 -// CHECK:STDOUT: .e = %.loc17_8 +// CHECK:STDOUT: .base = %.loc18 +// CHECK:STDOUT: .d = %.loc20_8 +// CHECK:STDOUT: .e = %.loc21_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -119,12 +123,12 @@ fn Access(p: Derived*) -> i32* { // CHECK:STDOUT: fn @Access(%p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p -// CHECK:STDOUT: %.loc21_12: ref Derived = deref %p.ref -// CHECK:STDOUT: %c.ref: = name_ref c, @Base.%.loc10_8 [template = @Base.%.loc10_8] -// CHECK:STDOUT: %.loc21_15.1: ref Base = class_element_access %.loc21_12, element0 -// CHECK:STDOUT: %.loc21_15.2: ref Base = converted %.loc21_12, %.loc21_15.1 -// CHECK:STDOUT: %.loc21_15.3: ref i32 = class_element_access %.loc21_15.2, element2 -// CHECK:STDOUT: %.loc21_10: i32* = addr_of %.loc21_15.3 -// CHECK:STDOUT: return %.loc21_10 +// CHECK:STDOUT: %.loc25_12: ref Derived = deref %p.ref +// CHECK:STDOUT: %c.ref: = name_ref c, @Base.%.loc14_8 [template = @Base.%.loc14_8] +// CHECK:STDOUT: %.loc25_15.1: ref Base = class_element_access %.loc25_12, element0 +// CHECK:STDOUT: %.loc25_15.2: ref Base = converted %.loc25_12, %.loc25_15.1 +// CHECK:STDOUT: %.loc25_15.3: ref i32 = class_element_access %.loc25_15.2, element2 +// CHECK:STDOUT: %.loc25_10: i32* = addr_of %.loc25_15.3 +// CHECK:STDOUT: return %.loc25_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_function_unqualified.carbon b/toolchain/check/testdata/class/base_function_unqualified.carbon index 70fbc6083b75..cb70b28f6551 100644 --- a/toolchain/check/testdata/class/base_function_unqualified.carbon +++ b/toolchain/check/testdata/class/base_function_unqualified.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_function_unqualified.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_function_unqualified.carbon base class Base { fn F(); @@ -59,13 +63,13 @@ fn Derived.H() { // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl Base, element0 [template] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc12 +// CHECK:STDOUT: .base = %.loc16 // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .H = %H.decl // CHECK:STDOUT: extend name_scope2 diff --git a/toolchain/check/testdata/class/base_method.carbon b/toolchain/check/testdata/class/base_method.carbon index 48e5eb8fcabb..cd08534c8c34 100644 --- a/toolchain/check/testdata/class/base_method.carbon +++ b/toolchain/check/testdata/class/base_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method.carbon base class Base { var a: i32; @@ -58,46 +62,46 @@ fn Call(p: Derived*) { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc13_26: type = ptr_type Base [template = constants.%.3] -// CHECK:STDOUT: %self.loc13_16.1: Base* = param self -// CHECK:STDOUT: @F.%self: Base* = bind_name self, %self.loc13_16.1 -// CHECK:STDOUT: @F.%.loc13: Base* = addr_pattern @F.%self +// CHECK:STDOUT: %.loc17_26: type = ptr_type Base [template = constants.%.3] +// CHECK:STDOUT: %self.loc17_16.1: Base* = param self +// CHECK:STDOUT: @F.%self: Base* = bind_name self, %self.loc17_16.1 +// CHECK:STDOUT: @F.%.loc17: Base* = addr_pattern @F.%self // CHECK:STDOUT: } // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.3] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc21: type = ptr_type Derived [template = constants.%.9] -// CHECK:STDOUT: %p.loc21_9.1: Derived* = param p -// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc21_9.1 +// CHECK:STDOUT: %.loc25: type = ptr_type Derived [template = constants.%.9] +// CHECK:STDOUT: %p.loc25_9.1: Derived* = param p +// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc25_9.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] -// CHECK:STDOUT: %.loc10_23: type = ptr_type Base [template = constants.%.3] -// CHECK:STDOUT: %self.loc10_13.1: Base* = param self -// CHECK:STDOUT: %self.loc10_13.3: Base* = bind_name self, %self.loc10_13.1 -// CHECK:STDOUT: %.loc10_8: Base* = addr_pattern %self.loc10_13.3 +// CHECK:STDOUT: %.loc14_23: type = ptr_type Base [template = constants.%.3] +// CHECK:STDOUT: %self.loc14_13.1: Base* = param self +// CHECK:STDOUT: %self.loc14_13.3: Base* = bind_name self, %self.loc14_13.1 +// CHECK:STDOUT: %.loc14_8: Base* = addr_pattern %self.loc14_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc18: = base_decl Base, element0 [template] +// CHECK:STDOUT: %.loc22: = base_decl Base, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc18 +// CHECK:STDOUT: .base = %.loc22 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -106,26 +110,26 @@ fn Call(p: Derived*) { // CHECK:STDOUT: fn @F[addr %self: Base*]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self -// CHECK:STDOUT: %.loc14_4: ref Base = deref %self.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] -// CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 -// CHECK:STDOUT: %.loc14_15: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc14_10, %.loc14_15 +// CHECK:STDOUT: %.loc18_4: ref Base = deref %self.ref +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc12_8 [template = @Base.%.loc12_8] +// CHECK:STDOUT: %.loc18_10: ref i32 = class_element_access %.loc18_4, element0 +// CHECK:STDOUT: %.loc18_15: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: assign %.loc18_10, %.loc18_15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%p: Derived*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p -// CHECK:STDOUT: %.loc22_4.1: ref Derived = deref %p.ref +// CHECK:STDOUT: %.loc26_4.1: ref Derived = deref %p.ref // CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc22_7: = bound_method %.loc22_4.1, %F.ref -// CHECK:STDOUT: %.loc22_4.2: Derived* = addr_of %.loc22_4.1 -// CHECK:STDOUT: %.loc22_9.1: ref Derived = deref %.loc22_4.2 -// CHECK:STDOUT: %.loc22_9.2: ref Base = class_element_access %.loc22_9.1, element0 -// CHECK:STDOUT: %.loc22_9.3: Base* = addr_of %.loc22_9.2 -// CHECK:STDOUT: %.loc22_9.4: Base* = converted %.loc22_4.2, %.loc22_9.3 -// CHECK:STDOUT: %F.call: init () = call %.loc22_7(%.loc22_9.4) +// CHECK:STDOUT: %.loc26_7: = bound_method %.loc26_4.1, %F.ref +// CHECK:STDOUT: %.loc26_4.2: Derived* = addr_of %.loc26_4.1 +// CHECK:STDOUT: %.loc26_9.1: ref Derived = deref %.loc26_4.2 +// CHECK:STDOUT: %.loc26_9.2: ref Base = class_element_access %.loc26_9.1, element0 +// CHECK:STDOUT: %.loc26_9.3: Base* = addr_of %.loc26_9.2 +// CHECK:STDOUT: %.loc26_9.4: Base* = converted %.loc26_4.2, %.loc26_9.3 +// CHECK:STDOUT: %F.call: init () = call %.loc26_7(%.loc26_9.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_qualified.carbon b/toolchain/check/testdata/class/base_method_qualified.carbon index 995e224481cf..57bb545e3702 100644 --- a/toolchain/check/testdata/class/base_method_qualified.carbon +++ b/toolchain/check/testdata/class/base_method_qualified.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_method_qualified.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method_qualified.carbon class Derived; @@ -70,7 +74,7 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Derived = %Derived.decl.loc7 +// CHECK:STDOUT: .Derived = %Derived.decl.loc11 // CHECK:STDOUT: .Base = %Base.decl // CHECK:STDOUT: .Call = %Call.decl // CHECK:STDOUT: .CallIndirect = %CallIndirect.decl @@ -78,72 +82,72 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: .PassDerivedToBaseIndirect = %PassDerivedToBaseIndirect.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Derived.decl.loc7: type = class_decl @Derived [template = constants.%Derived] {} +// CHECK:STDOUT: %Derived.decl.loc11: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %Base.decl: type = class_decl @Base [template = constants.%Base] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %Derived.decl.loc14: type = class_decl @Derived [template = constants.%Derived] {} +// CHECK:STDOUT: %Derived.decl.loc18: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.6] { -// CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %a.loc21_9.1: Derived = param a -// CHECK:STDOUT: @Call.%a: Derived = bind_name a, %a.loc21_9.1 -// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc21_24.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] -// CHECK:STDOUT: %.loc21_24.2: type = converted %int.make_type_32.loc21, %.loc21_24.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl.loc11 [template = constants.%Derived] +// CHECK:STDOUT: %a.loc25_9.1: Derived = param a +// CHECK:STDOUT: @Call.%a: Derived = bind_name a, %a.loc25_9.1 +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_24.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_24.2: type = converted %int.make_type_32.loc25, %.loc25_24.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallIndirect.decl: CallIndirect = fn_decl @CallIndirect [template = constants.%struct.7] { -// CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %.loc25_27: type = ptr_type Derived [template = constants.%.8] -// CHECK:STDOUT: %p.loc25_17.1: Derived* = param p -// CHECK:STDOUT: @CallIndirect.%p: Derived* = bind_name p, %p.loc25_17.1 -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_33.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_33.2: type = converted %int.make_type_32.loc25, %.loc25_33.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl.loc11 [template = constants.%Derived] +// CHECK:STDOUT: %.loc29_27: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %p.loc29_17.1: Derived* = param p +// CHECK:STDOUT: @CallIndirect.%p: Derived* = bind_name p, %p.loc29_17.1 +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_33.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_33.2: type = converted %int.make_type_32.loc29, %.loc29_33.1 [template = i32] // CHECK:STDOUT: @CallIndirect.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %PassDerivedToBase.decl: PassDerivedToBase = fn_decl @PassDerivedToBase [template = constants.%struct.8] { -// CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %a.loc29_22.1: Derived = param a -// CHECK:STDOUT: @PassDerivedToBase.%a: Derived = bind_name a, %a.loc29_22.1 -// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc29_37.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] -// CHECK:STDOUT: %.loc29_37.2: type = converted %int.make_type_32.loc29, %.loc29_37.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc33: type = name_ref Derived, %Derived.decl.loc11 [template = constants.%Derived] +// CHECK:STDOUT: %a.loc33_22.1: Derived = param a +// CHECK:STDOUT: @PassDerivedToBase.%a: Derived = bind_name a, %a.loc33_22.1 +// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc33_37.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] +// CHECK:STDOUT: %.loc33_37.2: type = converted %int.make_type_32.loc33, %.loc33_37.1 [template = i32] // CHECK:STDOUT: @PassDerivedToBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %PassDerivedToBaseIndirect.decl: PassDerivedToBaseIndirect = fn_decl @PassDerivedToBaseIndirect [template = constants.%struct.9] { -// CHECK:STDOUT: %Derived.ref.loc33: type = name_ref Derived, %Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %.loc33_40: type = ptr_type Derived [template = constants.%.8] -// CHECK:STDOUT: %p.loc33_30.1: Derived* = param p -// CHECK:STDOUT: @PassDerivedToBaseIndirect.%p: Derived* = bind_name p, %p.loc33_30.1 -// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc33_46.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] -// CHECK:STDOUT: %.loc33_46.2: type = converted %int.make_type_32.loc33, %.loc33_46.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc37: type = name_ref Derived, %Derived.decl.loc11 [template = constants.%Derived] +// CHECK:STDOUT: %.loc37_40: type = ptr_type Derived [template = constants.%.8] +// CHECK:STDOUT: %p.loc37_30.1: Derived* = param p +// CHECK:STDOUT: @PassDerivedToBaseIndirect.%p: Derived* = bind_name p, %p.loc37_30.1 +// CHECK:STDOUT: %int.make_type_32.loc37: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc37_46.1: type = value_of_initializer %int.make_type_32.loc37 [template = i32] +// CHECK:STDOUT: %.loc37_46.2: type = converted %int.make_type_32.loc37, %.loc37_46.1 [template = i32] // CHECK:STDOUT: @PassDerivedToBaseIndirect.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc15: = base_decl Base, element0 [template] +// CHECK:STDOUT: %.loc19: = base_decl Base, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { -// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Derived [template = constants.%Derived] -// CHECK:STDOUT: %self.loc17_8.1: Derived = param self -// CHECK:STDOUT: %self.loc17_8.2: Derived = bind_name self, %self.loc17_8.1 +// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Derived [template = constants.%Derived] +// CHECK:STDOUT: %self.loc21_8.1: Derived = param self +// CHECK:STDOUT: %self.loc21_8.2: Derived = bind_name self, %self.loc21_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.5] { -// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Derived [template = constants.%Derived] -// CHECK:STDOUT: %self.loc18_8.1: Derived = param self -// CHECK:STDOUT: %self.loc18_8.2: Derived = bind_name self, %self.loc18_8.1 +// CHECK:STDOUT: %Self.ref.loc22: type = name_ref Self, constants.%Derived [template = constants.%Derived] +// CHECK:STDOUT: %self.loc22_8.1: Derived = param self +// CHECK:STDOUT: %self.loc22_8.2: Derived = bind_name self, %self.loc22_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc15 +// CHECK:STDOUT: .base = %.loc19 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: extend name_scope2 @@ -152,21 +156,21 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Base [template = constants.%Base] -// CHECK:STDOUT: %self.loc10_8.1: Base = param self -// CHECK:STDOUT: %self.loc10_8.2: Base = bind_name self, %self.loc10_8.1 -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32.loc10, %.loc10_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc10: ref i32 = var +// CHECK:STDOUT: %self.loc14_8.1: Base = param self +// CHECK:STDOUT: %self.loc14_8.2: Base = bind_name self, %self.loc14_8.1 +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_25.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_25.2: type = converted %int.make_type_32.loc14, %.loc14_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc14: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.3] { -// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc7 [template = constants.%Derived] -// CHECK:STDOUT: %self.loc11_8.1: Derived = param self -// CHECK:STDOUT: %self.loc11_8.2: Derived = bind_name self, %self.loc11_8.1 -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_28.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_28.2: type = converted %int.make_type_32.loc11, %.loc11_28.1 [template = i32] -// CHECK:STDOUT: %return.var.loc11: ref i32 = var +// CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl.loc11 [template = constants.%Derived] +// CHECK:STDOUT: %self.loc15_8.1: Derived = param self +// CHECK:STDOUT: %self.loc15_8.2: Derived = bind_name self, %self.loc15_8.1 +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_28.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_28.2: type = converted %int.make_type_32.loc15, %.loc15_28.1 [template = i32] +// CHECK:STDOUT: %return.var.loc15: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -177,27 +181,27 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[@Base.%self.loc10_8.2: Base]() -> i32; +// CHECK:STDOUT: fn @F.1[@Base.%self.loc14_8.2: Base]() -> i32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.1[@Base.%self.loc11_8.2: Derived]() -> i32; +// CHECK:STDOUT: fn @G.1[@Base.%self.loc15_8.2: Derived]() -> i32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@Derived.%self.loc17_8.2: Derived](); +// CHECK:STDOUT: fn @F.2[@Derived.%self.loc21_8.2: Derived](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2[@Derived.%self.loc18_8.2: Derived](); +// CHECK:STDOUT: fn @G.2[@Derived.%self.loc22_8.2: Derived](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%a: Derived) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc22_11: = bound_method %a.ref, %F.ref -// CHECK:STDOUT: %.loc22_20.1: ref Base = class_element_access %a.ref, element0 -// CHECK:STDOUT: %.loc22_20.2: ref Base = converted %a.ref, %.loc22_20.1 -// CHECK:STDOUT: %.loc22_20.3: Base = bind_value %.loc22_20.2 -// CHECK:STDOUT: %F.call: init i32 = call %.loc22_11(%.loc22_20.3) -// CHECK:STDOUT: %.loc22_22.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc22_22.2: i32 = converted %F.call, %.loc22_22.1 -// CHECK:STDOUT: return %.loc22_22.2 +// CHECK:STDOUT: %.loc26_11: = bound_method %a.ref, %F.ref +// CHECK:STDOUT: %.loc26_20.1: ref Base = class_element_access %a.ref, element0 +// CHECK:STDOUT: %.loc26_20.2: ref Base = converted %a.ref, %.loc26_20.1 +// CHECK:STDOUT: %.loc26_20.3: Base = bind_value %.loc26_20.2 +// CHECK:STDOUT: %F.call: init i32 = call %.loc26_11(%.loc26_20.3) +// CHECK:STDOUT: %.loc26_22.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc26_22.2: i32 = converted %F.call, %.loc26_22.1 +// CHECK:STDOUT: return %.loc26_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallIndirect(%p: Derived*) -> i32 { @@ -205,15 +209,15 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %F.ref: F = name_ref F, @Base.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc26_11.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %.loc26_11.2: = bound_method %.loc26_11.1, %F.ref -// CHECK:STDOUT: %.loc26_21.1: ref Base = class_element_access %.loc26_11.1, element0 -// CHECK:STDOUT: %.loc26_21.2: ref Base = converted %.loc26_11.1, %.loc26_21.1 -// CHECK:STDOUT: %.loc26_21.3: Base = bind_value %.loc26_21.2 -// CHECK:STDOUT: %F.call: init i32 = call %.loc26_11.2(%.loc26_21.3) -// CHECK:STDOUT: %.loc26_23.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc26_23.2: i32 = converted %F.call, %.loc26_23.1 -// CHECK:STDOUT: return %.loc26_23.2 +// CHECK:STDOUT: %.loc30_11.1: ref Derived = deref %p.ref +// CHECK:STDOUT: %.loc30_11.2: = bound_method %.loc30_11.1, %F.ref +// CHECK:STDOUT: %.loc30_21.1: ref Base = class_element_access %.loc30_11.1, element0 +// CHECK:STDOUT: %.loc30_21.2: ref Base = converted %.loc30_11.1, %.loc30_21.1 +// CHECK:STDOUT: %.loc30_21.3: Base = bind_value %.loc30_21.2 +// CHECK:STDOUT: %F.call: init i32 = call %.loc30_11.2(%.loc30_21.3) +// CHECK:STDOUT: %.loc30_23.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc30_23.2: i32 = converted %F.call, %.loc30_23.1 +// CHECK:STDOUT: return %.loc30_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @PassDerivedToBase(%a: Derived) -> i32 { @@ -221,11 +225,11 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: %a.ref: Derived = name_ref a, %a // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc30_11: = bound_method %a.ref, %G.ref -// CHECK:STDOUT: %G.call: init i32 = call %.loc30_11(%a.ref) -// CHECK:STDOUT: %.loc30_22.1: i32 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc30_22.2: i32 = converted %G.call, %.loc30_22.1 -// CHECK:STDOUT: return %.loc30_22.2 +// CHECK:STDOUT: %.loc34_11: = bound_method %a.ref, %G.ref +// CHECK:STDOUT: %G.call: init i32 = call %.loc34_11(%a.ref) +// CHECK:STDOUT: %.loc34_22.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc34_22.2: i32 = converted %G.call, %.loc34_22.1 +// CHECK:STDOUT: return %.loc34_22.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @PassDerivedToBaseIndirect(%p: Derived*) -> i32 { @@ -233,12 +237,12 @@ fn PassDerivedToBaseIndirect(p: Derived*) -> i32 { // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] // CHECK:STDOUT: %G.ref: G = name_ref G, @Base.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc34_11.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %.loc34_11.2: = bound_method %.loc34_11.1, %G.ref -// CHECK:STDOUT: %.loc34_11.3: Derived = bind_value %.loc34_11.1 -// CHECK:STDOUT: %G.call: init i32 = call %.loc34_11.2(%.loc34_11.3) -// CHECK:STDOUT: %.loc34_23.1: i32 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc34_23.2: i32 = converted %G.call, %.loc34_23.1 -// CHECK:STDOUT: return %.loc34_23.2 +// CHECK:STDOUT: %.loc38_11.1: ref Derived = deref %p.ref +// CHECK:STDOUT: %.loc38_11.2: = bound_method %.loc38_11.1, %G.ref +// CHECK:STDOUT: %.loc38_11.3: Derived = bind_value %.loc38_11.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc38_11.2(%.loc38_11.3) +// CHECK:STDOUT: %.loc38_23.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc38_23.2: i32 = converted %G.call, %.loc38_23.1 +// CHECK:STDOUT: return %.loc38_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/base_method_shadow.carbon b/toolchain/check/testdata/class/base_method_shadow.carbon index 1edac7300a47..90c29a03dcb4 100644 --- a/toolchain/check/testdata/class/base_method_shadow.carbon +++ b/toolchain/check/testdata/class/base_method_shadow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/base_method_shadow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/base_method_shadow.carbon base class A { fn F[addr self: Self*](); @@ -78,31 +82,31 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc25_13: type = ptr_type A [template = constants.%.1] -// CHECK:STDOUT: %a.loc25_9.1: A* = param a -// CHECK:STDOUT: @Call.%a: A* = bind_name a, %a.loc25_9.1 +// CHECK:STDOUT: %.loc29_13: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %a.loc29_9.1: A* = param a +// CHECK:STDOUT: @Call.%a: A* = bind_name a, %a.loc29_9.1 // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc25_20: type = ptr_type B [template = constants.%.6] -// CHECK:STDOUT: %b.loc25_16.1: B* = param b -// CHECK:STDOUT: @Call.%b: B* = bind_name b, %b.loc25_16.1 +// CHECK:STDOUT: %.loc29_20: type = ptr_type B [template = constants.%.6] +// CHECK:STDOUT: %b.loc29_16.1: B* = param b +// CHECK:STDOUT: @Call.%b: B* = bind_name b, %b.loc29_16.1 // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc25_27: type = ptr_type C [template = constants.%.11] -// CHECK:STDOUT: %c.loc25_23.1: C* = param c -// CHECK:STDOUT: @Call.%c: C* = bind_name c, %c.loc25_23.1 +// CHECK:STDOUT: %.loc29_27: type = ptr_type C [template = constants.%.11] +// CHECK:STDOUT: %c.loc29_23.1: C* = param c +// CHECK:STDOUT: @Call.%c: C* = bind_name c, %c.loc29_23.1 // CHECK:STDOUT: %D.ref: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %.loc25_34: type = ptr_type D [template = constants.%.14] -// CHECK:STDOUT: %d.loc25_30.1: D* = param d -// CHECK:STDOUT: @Call.%d: D* = bind_name d, %d.loc25_30.1 +// CHECK:STDOUT: %.loc29_34: type = ptr_type D [template = constants.%.14] +// CHECK:STDOUT: %d.loc29_30.1: D* = param d +// CHECK:STDOUT: @Call.%d: D* = bind_name d, %d.loc29_30.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%A [template = constants.%A] -// CHECK:STDOUT: %.loc8_23: type = ptr_type A [template = constants.%.1] -// CHECK:STDOUT: %self.loc8_13.1: A* = param self -// CHECK:STDOUT: %self.loc8_13.3: A* = bind_name self, %self.loc8_13.1 -// CHECK:STDOUT: %.loc8_8: A* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: %.loc12_23: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %self.loc12_13.1: A* = param self +// CHECK:STDOUT: %self.loc12_13.3: A* = bind_name self, %self.loc12_13.1 +// CHECK:STDOUT: %.loc12_8: A* = addr_pattern %self.loc12_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -112,86 +116,86 @@ fn Call(a: A*, b: B*, c: C*, d: D*) { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl A, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%B [template = constants.%B] -// CHECK:STDOUT: %.loc13_23: type = ptr_type B [template = constants.%.6] -// CHECK:STDOUT: %self.loc13_13.1: B* = param self -// CHECK:STDOUT: %self.loc13_13.3: B* = bind_name self, %self.loc13_13.1 -// CHECK:STDOUT: %.loc13_8: B* = addr_pattern %self.loc13_13.3 +// CHECK:STDOUT: %.loc17_23: type = ptr_type B [template = constants.%.6] +// CHECK:STDOUT: %self.loc17_13.1: B* = param self +// CHECK:STDOUT: %self.loc17_13.3: B* = bind_name self, %self.loc17_13.1 +// CHECK:STDOUT: %.loc17_8: B* = addr_pattern %self.loc17_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .base = %.loc12 +// CHECK:STDOUT: .base = %.loc16 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc21: = base_decl B, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] -// CHECK:STDOUT: %.loc18_23: type = ptr_type C [template = constants.%.11] -// CHECK:STDOUT: %self.loc18_13.1: C* = param self -// CHECK:STDOUT: %self.loc18_13.3: C* = bind_name self, %self.loc18_13.1 -// CHECK:STDOUT: %.loc18_8: C* = addr_pattern %self.loc18_13.3 +// CHECK:STDOUT: %.loc22_23: type = ptr_type C [template = constants.%.11] +// CHECK:STDOUT: %self.loc22_13.1: C* = param self +// CHECK:STDOUT: %self.loc22_13.3: C* = bind_name self, %self.loc22_13.1 +// CHECK:STDOUT: %.loc22_8: C* = addr_pattern %self.loc22_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .base = %.loc17 +// CHECK:STDOUT: .base = %.loc21 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc22: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc26: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .base = %.loc22 +// CHECK:STDOUT: .base = %.loc26 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr @A.%self.loc8_13.3: A*](); +// CHECK:STDOUT: fn @F.1[addr @A.%self.loc12_13.3: A*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[addr @B.%self.loc13_13.3: B*](); +// CHECK:STDOUT: fn @F.2[addr @B.%self.loc17_13.3: B*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.3[addr @C.%self.loc18_13.3: C*](); +// CHECK:STDOUT: fn @F.3[addr @C.%self.loc22_13.3: C*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%a: A*, %b: B*, %c: C*, %d: D*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: A* = name_ref a, %a -// CHECK:STDOUT: %.loc26_4.1: ref A = deref %a.ref -// CHECK:STDOUT: %F.ref.loc26: F = name_ref F, @A.%F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc26_7: = bound_method %.loc26_4.1, %F.ref.loc26 -// CHECK:STDOUT: %.loc26_4.2: A* = addr_of %.loc26_4.1 -// CHECK:STDOUT: %F.call.loc26: init () = call %.loc26_7(%.loc26_4.2) +// CHECK:STDOUT: %.loc30_4.1: ref A = deref %a.ref +// CHECK:STDOUT: %F.ref.loc30: F = name_ref F, @A.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc30_7: = bound_method %.loc30_4.1, %F.ref.loc30 +// CHECK:STDOUT: %.loc30_4.2: A* = addr_of %.loc30_4.1 +// CHECK:STDOUT: %F.call.loc30: init () = call %.loc30_7(%.loc30_4.2) // CHECK:STDOUT: %b.ref: B* = name_ref b, %b -// CHECK:STDOUT: %.loc27_4.1: ref B = deref %b.ref -// CHECK:STDOUT: %F.ref.loc27: F = name_ref F, @B.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc27_7: = bound_method %.loc27_4.1, %F.ref.loc27 -// CHECK:STDOUT: %.loc27_4.2: B* = addr_of %.loc27_4.1 -// CHECK:STDOUT: %F.call.loc27: init () = call %.loc27_7(%.loc27_4.2) +// CHECK:STDOUT: %.loc31_4.1: ref B = deref %b.ref +// CHECK:STDOUT: %F.ref.loc31: F = name_ref F, @B.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc31_7: = bound_method %.loc31_4.1, %F.ref.loc31 +// CHECK:STDOUT: %.loc31_4.2: B* = addr_of %.loc31_4.1 +// CHECK:STDOUT: %F.call.loc31: init () = call %.loc31_7(%.loc31_4.2) // CHECK:STDOUT: %c.ref: C* = name_ref c, %c -// CHECK:STDOUT: %.loc28_4.1: ref C = deref %c.ref -// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, @C.%F.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc28_7: = bound_method %.loc28_4.1, %F.ref.loc28 -// CHECK:STDOUT: %.loc28_4.2: C* = addr_of %.loc28_4.1 -// CHECK:STDOUT: %F.call.loc28: init () = call %.loc28_7(%.loc28_4.2) +// CHECK:STDOUT: %.loc32_4.1: ref C = deref %c.ref +// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, @C.%F.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc32_7: = bound_method %.loc32_4.1, %F.ref.loc32 +// CHECK:STDOUT: %.loc32_4.2: C* = addr_of %.loc32_4.1 +// CHECK:STDOUT: %F.call.loc32: init () = call %.loc32_7(%.loc32_4.2) // CHECK:STDOUT: %d.ref: D* = name_ref d, %d -// CHECK:STDOUT: %.loc29_4.1: ref D = deref %d.ref -// CHECK:STDOUT: %F.ref.loc29: F = name_ref F, @B.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc29_7: = bound_method %.loc29_4.1, %F.ref.loc29 -// CHECK:STDOUT: %.loc29_4.2: D* = addr_of %.loc29_4.1 -// CHECK:STDOUT: %.loc29_9.1: ref D = deref %.loc29_4.2 -// CHECK:STDOUT: %.loc29_9.2: ref B = class_element_access %.loc29_9.1, element0 -// CHECK:STDOUT: %.loc29_9.3: B* = addr_of %.loc29_9.2 -// CHECK:STDOUT: %.loc29_9.4: B* = converted %.loc29_4.2, %.loc29_9.3 -// CHECK:STDOUT: %F.call.loc29: init () = call %.loc29_7(%.loc29_9.4) +// CHECK:STDOUT: %.loc33_4.1: ref D = deref %d.ref +// CHECK:STDOUT: %F.ref.loc33: F = name_ref F, @B.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc33_7: = bound_method %.loc33_4.1, %F.ref.loc33 +// CHECK:STDOUT: %.loc33_4.2: D* = addr_of %.loc33_4.1 +// CHECK:STDOUT: %.loc33_9.1: ref D = deref %.loc33_4.2 +// CHECK:STDOUT: %.loc33_9.2: ref B = class_element_access %.loc33_9.1, element0 +// CHECK:STDOUT: %.loc33_9.3: B* = addr_of %.loc33_9.2 +// CHECK:STDOUT: %.loc33_9.4: B* = converted %.loc33_4.2, %.loc33_9.3 +// CHECK:STDOUT: %F.call.loc33: init () = call %.loc33_7(%.loc33_9.4) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/basic.carbon b/toolchain/check/testdata/class/basic.carbon index 28c47970731c..24bb5f88be15 100644 --- a/toolchain/check/testdata/class/basic.carbon +++ b/toolchain/check/testdata/class/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/basic.carbon class Class { fn F(n: i32) -> i32 { @@ -56,38 +60,27 @@ fn Run() -> i32 { // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc17_15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_15.1: type = value_of_initializer %int.make_type_32.loc17_15 [template = i32] -// CHECK:STDOUT: %.loc17_15.2: type = converted %int.make_type_32.loc17_15, %.loc17_15.1 [template = i32] -// CHECK:STDOUT: %n.loc17_12.1: i32 = param n -// CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc17_12.1 -// CHECK:STDOUT: %int.make_type_32.loc17_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_23.1: type = value_of_initializer %int.make_type_32.loc17_23 [template = i32] -// CHECK:STDOUT: %.loc17_23.2: type = converted %int.make_type_32.loc17_23, %.loc17_23.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_15.1: type = value_of_initializer %int.make_type_32.loc21_15 [template = i32] +// CHECK:STDOUT: %.loc21_15.2: type = converted %int.make_type_32.loc21_15, %.loc21_15.1 [template = i32] +// CHECK:STDOUT: %n.loc21_12.1: i32 = param n +// CHECK:STDOUT: @G.%n: i32 = bind_name n, %n.loc21_12.1 +// CHECK:STDOUT: %int.make_type_32.loc21_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %int.make_type_32.loc21_23 [template = i32] +// CHECK:STDOUT: %.loc21_23.2: type = converted %int.make_type_32.loc21_23, %.loc21_23.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc21_13.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] -// CHECK:STDOUT: %.loc21_13.2: type = converted %int.make_type_32.loc21, %.loc21_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_13.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_13.2: type = converted %int.make_type_32.loc25, %.loc25_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8_11 [template = i32] -// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8_11, %.loc8_11.1 [template = i32] -// CHECK:STDOUT: %n.loc8_8.1: i32 = param n -// CHECK:STDOUT: %n.loc8_8.2: i32 = bind_name n, %n.loc8_8.1 -// CHECK:STDOUT: %int.make_type_32.loc8_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32.loc8_19 [template = i32] -// CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32.loc8_19, %.loc8_19.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var -// CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32.loc12_11: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12_11 [template = i32] // CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12_11, %.loc12_11.1 [template = i32] @@ -98,23 +91,34 @@ fn Run() -> i32 { // CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32.loc12_19, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] -// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] -// CHECK:STDOUT: %.loc14_8: = field_decl k, element0 [template] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc16_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32.loc16_11 [template = i32] +// CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32.loc16_11, %.loc16_11.1 [template = i32] +// CHECK:STDOUT: %n.loc16_8.1: i32 = param n +// CHECK:STDOUT: %n.loc16_8.2: i32 = bind_name n, %n.loc16_8.1 +// CHECK:STDOUT: %int.make_type_32.loc16_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16_19 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16_19, %.loc16_19.1 [template = i32] +// CHECK:STDOUT: %return.var.loc16: ref i32 = var +// CHECK:STDOUT: } +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_10.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_10.2: type = converted %int.make_type_32.loc18, %.loc18_10.1 [template = i32] +// CHECK:STDOUT: %.loc18_8: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .k = %.loc14_8 +// CHECK:STDOUT: .k = %.loc18_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(@Class.%n.loc8_8.2: i32) -> i32 { +// CHECK:STDOUT: fn @F(@Class.%n.loc12_8.2: i32) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: i32 = name_ref n, @Class.%n.loc8_8.2 +// CHECK:STDOUT: %n.ref: i32 = name_ref n, @Class.%n.loc12_8.2 // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: @@ -128,10 +132,10 @@ fn Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc22_18: i32 = int_literal 4 [template = constants.%.4] -// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc22_18) -// CHECK:STDOUT: %.loc22_20.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc22_20.2: i32 = converted %F.call, %.loc22_20.1 -// CHECK:STDOUT: return %.loc22_20.2 +// CHECK:STDOUT: %.loc26_18: i32 = int_literal 4 [template = constants.%.4] +// CHECK:STDOUT: %F.call: init i32 = call %F.ref(%.loc26_18) +// CHECK:STDOUT: %.loc26_20.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc26_20.2: i32 = converted %F.call, %.loc26_20.1 +// CHECK:STDOUT: return %.loc26_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/complete_in_member_fn.carbon b/toolchain/check/testdata/class/complete_in_member_fn.carbon index 9773404943ed..080e164d2643 100644 --- a/toolchain/check/testdata/class/complete_in_member_fn.carbon +++ b/toolchain/check/testdata/class/complete_in_member_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/complete_in_member_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/complete_in_member_fn.carbon class C { fn F(c: C) -> i32 { return c.a; } @@ -38,32 +42,32 @@ class C { // CHECK:STDOUT: class @C { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %c.loc8_8.1: C = param c -// CHECK:STDOUT: %c.loc8_8.2: C = bind_name c, %c.loc8_8.1 -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_17.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_17.2: type = converted %int.make_type_32.loc8, %.loc8_17.1 [template = i32] +// CHECK:STDOUT: %c.loc12_8.1: C = param c +// CHECK:STDOUT: %c.loc12_8.2: C = bind_name c, %c.loc12_8.1 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_17.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_17.2: type = converted %int.make_type_32.loc12, %.loc12_17.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] -// CHECK:STDOUT: %.loc10_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .F = %F.decl -// CHECK:STDOUT: .a = %.loc10_8 +// CHECK:STDOUT: .a = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(@C.%c.loc8_8.2: C) -> i32 { +// CHECK:STDOUT: fn @F(@C.%c.loc12_8.2: C) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref: C = name_ref c, @C.%c.loc8_8.2 -// CHECK:STDOUT: %a.ref: = name_ref a, @C.%.loc10_8 [template = @C.%.loc10_8] -// CHECK:STDOUT: %.loc8_31.1: ref i32 = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc8_31.2: i32 = bind_value %.loc8_31.1 -// CHECK:STDOUT: return %.loc8_31.2 +// CHECK:STDOUT: %c.ref: C = name_ref c, @C.%c.loc12_8.2 +// CHECK:STDOUT: %a.ref: = name_ref a, @C.%.loc14_8 [template = @C.%.loc14_8] +// CHECK:STDOUT: %.loc12_31.1: ref i32 = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc12_31.2: i32 = bind_value %.loc12_31.1 +// CHECK:STDOUT: return %.loc12_31.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/compound_field.carbon b/toolchain/check/testdata/class/compound_field.carbon index 07d980f815b4..fca15c548f5b 100644 --- a/toolchain/check/testdata/class/compound_field.carbon +++ b/toolchain/check/testdata/class/compound_field.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/compound_field.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/compound_field.carbon base class Base { var a: i32; @@ -82,88 +86,88 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessDerived.decl: AccessDerived = fn_decl @AccessDerived [template = constants.%struct.2] { -// CHECK:STDOUT: %Derived.ref.loc20: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.loc20_18.1: Derived = param d -// CHECK:STDOUT: @AccessDerived.%d: Derived = bind_name d, %d.loc20_18.1 -// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] -// CHECK:STDOUT: %.loc20_33.2: type = converted %int.make_type_32.loc20, %.loc20_33.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc24_18.1: Derived = param d +// CHECK:STDOUT: @AccessDerived.%d: Derived = bind_name d, %d.loc24_18.1 +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_33.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_33.2: type = converted %int.make_type_32.loc24, %.loc24_33.1 [template = i32] // CHECK:STDOUT: @AccessDerived.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessBase.decl: AccessBase = fn_decl @AccessBase [template = constants.%struct.3] { -// CHECK:STDOUT: %Derived.ref.loc24: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.loc24_15.1: Derived = param d -// CHECK:STDOUT: @AccessBase.%d: Derived = bind_name d, %d.loc24_15.1 -// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc24_30.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] -// CHECK:STDOUT: %.loc24_30.2: type = converted %int.make_type_32.loc24, %.loc24_30.1 [template = i32] +// CHECK:STDOUT: %Derived.ref.loc28: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc28_15.1: Derived = param d +// CHECK:STDOUT: @AccessBase.%d: Derived = bind_name d, %d.loc28_15.1 +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc28_30.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_30.2: type = converted %int.make_type_32.loc28, %.loc28_30.1 [template = i32] // CHECK:STDOUT: @AccessBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessDerivedIndirect.decl: AccessDerivedIndirect = fn_decl @AccessDerivedIndirect [template = constants.%struct.4] { -// CHECK:STDOUT: %Derived.ref.loc28: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc28_36: type = ptr_type Derived [template = constants.%.11] -// CHECK:STDOUT: %p.loc28_26.1: Derived* = param p -// CHECK:STDOUT: @AccessDerivedIndirect.%p: Derived* = bind_name p, %p.loc28_26.1 -// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc28_45.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] -// CHECK:STDOUT: %.loc28_45.2: type = converted %int.make_type_32.loc28, %.loc28_45.1 [template = i32] -// CHECK:STDOUT: %.loc28_45.3: type = ptr_type i32 [template = constants.%.12] +// CHECK:STDOUT: %Derived.ref.loc32: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %.loc32_36: type = ptr_type Derived [template = constants.%.11] +// CHECK:STDOUT: %p.loc32_26.1: Derived* = param p +// CHECK:STDOUT: @AccessDerivedIndirect.%p: Derived* = bind_name p, %p.loc32_26.1 +// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc32_45.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] +// CHECK:STDOUT: %.loc32_45.2: type = converted %int.make_type_32.loc32, %.loc32_45.1 [template = i32] +// CHECK:STDOUT: %.loc32_45.3: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessDerivedIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessBaseIndirect.decl: AccessBaseIndirect = fn_decl @AccessBaseIndirect [template = constants.%struct.5] { -// CHECK:STDOUT: %Derived.ref.loc32: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc32_33: type = ptr_type Derived [template = constants.%.11] -// CHECK:STDOUT: %p.loc32_23.1: Derived* = param p -// CHECK:STDOUT: @AccessBaseIndirect.%p: Derived* = bind_name p, %p.loc32_23.1 -// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc32_42.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] -// CHECK:STDOUT: %.loc32_42.2: type = converted %int.make_type_32.loc32, %.loc32_42.1 [template = i32] -// CHECK:STDOUT: %.loc32_42.3: type = ptr_type i32 [template = constants.%.12] +// CHECK:STDOUT: %Derived.ref.loc36: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %.loc36_33: type = ptr_type Derived [template = constants.%.11] +// CHECK:STDOUT: %p.loc36_23.1: Derived* = param p +// CHECK:STDOUT: @AccessBaseIndirect.%p: Derived* = bind_name p, %p.loc36_23.1 +// CHECK:STDOUT: %int.make_type_32.loc36: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc36_42.1: type = value_of_initializer %int.make_type_32.loc36 [template = i32] +// CHECK:STDOUT: %.loc36_42.2: type = converted %int.make_type_32.loc36, %.loc36_42.1 [template = i32] +// CHECK:STDOUT: %.loc36_42.3: type = ptr_type i32 [template = constants.%.12] // CHECK:STDOUT: @AccessBaseIndirect.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] -// CHECK:STDOUT: %.loc10_8: = field_decl c, element2 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl c, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 -// CHECK:STDOUT: .c = %.loc10_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 +// CHECK:STDOUT: .c = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc14: = base_decl Base, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32.loc16, %.loc16_10.1 [template = i32] -// CHECK:STDOUT: %.loc16_8: = field_decl d, element1 [template] -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32.loc17, %.loc17_10.1 [template = i32] -// CHECK:STDOUT: %.loc17_8: = field_decl e, element2 [template] +// CHECK:STDOUT: %.loc18: = base_decl Base, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_10.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_10.2: type = converted %int.make_type_32.loc20, %.loc20_10.1 [template = i32] +// CHECK:STDOUT: %.loc20_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_10.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_10.2: type = converted %int.make_type_32.loc21, %.loc21_10.1 [template = i32] +// CHECK:STDOUT: %.loc21_8: = field_decl e, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc14 -// CHECK:STDOUT: .d = %.loc16_8 -// CHECK:STDOUT: .e = %.loc17_8 +// CHECK:STDOUT: .base = %.loc18 +// CHECK:STDOUT: .d = %.loc20_8 +// CHECK:STDOUT: .e = %.loc21_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -171,47 +175,47 @@ fn AccessBaseIndirect(p: Derived*) -> i32* { // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessDerived(%d: Derived) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %d.ref.loc21_10: Derived = name_ref d, %d +// CHECK:STDOUT: %d.ref.loc25_10: Derived = name_ref d, %d // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.ref.loc21_20: = name_ref d, @Derived.%.loc16_8 [template = @Derived.%.loc16_8] -// CHECK:STDOUT: %.loc21_11.1: ref i32 = class_element_access %d.ref.loc21_10, element1 -// CHECK:STDOUT: %.loc21_11.2: i32 = bind_value %.loc21_11.1 -// CHECK:STDOUT: return %.loc21_11.2 +// CHECK:STDOUT: %d.ref.loc25_20: = name_ref d, @Derived.%.loc20_8 [template = @Derived.%.loc20_8] +// CHECK:STDOUT: %.loc25_11.1: ref i32 = class_element_access %d.ref.loc25_10, element1 +// CHECK:STDOUT: %.loc25_11.2: i32 = bind_value %.loc25_11.1 +// CHECK:STDOUT: return %.loc25_11.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessBase(%d: Derived) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %d.ref: Derived = name_ref d, %d // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9_8 [template = @Base.%.loc9_8] -// CHECK:STDOUT: %.loc25_11.1: ref Base = class_element_access %d.ref, element0 -// CHECK:STDOUT: %.loc25_11.2: ref Base = converted %d.ref, %.loc25_11.1 -// CHECK:STDOUT: %.loc25_11.3: ref i32 = class_element_access %.loc25_11.2, element1 -// CHECK:STDOUT: %.loc25_11.4: i32 = bind_value %.loc25_11.3 -// CHECK:STDOUT: return %.loc25_11.4 +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc13_8 [template = @Base.%.loc13_8] +// CHECK:STDOUT: %.loc29_11.1: ref Base = class_element_access %d.ref, element0 +// CHECK:STDOUT: %.loc29_11.2: ref Base = converted %d.ref, %.loc29_11.1 +// CHECK:STDOUT: %.loc29_11.3: ref i32 = class_element_access %.loc29_11.2, element1 +// CHECK:STDOUT: %.loc29_11.4: i32 = bind_value %.loc29_11.3 +// CHECK:STDOUT: return %.loc29_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessDerivedIndirect(%p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.ref: = name_ref d, @Derived.%.loc16_8 [template = @Derived.%.loc16_8] -// CHECK:STDOUT: %.loc29_12.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %.loc29_12.2: ref i32 = class_element_access %.loc29_12.1, element1 -// CHECK:STDOUT: %.loc29_10: i32* = addr_of %.loc29_12.2 -// CHECK:STDOUT: return %.loc29_10 +// CHECK:STDOUT: %d.ref: = name_ref d, @Derived.%.loc20_8 [template = @Derived.%.loc20_8] +// CHECK:STDOUT: %.loc33_12.1: ref Derived = deref %p.ref +// CHECK:STDOUT: %.loc33_12.2: ref i32 = class_element_access %.loc33_12.1, element1 +// CHECK:STDOUT: %.loc33_10: i32* = addr_of %.loc33_12.2 +// CHECK:STDOUT: return %.loc33_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessBaseIndirect(%p: Derived*) -> i32* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Derived* = name_ref p, %p // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc9_8 [template = @Base.%.loc9_8] -// CHECK:STDOUT: %.loc33_12.1: ref Derived = deref %p.ref -// CHECK:STDOUT: %.loc33_12.2: ref Base = class_element_access %.loc33_12.1, element0 -// CHECK:STDOUT: %.loc33_12.3: ref Base = converted %.loc33_12.1, %.loc33_12.2 -// CHECK:STDOUT: %.loc33_12.4: ref i32 = class_element_access %.loc33_12.3, element1 -// CHECK:STDOUT: %.loc33_10: i32* = addr_of %.loc33_12.4 -// CHECK:STDOUT: return %.loc33_10 +// CHECK:STDOUT: %b.ref: = name_ref b, @Base.%.loc13_8 [template = @Base.%.loc13_8] +// CHECK:STDOUT: %.loc37_12.1: ref Derived = deref %p.ref +// CHECK:STDOUT: %.loc37_12.2: ref Base = class_element_access %.loc37_12.1, element0 +// CHECK:STDOUT: %.loc37_12.3: ref Base = converted %.loc37_12.1, %.loc37_12.2 +// CHECK:STDOUT: %.loc37_12.4: ref i32 = class_element_access %.loc37_12.3, element1 +// CHECK:STDOUT: %.loc37_10: i32* = addr_of %.loc37_12.4 +// CHECK:STDOUT: return %.loc37_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/cross_package_import.carbon b/toolchain/check/testdata/class/cross_package_import.carbon index 7d41d44bfdd9..b4bb863197ca 100644 --- a/toolchain/check/testdata/class/cross_package_import.carbon +++ b/toolchain/check/testdata/class/cross_package_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/cross_package_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/cross_package_import.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/class/derived_to_base.carbon b/toolchain/check/testdata/class/derived_to_base.carbon index bfa6bafdfa52..906483830f19 100644 --- a/toolchain/check/testdata/class/derived_to_base.carbon +++ b/toolchain/check/testdata/class/derived_to_base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/derived_to_base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/derived_to_base.carbon base class A { var a: i32; @@ -104,44 +108,44 @@ fn ConvertInit() { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ConvertCToB.decl: ConvertCToB = fn_decl @ConvertCToB [template = constants.%struct.2] { -// CHECK:STDOUT: %C.ref.loc21: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc21_20: type = ptr_type C [template = constants.%.14] -// CHECK:STDOUT: %p.loc21_16.1: C* = param p -// CHECK:STDOUT: @ConvertCToB.%p: C* = bind_name p, %p.loc21_16.1 -// CHECK:STDOUT: %B.ref.loc21: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc21_27: type = ptr_type B [template = constants.%.15] +// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc25_20: type = ptr_type C [template = constants.%.14] +// CHECK:STDOUT: %p.loc25_16.1: C* = param p +// CHECK:STDOUT: @ConvertCToB.%p: C* = bind_name p, %p.loc25_16.1 +// CHECK:STDOUT: %B.ref.loc25: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %.loc25_27: type = ptr_type B [template = constants.%.15] // CHECK:STDOUT: @ConvertCToB.%return: ref B* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertBToA.decl: ConvertBToA = fn_decl @ConvertBToA [template = constants.%struct.3] { -// CHECK:STDOUT: %B.ref.loc22: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc22_20: type = ptr_type B [template = constants.%.15] -// CHECK:STDOUT: %p.loc22_16.1: B* = param p -// CHECK:STDOUT: @ConvertBToA.%p: B* = bind_name p, %p.loc22_16.1 -// CHECK:STDOUT: %A.ref.loc22: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc22_27: type = ptr_type A [template = constants.%.19] +// CHECK:STDOUT: %B.ref.loc26: type = name_ref B, %B.decl [template = constants.%B] +// CHECK:STDOUT: %.loc26_20: type = ptr_type B [template = constants.%.15] +// CHECK:STDOUT: %p.loc26_16.1: B* = param p +// CHECK:STDOUT: @ConvertBToA.%p: B* = bind_name p, %p.loc26_16.1 +// CHECK:STDOUT: %A.ref.loc26: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc26_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertBToA.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertCToA.decl: ConvertCToA = fn_decl @ConvertCToA [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc23_20: type = ptr_type C [template = constants.%.14] -// CHECK:STDOUT: %p.loc23_16.1: C* = param p -// CHECK:STDOUT: @ConvertCToA.%p: C* = bind_name p, %p.loc23_16.1 -// CHECK:STDOUT: %A.ref.loc23: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc23_27: type = ptr_type A [template = constants.%.19] +// CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc27_20: type = ptr_type C [template = constants.%.14] +// CHECK:STDOUT: %p.loc27_16.1: C* = param p +// CHECK:STDOUT: @ConvertCToA.%p: C* = bind_name p, %p.loc27_16.1 +// CHECK:STDOUT: %A.ref.loc27: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc27_27: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertCToA.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertValue.decl: ConvertValue = fn_decl @ConvertValue [template = constants.%struct.5] { -// CHECK:STDOUT: %C.ref.loc25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %c.loc25_17.1: C = param c -// CHECK:STDOUT: @ConvertValue.%c: C = bind_name c, %c.loc25_17.1 +// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %c.loc29_17.1: C = param c +// CHECK:STDOUT: @ConvertValue.%c: C = bind_name c, %c.loc29_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertRef.decl: ConvertRef = fn_decl @ConvertRef [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc29: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc29_19: type = ptr_type C [template = constants.%.14] -// CHECK:STDOUT: %c.loc29_15.1: C* = param c -// CHECK:STDOUT: @ConvertRef.%c: C* = bind_name c, %c.loc29_15.1 -// CHECK:STDOUT: %A.ref.loc29: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc29_26: type = ptr_type A [template = constants.%.19] +// CHECK:STDOUT: %C.ref.loc33: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc33_19: type = ptr_type C [template = constants.%.14] +// CHECK:STDOUT: %c.loc33_15.1: C* = param c +// CHECK:STDOUT: @ConvertRef.%c: C* = bind_name c, %c.loc33_15.1 +// CHECK:STDOUT: %A.ref.loc33: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %.loc33_26: type = ptr_type A [template = constants.%.19] // CHECK:STDOUT: @ConvertRef.%return: ref A* = var // CHECK:STDOUT: } // CHECK:STDOUT: %ConvertInit.decl: ConvertInit = fn_decl @ConvertInit [template = constants.%struct.7] {} @@ -149,42 +153,42 @@ fn ConvertInit() { // CHECK:STDOUT: // CHECK:STDOUT: class @A { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl A, element0 [template] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32, %.loc13_10.1 [template = i32] -// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .b = %.loc13_8 +// CHECK:STDOUT: .base = %.loc16 +// CHECK:STDOUT: .b = %.loc17_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc21: = base_decl B, element0 [template] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_10.2: type = converted %int.make_type_32, %.loc18_10.1 [template = i32] -// CHECK:STDOUT: %.loc18_8: = field_decl c, element1 [template] +// CHECK:STDOUT: %.loc22_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_10.2: type = converted %int.make_type_32, %.loc22_10.1 [template = i32] +// CHECK:STDOUT: %.loc22_8: = field_decl c, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .base = %.loc17 -// CHECK:STDOUT: .c = %.loc18_8 +// CHECK:STDOUT: .base = %.loc21 +// CHECK:STDOUT: .c = %.loc22_8 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -193,89 +197,89 @@ fn ConvertInit() { // CHECK:STDOUT: fn @ConvertCToB(%p: C*) -> B* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: C* = name_ref p, %p -// CHECK:STDOUT: %.loc21_39.1: ref C = deref %p.ref -// CHECK:STDOUT: %.loc21_39.2: ref B = class_element_access %.loc21_39.1, element0 -// CHECK:STDOUT: %.loc21_39.3: B* = addr_of %.loc21_39.2 -// CHECK:STDOUT: %.loc21_39.4: B* = converted %p.ref, %.loc21_39.3 -// CHECK:STDOUT: return %.loc21_39.4 +// CHECK:STDOUT: %.loc25_39.1: ref C = deref %p.ref +// CHECK:STDOUT: %.loc25_39.2: ref B = class_element_access %.loc25_39.1, element0 +// CHECK:STDOUT: %.loc25_39.3: B* = addr_of %.loc25_39.2 +// CHECK:STDOUT: %.loc25_39.4: B* = converted %p.ref, %.loc25_39.3 +// CHECK:STDOUT: return %.loc25_39.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertBToA(%p: B*) -> A* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: B* = name_ref p, %p -// CHECK:STDOUT: %.loc22_39.1: ref B = deref %p.ref -// CHECK:STDOUT: %.loc22_39.2: ref A = class_element_access %.loc22_39.1, element0 -// CHECK:STDOUT: %.loc22_39.3: A* = addr_of %.loc22_39.2 -// CHECK:STDOUT: %.loc22_39.4: A* = converted %p.ref, %.loc22_39.3 -// CHECK:STDOUT: return %.loc22_39.4 +// CHECK:STDOUT: %.loc26_39.1: ref B = deref %p.ref +// CHECK:STDOUT: %.loc26_39.2: ref A = class_element_access %.loc26_39.1, element0 +// CHECK:STDOUT: %.loc26_39.3: A* = addr_of %.loc26_39.2 +// CHECK:STDOUT: %.loc26_39.4: A* = converted %p.ref, %.loc26_39.3 +// CHECK:STDOUT: return %.loc26_39.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertCToA(%p: C*) -> A* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: C* = name_ref p, %p -// CHECK:STDOUT: %.loc23_39.1: ref C = deref %p.ref -// CHECK:STDOUT: %.loc23_39.2: ref B = class_element_access %.loc23_39.1, element0 -// CHECK:STDOUT: %.loc23_39.3: ref A = class_element_access %.loc23_39.2, element0 -// CHECK:STDOUT: %.loc23_39.4: A* = addr_of %.loc23_39.3 -// CHECK:STDOUT: %.loc23_39.5: A* = converted %p.ref, %.loc23_39.4 -// CHECK:STDOUT: return %.loc23_39.5 +// CHECK:STDOUT: %.loc27_39.1: ref C = deref %p.ref +// CHECK:STDOUT: %.loc27_39.2: ref B = class_element_access %.loc27_39.1, element0 +// CHECK:STDOUT: %.loc27_39.3: ref A = class_element_access %.loc27_39.2, element0 +// CHECK:STDOUT: %.loc27_39.4: A* = addr_of %.loc27_39.3 +// CHECK:STDOUT: %.loc27_39.5: A* = converted %p.ref, %.loc27_39.4 +// CHECK:STDOUT: return %.loc27_39.5 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertValue(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %.loc26_15.1: ref B = class_element_access %c.ref, element0 -// CHECK:STDOUT: %.loc26_15.2: ref A = class_element_access %.loc26_15.1, element0 -// CHECK:STDOUT: %.loc26_15.3: ref A = converted %c.ref, %.loc26_15.2 -// CHECK:STDOUT: %.loc26_15.4: A = bind_value %.loc26_15.3 -// CHECK:STDOUT: %a: A = bind_name a, %.loc26_15.4 +// CHECK:STDOUT: %.loc30_15.1: ref B = class_element_access %c.ref, element0 +// CHECK:STDOUT: %.loc30_15.2: ref A = class_element_access %.loc30_15.1, element0 +// CHECK:STDOUT: %.loc30_15.3: ref A = converted %c.ref, %.loc30_15.2 +// CHECK:STDOUT: %.loc30_15.4: A = bind_value %.loc30_15.3 +// CHECK:STDOUT: %a: A = bind_name a, %.loc30_15.4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertRef(%c: C*) -> A* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C* = name_ref c, %c -// CHECK:STDOUT: %.loc30_12: ref C = deref %c.ref +// CHECK:STDOUT: %.loc34_12: ref C = deref %c.ref // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc30_15.1: ref B = class_element_access %.loc30_12, element0 -// CHECK:STDOUT: %.loc30_15.2: ref A = class_element_access %.loc30_15.1, element0 -// CHECK:STDOUT: %.loc30_15.3: ref A = converted %.loc30_12, %.loc30_15.2 -// CHECK:STDOUT: %.loc30_10: A* = addr_of %.loc30_15.3 -// CHECK:STDOUT: return %.loc30_10 +// CHECK:STDOUT: %.loc34_15.1: ref B = class_element_access %.loc34_12, element0 +// CHECK:STDOUT: %.loc34_15.2: ref A = class_element_access %.loc34_15.1, element0 +// CHECK:STDOUT: %.loc34_15.3: ref A = converted %.loc34_12, %.loc34_15.2 +// CHECK:STDOUT: %.loc34_10: A* = addr_of %.loc34_15.3 +// CHECK:STDOUT: return %.loc34_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertInit() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc34_38: i32 = int_literal 1 [template = constants.%.20] -// CHECK:STDOUT: %.loc34_39.1: {.a: i32} = struct_literal (%.loc34_38) -// CHECK:STDOUT: %.loc34_47: i32 = int_literal 2 [template = constants.%.21] -// CHECK:STDOUT: %.loc34_48.1: {.base: {.a: i32}, .b: i32} = struct_literal (%.loc34_39.1, %.loc34_47) -// CHECK:STDOUT: %.loc34_56: i32 = int_literal 3 [template = constants.%.23] -// CHECK:STDOUT: %.loc34_57.1: {.base: {.base: {.a: i32}, .b: i32}, .c: i32} = struct_literal (%.loc34_48.1, %.loc34_56) +// CHECK:STDOUT: %.loc38_38: i32 = int_literal 1 [template = constants.%.20] +// CHECK:STDOUT: %.loc38_39.1: {.a: i32} = struct_literal (%.loc38_38) +// CHECK:STDOUT: %.loc38_47: i32 = int_literal 2 [template = constants.%.21] +// CHECK:STDOUT: %.loc38_48.1: {.base: {.a: i32}, .b: i32} = struct_literal (%.loc38_39.1, %.loc38_47) +// CHECK:STDOUT: %.loc38_56: i32 = int_literal 3 [template = constants.%.23] +// CHECK:STDOUT: %.loc38_57.1: {.base: {.base: {.a: i32}, .b: i32}, .c: i32} = struct_literal (%.loc38_48.1, %.loc38_56) // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc34_57.2: ref C = temporary_storage -// CHECK:STDOUT: %.loc34_57.3: ref B = class_element_access %.loc34_57.2, element0 -// CHECK:STDOUT: %.loc34_48.2: ref A = class_element_access %.loc34_57.3, element0 -// CHECK:STDOUT: %.loc34_39.2: ref i32 = class_element_access %.loc34_48.2, element0 -// CHECK:STDOUT: %.loc34_39.3: init i32 = initialize_from %.loc34_38 to %.loc34_39.2 [template = constants.%.20] -// CHECK:STDOUT: %.loc34_39.4: init A = class_init (%.loc34_39.3), %.loc34_48.2 [template = constants.%struct.8] -// CHECK:STDOUT: %.loc34_48.3: init A = converted %.loc34_39.1, %.loc34_39.4 [template = constants.%struct.8] -// CHECK:STDOUT: %.loc34_48.4: ref i32 = class_element_access %.loc34_57.3, element1 -// CHECK:STDOUT: %.loc34_48.5: init i32 = initialize_from %.loc34_47 to %.loc34_48.4 [template = constants.%.21] -// CHECK:STDOUT: %.loc34_48.6: init B = class_init (%.loc34_48.3, %.loc34_48.5), %.loc34_57.3 [template = constants.%struct.9] -// CHECK:STDOUT: %.loc34_57.4: init B = converted %.loc34_48.1, %.loc34_48.6 [template = constants.%struct.9] -// CHECK:STDOUT: %.loc34_57.5: ref i32 = class_element_access %.loc34_57.2, element1 -// CHECK:STDOUT: %.loc34_57.6: init i32 = initialize_from %.loc34_56 to %.loc34_57.5 [template = constants.%.23] -// CHECK:STDOUT: %.loc34_57.7: init C = class_init (%.loc34_57.4, %.loc34_57.6), %.loc34_57.2 [template = constants.%struct.10] -// CHECK:STDOUT: %.loc34_57.8: ref C = temporary %.loc34_57.2, %.loc34_57.7 -// CHECK:STDOUT: %.loc34_59: ref C = converted %.loc34_57.1, %.loc34_57.8 -// CHECK:STDOUT: %.loc34_63.1: ref B = class_element_access %.loc34_59, element0 -// CHECK:STDOUT: %.loc34_63.2: ref A = class_element_access %.loc34_63.1, element0 -// CHECK:STDOUT: %.loc34_63.3: ref A = converted %.loc34_59, %.loc34_63.2 -// CHECK:STDOUT: %.loc34_63.4: A = bind_value %.loc34_63.3 -// CHECK:STDOUT: %a: A = bind_name a, %.loc34_63.4 +// CHECK:STDOUT: %.loc38_57.2: ref C = temporary_storage +// CHECK:STDOUT: %.loc38_57.3: ref B = class_element_access %.loc38_57.2, element0 +// CHECK:STDOUT: %.loc38_48.2: ref A = class_element_access %.loc38_57.3, element0 +// CHECK:STDOUT: %.loc38_39.2: ref i32 = class_element_access %.loc38_48.2, element0 +// CHECK:STDOUT: %.loc38_39.3: init i32 = initialize_from %.loc38_38 to %.loc38_39.2 [template = constants.%.20] +// CHECK:STDOUT: %.loc38_39.4: init A = class_init (%.loc38_39.3), %.loc38_48.2 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc38_48.3: init A = converted %.loc38_39.1, %.loc38_39.4 [template = constants.%struct.8] +// CHECK:STDOUT: %.loc38_48.4: ref i32 = class_element_access %.loc38_57.3, element1 +// CHECK:STDOUT: %.loc38_48.5: init i32 = initialize_from %.loc38_47 to %.loc38_48.4 [template = constants.%.21] +// CHECK:STDOUT: %.loc38_48.6: init B = class_init (%.loc38_48.3, %.loc38_48.5), %.loc38_57.3 [template = constants.%struct.9] +// CHECK:STDOUT: %.loc38_57.4: init B = converted %.loc38_48.1, %.loc38_48.6 [template = constants.%struct.9] +// CHECK:STDOUT: %.loc38_57.5: ref i32 = class_element_access %.loc38_57.2, element1 +// CHECK:STDOUT: %.loc38_57.6: init i32 = initialize_from %.loc38_56 to %.loc38_57.5 [template = constants.%.23] +// CHECK:STDOUT: %.loc38_57.7: init C = class_init (%.loc38_57.4, %.loc38_57.6), %.loc38_57.2 [template = constants.%struct.10] +// CHECK:STDOUT: %.loc38_57.8: ref C = temporary %.loc38_57.2, %.loc38_57.7 +// CHECK:STDOUT: %.loc38_59: ref C = converted %.loc38_57.1, %.loc38_57.8 +// CHECK:STDOUT: %.loc38_63.1: ref B = class_element_access %.loc38_59, element0 +// CHECK:STDOUT: %.loc38_63.2: ref A = class_element_access %.loc38_63.1, element0 +// CHECK:STDOUT: %.loc38_63.3: ref A = converted %.loc38_59, %.loc38_63.2 +// CHECK:STDOUT: %.loc38_63.4: A = bind_value %.loc38_63.3 +// CHECK:STDOUT: %a: A = bind_name a, %.loc38_63.4 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/extend_adapt.carbon b/toolchain/check/testdata/class/extend_adapt.carbon index 502afb6af76e..50c2f612a1fd 100644 --- a/toolchain/check/testdata/class/extend_adapt.carbon +++ b/toolchain/check/testdata/class/extend_adapt.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/extend_adapt.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/extend_adapt.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/class/extern.carbon b/toolchain/check/testdata/class/extern.carbon index 2633f4c0c839..b1103cc7da03 100644 --- a/toolchain/check/testdata/class/extern.carbon +++ b/toolchain/check/testdata/class/extern.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/extern.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/extern.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/class/fail_abstract.carbon b/toolchain/check/testdata/class/fail_abstract.carbon index acaba022565c..46177f59efb1 100644 --- a/toolchain/check/testdata/class/fail_abstract.carbon +++ b/toolchain/check/testdata/class/fail_abstract.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_abstract.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_abstract.carbon abstract class Abstract { var a: i32; @@ -69,50 +73,50 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [template = constants.%Derived] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { -// CHECK:STDOUT: %Derived.ref.loc17: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %Derived.ref.loc21: type = name_ref Derived, %Derived.decl [template = constants.%Derived] // CHECK:STDOUT: @Make.%return: ref Derived = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Access.decl: Access = fn_decl @Access [template = constants.%struct.3] { -// CHECK:STDOUT: %Derived.ref.loc25: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %d.loc25_11.1: Derived = param d -// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc25_11.1 -// CHECK:STDOUT: %int.make_type_32.loc25_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc25_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_35.1: (type, type) = tuple_literal (%int.make_type_32.loc25_27, %int.make_type_32.loc25_32) -// CHECK:STDOUT: %.loc25_35.2: type = value_of_initializer %int.make_type_32.loc25_27 [template = i32] -// CHECK:STDOUT: %.loc25_35.3: type = converted %int.make_type_32.loc25_27, %.loc25_35.2 [template = i32] -// CHECK:STDOUT: %.loc25_35.4: type = value_of_initializer %int.make_type_32.loc25_32 [template = i32] -// CHECK:STDOUT: %.loc25_35.5: type = converted %int.make_type_32.loc25_32, %.loc25_35.4 [template = i32] -// CHECK:STDOUT: %.loc25_35.6: type = converted %.loc25_35.1, constants.%.15 [template = constants.%.15] +// CHECK:STDOUT: %Derived.ref.loc29: type = name_ref Derived, %Derived.decl [template = constants.%Derived] +// CHECK:STDOUT: %d.loc29_11.1: Derived = param d +// CHECK:STDOUT: @Access.%d: Derived = bind_name d, %d.loc29_11.1 +// CHECK:STDOUT: %int.make_type_32.loc29_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc29_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_35.1: (type, type) = tuple_literal (%int.make_type_32.loc29_27, %int.make_type_32.loc29_32) +// CHECK:STDOUT: %.loc29_35.2: type = value_of_initializer %int.make_type_32.loc29_27 [template = i32] +// CHECK:STDOUT: %.loc29_35.3: type = converted %int.make_type_32.loc29_27, %.loc29_35.2 [template = i32] +// CHECK:STDOUT: %.loc29_35.4: type = value_of_initializer %int.make_type_32.loc29_32 [template = i32] +// CHECK:STDOUT: %.loc29_35.5: type = converted %int.make_type_32.loc29_32, %.loc29_35.4 [template = i32] +// CHECK:STDOUT: %.loc29_35.6: type = converted %.loc29_35.1, constants.%.15 [template = constants.%.15] // CHECK:STDOUT: @Access.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Abstract { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Abstract -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { // CHECK:STDOUT: %Abstract.ref: type = name_ref Abstract, file.%Abstract.decl [template = constants.%Abstract] -// CHECK:STDOUT: %.loc12: = base_decl Abstract, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl Abstract, element0 [template] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] -// CHECK:STDOUT: %.loc14_8: = field_decl d, element1 [template] +// CHECK:STDOUT: %.loc18_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_10.2: type = converted %int.make_type_32, %.loc18_10.1 [template = i32] +// CHECK:STDOUT: %.loc18_8: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc12 -// CHECK:STDOUT: .d = %.loc14_8 +// CHECK:STDOUT: .base = %.loc16 +// CHECK:STDOUT: .d = %.loc18_8 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -120,33 +124,33 @@ fn Access(d: Derived) -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: Derived { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.11] -// CHECK:STDOUT: %.loc22_26: {.a: i32} = struct_literal (%.loc22_25) -// CHECK:STDOUT: %.loc22_34: i32 = int_literal 7 [template = constants.%.12] -// CHECK:STDOUT: %.loc22_35: {.base: {.a: i32}, .d: i32} = struct_literal (%.loc22_26, %.loc22_34) +// CHECK:STDOUT: %.loc26_25: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc26_26: {.a: i32} = struct_literal (%.loc26_25) +// CHECK:STDOUT: %.loc26_34: i32 = int_literal 7 [template = constants.%.12] +// CHECK:STDOUT: %.loc26_35: {.base: {.a: i32}, .d: i32} = struct_literal (%.loc26_26, %.loc26_34) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Access(%d: Derived) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %d.ref.loc26_11: Derived = name_ref d, %d -// CHECK:STDOUT: %d.ref.loc26_12: = name_ref d, @Derived.%.loc14_8 [template = @Derived.%.loc14_8] -// CHECK:STDOUT: %.loc26_12.1: ref i32 = class_element_access %d.ref.loc26_11, element1 -// CHECK:STDOUT: %.loc26_12.2: i32 = bind_value %.loc26_12.1 -// CHECK:STDOUT: %d.ref.loc26_16: Derived = name_ref d, %d -// CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc12 [template = @Derived.%.loc12] -// CHECK:STDOUT: %.loc26_17.1: ref Abstract = class_element_access %d.ref.loc26_16, element0 -// CHECK:STDOUT: %.loc26_17.2: Abstract = bind_value %.loc26_17.1 -// CHECK:STDOUT: %a.ref: = name_ref a, @Abstract.%.loc8_8 [template = @Abstract.%.loc8_8] -// CHECK:STDOUT: %.loc26_22.1: ref i32 = class_element_access %.loc26_17.2, element0 -// CHECK:STDOUT: %.loc26_22.2: i32 = bind_value %.loc26_22.1 -// CHECK:STDOUT: %.loc26_24.1: (i32, i32) = tuple_literal (%.loc26_12.2, %.loc26_22.2) -// CHECK:STDOUT: %.loc26_24.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc26_24.3: init i32 = initialize_from %.loc26_12.2 to %.loc26_24.2 -// CHECK:STDOUT: %.loc26_24.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc26_24.5: init i32 = initialize_from %.loc26_22.2 to %.loc26_24.4 -// CHECK:STDOUT: %.loc26_24.6: init (i32, i32) = tuple_init (%.loc26_24.3, %.loc26_24.5) to %return -// CHECK:STDOUT: %.loc26_25: init (i32, i32) = converted %.loc26_24.1, %.loc26_24.6 -// CHECK:STDOUT: return %.loc26_25 to %return +// CHECK:STDOUT: %d.ref.loc30_11: Derived = name_ref d, %d +// CHECK:STDOUT: %d.ref.loc30_12: = name_ref d, @Derived.%.loc18_8 [template = @Derived.%.loc18_8] +// CHECK:STDOUT: %.loc30_12.1: ref i32 = class_element_access %d.ref.loc30_11, element1 +// CHECK:STDOUT: %.loc30_12.2: i32 = bind_value %.loc30_12.1 +// CHECK:STDOUT: %d.ref.loc30_16: Derived = name_ref d, %d +// CHECK:STDOUT: %base.ref: = name_ref base, @Derived.%.loc16 [template = @Derived.%.loc16] +// CHECK:STDOUT: %.loc30_17.1: ref Abstract = class_element_access %d.ref.loc30_16, element0 +// CHECK:STDOUT: %.loc30_17.2: Abstract = bind_value %.loc30_17.1 +// CHECK:STDOUT: %a.ref: = name_ref a, @Abstract.%.loc12_8 [template = @Abstract.%.loc12_8] +// CHECK:STDOUT: %.loc30_22.1: ref i32 = class_element_access %.loc30_17.2, element0 +// CHECK:STDOUT: %.loc30_22.2: i32 = bind_value %.loc30_22.1 +// CHECK:STDOUT: %.loc30_24.1: (i32, i32) = tuple_literal (%.loc30_12.2, %.loc30_22.2) +// CHECK:STDOUT: %.loc30_24.2: ref i32 = tuple_access %return, element0 +// CHECK:STDOUT: %.loc30_24.3: init i32 = initialize_from %.loc30_12.2 to %.loc30_24.2 +// CHECK:STDOUT: %.loc30_24.4: ref i32 = tuple_access %return, element1 +// CHECK:STDOUT: %.loc30_24.5: init i32 = initialize_from %.loc30_22.2 to %.loc30_24.4 +// CHECK:STDOUT: %.loc30_24.6: init (i32, i32) = tuple_init (%.loc30_24.3, %.loc30_24.5) to %return +// CHECK:STDOUT: %.loc30_25: init (i32, i32) = converted %.loc30_24.1, %.loc30_24.6 +// CHECK:STDOUT: return %.loc30_25 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon index d9a09b658a0e..30c3f19e1fc2 100644 --- a/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon +++ b/toolchain/check/testdata/class/fail_adapt_bad_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_adapt_bad_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_adapt_bad_decl.carbon // --- fail_not_type.carbon diff --git a/toolchain/check/testdata/class/fail_adapt_bad_type.carbon b/toolchain/check/testdata/class/fail_adapt_bad_type.carbon index 2c3607dbd876..cc753faf03f3 100644 --- a/toolchain/check/testdata/class/fail_adapt_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_adapt_bad_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_adapt_bad_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_adapt_bad_type.carbon // --- fail_incomplete_type.carbon diff --git a/toolchain/check/testdata/class/fail_adapt_modifiers.carbon b/toolchain/check/testdata/class/fail_adapt_modifiers.carbon index 4b1fb0e876cb..e1799dffc0ef 100644 --- a/toolchain/check/testdata/class/fail_adapt_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_adapt_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_adapt_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_adapt_modifiers.carbon class B {} diff --git a/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon b/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon index 2454a83b76d6..13cde042a5aa 100644 --- a/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon +++ b/toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_adapt_with_subobjects.carbon // --- fail_adapt_with_base.carbon diff --git a/toolchain/check/testdata/class/fail_addr_not_self.carbon b/toolchain/check/testdata/class/fail_addr_not_self.carbon index 465294a17c60..4a7c5d29b94e 100644 --- a/toolchain/check/testdata/class/fail_addr_not_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_not_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_not_self.carbon class Class { // CHECK:STDERR: fail_addr_not_self.carbon:[[@LINE+4]]:8: ERROR: `addr` can only be applied to a `self` parameter. @@ -41,16 +45,16 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { -// CHECK:STDOUT: %Class.ref.loc12: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %a.loc12_13.1: Class* = param a -// CHECK:STDOUT: %a.loc12_13.2: Class* = bind_name a, %a.loc12_13.1 +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %a.loc16_13.1: Class* = param a +// CHECK:STDOUT: %a.loc16_13.2: Class* = bind_name a, %a.loc16_13.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc17: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %b.loc17_13.1: Class* = param b -// CHECK:STDOUT: %b.loc17_13.2: Class* = bind_name b, %b.loc17_13.1 +// CHECK:STDOUT: %Class.ref.loc21: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc21: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %b.loc21_13.1: Class* = param b +// CHECK:STDOUT: %b.loc21_13.2: Class* = bind_name b, %b.loc21_13.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -59,7 +63,7 @@ class Class { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[@Class.%a.loc12_13.2: Class*](); +// CHECK:STDOUT: fn @F[@Class.%a.loc16_13.2: Class*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(@Class.%b.loc17_13.2: Class*); +// CHECK:STDOUT: fn @G(@Class.%b.loc21_13.2: Class*); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_addr_self.carbon b/toolchain/check/testdata/class/fail_addr_self.carbon index a31a285298d3..2fd2544dcd29 100644 --- a/toolchain/check/testdata/class/fail_addr_self.carbon +++ b/toolchain/check/testdata/class/fail_addr_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_addr_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_addr_self.carbon class Class { fn F[addr self: Class*](); @@ -65,29 +69,29 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { -// CHECK:STDOUT: %Class.ref.loc12_9: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc12_6.1: Class = param c -// CHECK:STDOUT: @F.2.%c: Class = bind_name c, %c.loc12_6.1 -// CHECK:STDOUT: %Class.ref.loc12_19: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %p.loc12_16.1: Class* = param p -// CHECK:STDOUT: @F.2.%p: Class* = bind_name p, %p.loc12_16.1 +// CHECK:STDOUT: %Class.ref.loc16_9: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc16_6.1: Class = param c +// CHECK:STDOUT: @F.2.%c: Class = bind_name c, %c.loc16_6.1 +// CHECK:STDOUT: %Class.ref.loc16_19: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc16_16.1: Class* = param p +// CHECK:STDOUT: @F.2.%p: Class* = bind_name p, %p.loc16_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Class.ref.loc8: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc8_24: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %self.loc8_13.1: Class* = param self -// CHECK:STDOUT: %self.loc8_13.3: Class* = bind_name self, %self.loc8_13.1 -// CHECK:STDOUT: %.loc8_8: Class* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: %Class.ref.loc12: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc12_24: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc12_13.1: Class* = param self +// CHECK:STDOUT: %self.loc12_13.3: Class* = bind_name self, %self.loc12_13.1 +// CHECK:STDOUT: %.loc12_8: Class* = addr_pattern %self.loc12_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %Class.ref.loc9: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %self.loc9_13.1: Class = param self -// CHECK:STDOUT: %self.loc9_13.3: Class = bind_name self, %self.loc9_13.1 -// CHECK:STDOUT: %.loc9: Class = addr_pattern %self.loc9_13.3 +// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %self.loc13_13.1: Class = param self +// CHECK:STDOUT: %self.loc13_13.3: Class = bind_name self, %self.loc13_13.1 +// CHECK:STDOUT: %.loc13: Class = addr_pattern %self.loc13_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -96,32 +100,32 @@ fn F(c: Class, p: Class*) { // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr @Class.%self.loc8_13.3: Class*](); +// CHECK:STDOUT: fn @F.1[addr @Class.%self.loc12_13.3: Class*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr @Class.%self.loc9_13.3: Class](); +// CHECK:STDOUT: fn @G[addr @Class.%self.loc13_13.3: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(%c: Class, %p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref.loc20: Class = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc20: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc20: = bound_method %c.ref.loc20, %F.ref.loc20 -// CHECK:STDOUT: %F.call.loc20: init () = call %.loc20() [template = ] -// CHECK:STDOUT: %c.ref.loc29: Class = name_ref c, %c -// CHECK:STDOUT: %G.ref.loc29: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc29: = bound_method %c.ref.loc29, %G.ref.loc29 -// CHECK:STDOUT: %G.call.loc29: init () = call %.loc29() [template = ] -// CHECK:STDOUT: %p.ref.loc32: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc32_4.1: ref Class = deref %p.ref.loc32 -// CHECK:STDOUT: %F.ref.loc32: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc32_7: = bound_method %.loc32_4.1, %F.ref.loc32 -// CHECK:STDOUT: %.loc32_4.2: Class* = addr_of %.loc32_4.1 -// CHECK:STDOUT: %F.call.loc32: init () = call %.loc32_7(%.loc32_4.2) -// CHECK:STDOUT: %p.ref.loc40: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc40_4.1: ref Class = deref %p.ref.loc40 -// CHECK:STDOUT: %G.ref.loc40: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc40_7: = bound_method %.loc40_4.1, %G.ref.loc40 -// CHECK:STDOUT: %.loc40_4.2: Class* = addr_of %.loc40_4.1 -// CHECK:STDOUT: %G.call.loc40: init () = call %.loc40_7() [template = ] +// CHECK:STDOUT: %c.ref.loc24: Class = name_ref c, %c +// CHECK:STDOUT: %F.ref.loc24: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc24: = bound_method %c.ref.loc24, %F.ref.loc24 +// CHECK:STDOUT: %F.call.loc24: init () = call %.loc24() [template = ] +// CHECK:STDOUT: %c.ref.loc33: Class = name_ref c, %c +// CHECK:STDOUT: %G.ref.loc33: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc33: = bound_method %c.ref.loc33, %G.ref.loc33 +// CHECK:STDOUT: %G.call.loc33: init () = call %.loc33() [template = ] +// CHECK:STDOUT: %p.ref.loc36: Class* = name_ref p, %p +// CHECK:STDOUT: %.loc36_4.1: ref Class = deref %p.ref.loc36 +// CHECK:STDOUT: %F.ref.loc36: F = name_ref F, @Class.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc36_7: = bound_method %.loc36_4.1, %F.ref.loc36 +// CHECK:STDOUT: %.loc36_4.2: Class* = addr_of %.loc36_4.1 +// CHECK:STDOUT: %F.call.loc36: init () = call %.loc36_7(%.loc36_4.2) +// CHECK:STDOUT: %p.ref.loc44: Class* = name_ref p, %p +// CHECK:STDOUT: %.loc44_4.1: ref Class = deref %p.ref.loc44 +// CHECK:STDOUT: %G.ref.loc44: G = name_ref G, @Class.%G.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc44_7: = bound_method %.loc44_4.1, %G.ref.loc44 +// CHECK:STDOUT: %.loc44_4.2: Class* = addr_of %.loc44_4.1 +// CHECK:STDOUT: %G.call.loc44: init () = call %.loc44_7() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_as_declared_name.carbon b/toolchain/check/testdata/class/fail_base_as_declared_name.carbon index 4cfa65f8b7e1..d81edeffcdd5 100644 --- a/toolchain/check/testdata/class/fail_base_as_declared_name.carbon +++ b/toolchain/check/testdata/class/fail_base_as_declared_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_as_declared_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_as_declared_name.carbon namespace N; diff --git a/toolchain/check/testdata/class/fail_base_bad_type.carbon b/toolchain/check/testdata/class/fail_base_bad_type.carbon index 729128fe4254..a6b00d487763 100644 --- a/toolchain/check/testdata/class/fail_base_bad_type.carbon +++ b/toolchain/check/testdata/class/fail_base_bad_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_bad_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_bad_type.carbon base class Base {} class Final { @@ -233,72 +237,72 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseError.decl: AccessMemberWithInvalidBaseError = fn_decl @AccessMemberWithInvalidBaseError [template = constants.%struct.2] { // CHECK:STDOUT: %DeriveFromError.ref: type = name_ref DeriveFromError, %DeriveFromError.decl [template = constants.%DeriveFromError] -// CHECK:STDOUT: %.loc21_55: type = ptr_type DeriveFromError [template = constants.%.5] -// CHECK:STDOUT: %p.loc21_37.1: DeriveFromError* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%p: DeriveFromError* = bind_name p, %p.loc21_37.1 -// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc21_61.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] -// CHECK:STDOUT: %.loc21_61.2: type = converted %int.make_type_32.loc21, %.loc21_61.1 [template = i32] +// CHECK:STDOUT: %.loc25_55: type = ptr_type DeriveFromError [template = constants.%.5] +// CHECK:STDOUT: %p.loc25_37.1: DeriveFromError* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%p: DeriveFromError* = bind_name p, %p.loc25_37.1 +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc25_61.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_61.2: type = converted %int.make_type_32.loc25, %.loc25_61.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseError.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromNonType.decl: type = class_decl @DeriveFromNonType [template = constants.%DeriveFromNonType] {} // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBasNonType.decl: AccessMemberWithInvalidBasNonType = fn_decl @AccessMemberWithInvalidBasNonType [template = constants.%struct.3] { // CHECK:STDOUT: %DeriveFromNonType.ref: type = name_ref DeriveFromNonType, %DeriveFromNonType.decl [template = constants.%DeriveFromNonType] -// CHECK:STDOUT: %.loc31_58: type = ptr_type DeriveFromNonType [template = constants.%.7] -// CHECK:STDOUT: %p.loc31_38.1: DeriveFromNonType* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc31_38.1 -// CHECK:STDOUT: %int.make_type_32.loc31: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc31_64.1: type = value_of_initializer %int.make_type_32.loc31 [template = i32] -// CHECK:STDOUT: %.loc31_64.2: type = converted %int.make_type_32.loc31, %.loc31_64.1 [template = i32] +// CHECK:STDOUT: %.loc35_58: type = ptr_type DeriveFromNonType [template = constants.%.7] +// CHECK:STDOUT: %p.loc35_38.1: DeriveFromNonType* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%p: DeriveFromNonType* = bind_name p, %p.loc35_38.1 +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc35_64.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] +// CHECK:STDOUT: %.loc35_64.2: type = converted %int.make_type_32.loc35, %.loc35_64.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBasNonType.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromi32.decl: type = class_decl @DeriveFromi32 [template = constants.%DeriveFromi32] {} // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ConvertToBadBasei32.decl: ConvertToBadBasei32 = fn_decl @ConvertToBadBasei32 [template = constants.%struct.4] { -// CHECK:STDOUT: %DeriveFromi32.ref.loc47: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %.loc47_40: type = ptr_type DeriveFromi32 [template = constants.%.8] -// CHECK:STDOUT: %p.loc47_24.1: DeriveFromi32* = param p -// CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc47_24.1 -// CHECK:STDOUT: %int.make_type_32.loc47: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc47_49.1: type = value_of_initializer %int.make_type_32.loc47 [template = i32] -// CHECK:STDOUT: %.loc47_49.2: type = converted %int.make_type_32.loc47, %.loc47_49.1 [template = i32] -// CHECK:STDOUT: %.loc47_49.3: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: %DeriveFromi32.ref.loc51: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] +// CHECK:STDOUT: %.loc51_40: type = ptr_type DeriveFromi32 [template = constants.%.8] +// CHECK:STDOUT: %p.loc51_24.1: DeriveFromi32* = param p +// CHECK:STDOUT: @ConvertToBadBasei32.%p: DeriveFromi32* = bind_name p, %p.loc51_24.1 +// CHECK:STDOUT: %int.make_type_32.loc51: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc51_49.1: type = value_of_initializer %int.make_type_32.loc51 [template = i32] +// CHECK:STDOUT: %.loc51_49.2: type = converted %int.make_type_32.loc51, %.loc51_49.1 [template = i32] +// CHECK:STDOUT: %.loc51_49.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: @ConvertToBadBasei32.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBasei32.decl: AccessMemberWithInvalidBasei32 = fn_decl @AccessMemberWithInvalidBasei32 [template = constants.%struct.5] { -// CHECK:STDOUT: %DeriveFromi32.ref.loc49: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] -// CHECK:STDOUT: %.loc49_51: type = ptr_type DeriveFromi32 [template = constants.%.8] -// CHECK:STDOUT: %p.loc49_35.1: DeriveFromi32* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc49_35.1 -// CHECK:STDOUT: %int.make_type_32.loc49: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc49_57.1: type = value_of_initializer %int.make_type_32.loc49 [template = i32] -// CHECK:STDOUT: %.loc49_57.2: type = converted %int.make_type_32.loc49, %.loc49_57.1 [template = i32] +// CHECK:STDOUT: %DeriveFromi32.ref.loc53: type = name_ref DeriveFromi32, %DeriveFromi32.decl [template = constants.%DeriveFromi32] +// CHECK:STDOUT: %.loc53_51: type = ptr_type DeriveFromi32 [template = constants.%.8] +// CHECK:STDOUT: %p.loc53_35.1: DeriveFromi32* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%p: DeriveFromi32* = bind_name p, %p.loc53_35.1 +// CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_57.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32] +// CHECK:STDOUT: %.loc53_57.2: type = converted %int.make_type_32.loc53, %.loc53_57.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBasei32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromTuple.decl: type = class_decl @DeriveFromTuple [template = constants.%DeriveFromTuple] {} // CHECK:STDOUT: %ConvertToBadBaseTuple.decl: ConvertToBadBaseTuple = fn_decl @ConvertToBadBaseTuple [template = constants.%struct.6] { -// CHECK:STDOUT: %DeriveFromTuple.ref.loc63: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] -// CHECK:STDOUT: %.loc63_44: type = ptr_type DeriveFromTuple [template = constants.%.14] -// CHECK:STDOUT: %p.loc63_26.1: DeriveFromTuple* = param p -// CHECK:STDOUT: @ConvertToBadBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc63_26.1 +// CHECK:STDOUT: %DeriveFromTuple.ref.loc67: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] +// CHECK:STDOUT: %.loc67_44: type = ptr_type DeriveFromTuple [template = constants.%.14] +// CHECK:STDOUT: %p.loc67_26.1: DeriveFromTuple* = param p +// CHECK:STDOUT: @ConvertToBadBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc67_26.1 // CHECK:STDOUT: %Base.ref: type = name_ref Base, %Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc63_56: (type,) = tuple_literal (%Base.ref) -// CHECK:STDOUT: %.loc63_57.1: type = converted %.loc63_56, constants.%.11 [template = constants.%.11] -// CHECK:STDOUT: %.loc63_57.2: type = ptr_type (Base,) [template = constants.%.15] +// CHECK:STDOUT: %.loc67_56: (type,) = tuple_literal (%Base.ref) +// CHECK:STDOUT: %.loc67_57.1: type = converted %.loc67_56, constants.%.11 [template = constants.%.11] +// CHECK:STDOUT: %.loc67_57.2: type = ptr_type (Base,) [template = constants.%.15] // CHECK:STDOUT: @ConvertToBadBaseTuple.%return: ref (Base,)* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseTuple.decl: AccessMemberWithInvalidBaseTuple = fn_decl @AccessMemberWithInvalidBaseTuple [template = constants.%struct.7] { -// CHECK:STDOUT: %DeriveFromTuple.ref.loc65: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] -// CHECK:STDOUT: %.loc65_55: type = ptr_type DeriveFromTuple [template = constants.%.14] -// CHECK:STDOUT: %p.loc65_37.1: DeriveFromTuple* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc65_37.1 -// CHECK:STDOUT: %int.make_type_32.loc65: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc65_61.1: type = value_of_initializer %int.make_type_32.loc65 [template = i32] -// CHECK:STDOUT: %.loc65_61.2: type = converted %int.make_type_32.loc65, %.loc65_61.1 [template = i32] +// CHECK:STDOUT: %DeriveFromTuple.ref.loc69: type = name_ref DeriveFromTuple, %DeriveFromTuple.decl [template = constants.%DeriveFromTuple] +// CHECK:STDOUT: %.loc69_55: type = ptr_type DeriveFromTuple [template = constants.%.14] +// CHECK:STDOUT: %p.loc69_37.1: DeriveFromTuple* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%p: DeriveFromTuple* = bind_name p, %p.loc69_37.1 +// CHECK:STDOUT: %int.make_type_32.loc69: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc69_61.1: type = value_of_initializer %int.make_type_32.loc69 [template = i32] +// CHECK:STDOUT: %.loc69_61.2: type = converted %int.make_type_32.loc69, %.loc69_61.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseTuple.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromStruct.decl: type = class_decl @DeriveFromStruct [template = constants.%DeriveFromStruct] {} @@ -307,83 +311,83 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ConvertToBadBaseStruct.decl: ConvertToBadBaseStruct = fn_decl @ConvertToBadBaseStruct [template = constants.%struct.8] { -// CHECK:STDOUT: %DeriveFromStruct.ref.loc81: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] -// CHECK:STDOUT: %.loc81_46: type = ptr_type DeriveFromStruct [template = constants.%.18] -// CHECK:STDOUT: %p.loc81_27.1: DeriveFromStruct* = param p -// CHECK:STDOUT: @ConvertToBadBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc81_27.1 -// CHECK:STDOUT: %int.make_type_32.loc81_57: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc81_57.1: type = value_of_initializer %int.make_type_32.loc81_57 [template = i32] -// CHECK:STDOUT: %.loc81_57.2: type = converted %int.make_type_32.loc81_57, %.loc81_57.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc81_66: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc81_66.1: type = value_of_initializer %int.make_type_32.loc81_66 [template = i32] -// CHECK:STDOUT: %.loc81_66.2: type = converted %int.make_type_32.loc81_66, %.loc81_66.1 [template = i32] -// CHECK:STDOUT: %.loc81_69: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] -// CHECK:STDOUT: %.loc81_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] +// CHECK:STDOUT: %DeriveFromStruct.ref.loc85: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] +// CHECK:STDOUT: %.loc85_46: type = ptr_type DeriveFromStruct [template = constants.%.18] +// CHECK:STDOUT: %p.loc85_27.1: DeriveFromStruct* = param p +// CHECK:STDOUT: @ConvertToBadBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc85_27.1 +// CHECK:STDOUT: %int.make_type_32.loc85_57: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc85_57.1: type = value_of_initializer %int.make_type_32.loc85_57 [template = i32] +// CHECK:STDOUT: %.loc85_57.2: type = converted %int.make_type_32.loc85_57, %.loc85_57.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc85_66: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc85_66.1: type = value_of_initializer %int.make_type_32.loc85_66 [template = i32] +// CHECK:STDOUT: %.loc85_66.2: type = converted %int.make_type_32.loc85_66, %.loc85_66.1 [template = i32] +// CHECK:STDOUT: %.loc85_69: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] +// CHECK:STDOUT: %.loc85_70: type = ptr_type {.a: i32, .b: i32} [template = constants.%.17] // CHECK:STDOUT: @ConvertToBadBaseStruct.%return: ref {.a: i32, .b: i32}* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseStruct.decl: AccessMemberWithInvalidBaseStruct = fn_decl @AccessMemberWithInvalidBaseStruct [template = constants.%struct.9] { -// CHECK:STDOUT: %DeriveFromStruct.ref.loc84: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] -// CHECK:STDOUT: %.loc84_57: type = ptr_type DeriveFromStruct [template = constants.%.18] -// CHECK:STDOUT: %p.loc84_38.1: DeriveFromStruct* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc84_38.1 -// CHECK:STDOUT: %int.make_type_32.loc84: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc84_63.1: type = value_of_initializer %int.make_type_32.loc84 [template = i32] -// CHECK:STDOUT: %.loc84_63.2: type = converted %int.make_type_32.loc84, %.loc84_63.1 [template = i32] +// CHECK:STDOUT: %DeriveFromStruct.ref.loc88: type = name_ref DeriveFromStruct, %DeriveFromStruct.decl [template = constants.%DeriveFromStruct] +// CHECK:STDOUT: %.loc88_57: type = ptr_type DeriveFromStruct [template = constants.%.18] +// CHECK:STDOUT: %p.loc88_38.1: DeriveFromStruct* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%p: DeriveFromStruct* = bind_name p, %p.loc88_38.1 +// CHECK:STDOUT: %int.make_type_32.loc88: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc88_63.1: type = value_of_initializer %int.make_type_32.loc88 [template = i32] +// CHECK:STDOUT: %.loc88_63.2: type = converted %int.make_type_32.loc88, %.loc88_63.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseStruct.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %DeriveFromIncomplete.decl: type = class_decl @DeriveFromIncomplete [template = constants.%DeriveFromIncomplete] {} // CHECK:STDOUT: %ConvertToBadBaseIncomplete.decl: ConvertToBadBaseIncomplete = fn_decl @ConvertToBadBaseIncomplete [template = constants.%struct.10] { -// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc103: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] -// CHECK:STDOUT: %.loc103_54: type = ptr_type DeriveFromIncomplete [template = constants.%.19] -// CHECK:STDOUT: %p.loc103_31.1: DeriveFromIncomplete* = param p -// CHECK:STDOUT: @ConvertToBadBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc103_31.1 +// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc107: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] +// CHECK:STDOUT: %.loc107_54: type = ptr_type DeriveFromIncomplete [template = constants.%.19] +// CHECK:STDOUT: %p.loc107_31.1: DeriveFromIncomplete* = param p +// CHECK:STDOUT: @ConvertToBadBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc107_31.1 // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc103_70: type = ptr_type Incomplete [template = constants.%.20] +// CHECK:STDOUT: %.loc107_70: type = ptr_type Incomplete [template = constants.%.20] // CHECK:STDOUT: @ConvertToBadBaseIncomplete.%return: ref Incomplete* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseIncomplete.decl: AccessMemberWithInvalidBaseIncomplete = fn_decl @AccessMemberWithInvalidBaseIncomplete [template = constants.%struct.11] { -// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc105: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] -// CHECK:STDOUT: %.loc105_65: type = ptr_type DeriveFromIncomplete [template = constants.%.19] -// CHECK:STDOUT: %p.loc105_42.1: DeriveFromIncomplete* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc105_42.1 -// CHECK:STDOUT: %int.make_type_32.loc105: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc105_71.1: type = value_of_initializer %int.make_type_32.loc105 [template = i32] -// CHECK:STDOUT: %.loc105_71.2: type = converted %int.make_type_32.loc105, %.loc105_71.1 [template = i32] +// CHECK:STDOUT: %DeriveFromIncomplete.ref.loc109: type = name_ref DeriveFromIncomplete, %DeriveFromIncomplete.decl [template = constants.%DeriveFromIncomplete] +// CHECK:STDOUT: %.loc109_65: type = ptr_type DeriveFromIncomplete [template = constants.%.19] +// CHECK:STDOUT: %p.loc109_42.1: DeriveFromIncomplete* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%p: DeriveFromIncomplete* = bind_name p, %p.loc109_42.1 +// CHECK:STDOUT: %int.make_type_32.loc109: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc109_71.1: type = value_of_initializer %int.make_type_32.loc109 [template = i32] +// CHECK:STDOUT: %.loc109_71.2: type = converted %int.make_type_32.loc109, %.loc109_71.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseIncomplete.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %DeriveFromFinal.decl: type = class_decl @DeriveFromFinal [template = constants.%DeriveFromFinal] {} // CHECK:STDOUT: %ConvertToBadBaseFinal.decl: ConvertToBadBaseFinal = fn_decl @ConvertToBadBaseFinal [template = constants.%struct.12] { -// CHECK:STDOUT: %DeriveFromFinal.ref.loc116: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %.loc116_44: type = ptr_type DeriveFromFinal [template = constants.%.24] -// CHECK:STDOUT: %p.loc116_26.1: DeriveFromFinal* = param p -// CHECK:STDOUT: @ConvertToBadBaseFinal.%p: DeriveFromFinal* = bind_name p, %p.loc116_26.1 +// CHECK:STDOUT: %DeriveFromFinal.ref.loc120: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc120_44: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc120_26.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @ConvertToBadBaseFinal.%p: DeriveFromFinal* = bind_name p, %p.loc120_26.1 // CHECK:STDOUT: %Final.ref: type = name_ref Final, %Final.decl [template = constants.%Final] -// CHECK:STDOUT: %.loc116_55: type = ptr_type Final [template = constants.%.25] +// CHECK:STDOUT: %.loc120_55: type = ptr_type Final [template = constants.%.25] // CHECK:STDOUT: @ConvertToBadBaseFinal.%return: ref Final* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_WithMember.decl: AccessMemberWithInvalidBaseFinal_WithMember = fn_decl @AccessMemberWithInvalidBaseFinal_WithMember [template = constants.%struct.13] { -// CHECK:STDOUT: %DeriveFromFinal.ref.loc120: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %.loc120_66: type = ptr_type DeriveFromFinal [template = constants.%.24] -// CHECK:STDOUT: %p.loc120_48.1: DeriveFromFinal* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc120_48.1 -// CHECK:STDOUT: %int.make_type_32.loc120: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc120_72.1: type = value_of_initializer %int.make_type_32.loc120 [template = i32] -// CHECK:STDOUT: %.loc120_72.2: type = converted %int.make_type_32.loc120, %.loc120_72.1 [template = i32] +// CHECK:STDOUT: %DeriveFromFinal.ref.loc124: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc124_66: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc124_48.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%p: DeriveFromFinal* = bind_name p, %p.loc124_48.1 +// CHECK:STDOUT: %int.make_type_32.loc124: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc124_72.1: type = value_of_initializer %int.make_type_32.loc124 [template = i32] +// CHECK:STDOUT: %.loc124_72.2: type = converted %int.make_type_32.loc124, %.loc124_72.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_WithMember.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessMemberWithInvalidBaseFinal_NoMember.decl: AccessMemberWithInvalidBaseFinal_NoMember = fn_decl @AccessMemberWithInvalidBaseFinal_NoMember [template = constants.%struct.14] { -// CHECK:STDOUT: %DeriveFromFinal.ref.loc124: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] -// CHECK:STDOUT: %.loc124_64: type = ptr_type DeriveFromFinal [template = constants.%.24] -// CHECK:STDOUT: %p.loc124_46.1: DeriveFromFinal* = param p -// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%p: DeriveFromFinal* = bind_name p, %p.loc124_46.1 -// CHECK:STDOUT: %int.make_type_32.loc124: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc124_70.1: type = value_of_initializer %int.make_type_32.loc124 [template = i32] -// CHECK:STDOUT: %.loc124_70.2: type = converted %int.make_type_32.loc124, %.loc124_70.1 [template = i32] +// CHECK:STDOUT: %DeriveFromFinal.ref.loc128: type = name_ref DeriveFromFinal, %DeriveFromFinal.decl [template = constants.%DeriveFromFinal] +// CHECK:STDOUT: %.loc128_64: type = ptr_type DeriveFromFinal [template = constants.%.24] +// CHECK:STDOUT: %p.loc128_46.1: DeriveFromFinal* = param p +// CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%p: DeriveFromFinal* = bind_name p, %p.loc128_46.1 +// CHECK:STDOUT: %int.make_type_32.loc128: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc128_70.1: type = value_of_initializer %int.make_type_32.loc128 [template = i32] +// CHECK:STDOUT: %.loc128_70.2: type = converted %int.make_type_32.loc128, %.loc128_70.1 [template = i32] // CHECK:STDOUT: @AccessMemberWithInvalidBaseFinal_NoMember.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -395,72 +399,72 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: class @Final { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Final -// CHECK:STDOUT: .a = %.loc9_8 +// CHECK:STDOUT: .a = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromError { // CHECK:STDOUT: %error.ref: = name_ref error, [template = ] -// CHECK:STDOUT: %.loc17: = base_decl , element0 [template] +// CHECK:STDOUT: %.loc21: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromError -// CHECK:STDOUT: .base = %.loc17 +// CHECK:STDOUT: .base = %.loc21 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromNonType { -// CHECK:STDOUT: %.loc28_16: i32 = int_literal 32 [template = constants.%.6] -// CHECK:STDOUT: %.loc28_18: = base_decl , element0 [template] +// CHECK:STDOUT: %.loc32_16: i32 = int_literal 32 [template = constants.%.6] +// CHECK:STDOUT: %.loc32_18: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromNonType -// CHECK:STDOUT: .base = %.loc28_18 +// CHECK:STDOUT: .base = %.loc32_18 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromi32 { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc38_16.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc38_16.2: type = converted %int.make_type_32, %.loc38_16.1 [template = i32] -// CHECK:STDOUT: %.loc38_19: = base_decl , element0 [template] +// CHECK:STDOUT: %.loc42_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc42_16.2: type = converted %int.make_type_32, %.loc42_16.1 [template = i32] +// CHECK:STDOUT: %.loc42_19: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromi32 -// CHECK:STDOUT: .base = %.loc38_19 +// CHECK:STDOUT: .base = %.loc42_19 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromTuple { // CHECK:STDOUT: %Base.ref: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc56_22.1: (type,) = tuple_literal (%Base.ref) -// CHECK:STDOUT: %.loc56_22.2: type = converted %.loc56_22.1, constants.%.11 [template = constants.%.11] -// CHECK:STDOUT: %.loc56_23: = base_decl , element0 [template] +// CHECK:STDOUT: %.loc60_22.1: (type,) = tuple_literal (%Base.ref) +// CHECK:STDOUT: %.loc60_22.2: type = converted %.loc60_22.1, constants.%.11 [template = constants.%.11] +// CHECK:STDOUT: %.loc60_23: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromTuple -// CHECK:STDOUT: .base = %.loc56_23 +// CHECK:STDOUT: .base = %.loc60_23 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromStruct { -// CHECK:STDOUT: %int.make_type_32.loc74_21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc74_21.1: type = value_of_initializer %int.make_type_32.loc74_21 [template = i32] -// CHECK:STDOUT: %.loc74_21.2: type = converted %int.make_type_32.loc74_21, %.loc74_21.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc74_30: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc74_30.1: type = value_of_initializer %int.make_type_32.loc74_30 [template = i32] -// CHECK:STDOUT: %.loc74_30.2: type = converted %int.make_type_32.loc74_30, %.loc74_30.1 [template = i32] -// CHECK:STDOUT: %.loc74_33: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] -// CHECK:STDOUT: %.loc74_34: = base_decl , element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc78_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc78_21.1: type = value_of_initializer %int.make_type_32.loc78_21 [template = i32] +// CHECK:STDOUT: %.loc78_21.2: type = converted %int.make_type_32.loc78_21, %.loc78_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc78_30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc78_30.1: type = value_of_initializer %int.make_type_32.loc78_30 [template = i32] +// CHECK:STDOUT: %.loc78_30.2: type = converted %int.make_type_32.loc78_30, %.loc78_30.1 [template = i32] +// CHECK:STDOUT: %.loc78_33: type = struct_type {.a: i32, .b: i32} [template = constants.%.16] +// CHECK:STDOUT: %.loc78_34: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromStruct -// CHECK:STDOUT: .base = %.loc74_34 +// CHECK:STDOUT: .base = %.loc78_34 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: @@ -468,21 +472,21 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromIncomplete { // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc96: = base_decl , element0 [template] +// CHECK:STDOUT: %.loc100: = base_decl , element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromIncomplete -// CHECK:STDOUT: .base = %.loc96 +// CHECK:STDOUT: .base = %.loc100 // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @DeriveFromFinal { // CHECK:STDOUT: %Final.ref: type = name_ref Final, file.%Final.decl [template = constants.%Final] -// CHECK:STDOUT: %.loc112: = base_decl Final, element0 [template] +// CHECK:STDOUT: %.loc116: = base_decl Final, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%DeriveFromFinal -// CHECK:STDOUT: .base = %.loc112 +// CHECK:STDOUT: .base = %.loc116 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: @@ -491,7 +495,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseError(%p: DeriveFromError*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromError* = name_ref p, %p -// CHECK:STDOUT: %.loc21: ref DeriveFromError = deref %p.ref +// CHECK:STDOUT: %.loc25: ref DeriveFromError = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -499,7 +503,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBasNonType(%p: DeriveFromNonType*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromNonType* = name_ref p, %p -// CHECK:STDOUT: %.loc31: ref DeriveFromNonType = deref %p.ref +// CHECK:STDOUT: %.loc35: ref DeriveFromNonType = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -513,7 +517,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBasei32(%p: DeriveFromi32*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromi32* = name_ref p, %p -// CHECK:STDOUT: %.loc49: ref DeriveFromi32 = deref %p.ref +// CHECK:STDOUT: %.loc53: ref DeriveFromi32 = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -527,7 +531,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseTuple(%p: DeriveFromTuple*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromTuple* = name_ref p, %p -// CHECK:STDOUT: %.loc65: ref DeriveFromTuple = deref %p.ref +// CHECK:STDOUT: %.loc69: ref DeriveFromTuple = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -541,7 +545,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseStruct(%p: DeriveFromStruct*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromStruct* = name_ref p, %p -// CHECK:STDOUT: %.loc84: ref DeriveFromStruct = deref %p.ref +// CHECK:STDOUT: %.loc88: ref DeriveFromStruct = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -555,7 +559,7 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseIncomplete(%p: DeriveFromIncomplete*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromIncomplete* = name_ref p, %p -// CHECK:STDOUT: %.loc105: ref DeriveFromIncomplete = deref %p.ref +// CHECK:STDOUT: %.loc109: ref DeriveFromIncomplete = deref %p.ref // CHECK:STDOUT: %n.ref: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -563,29 +567,29 @@ fn AccessMemberWithInvalidBaseFinal_NoMember(p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: fn @ConvertToBadBaseFinal(%p: DeriveFromFinal*) -> Final* { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromFinal* = name_ref p, %p -// CHECK:STDOUT: %.loc117_11.1: ref DeriveFromFinal = deref %p.ref -// CHECK:STDOUT: %.loc117_11.2: ref Final = class_element_access %.loc117_11.1, element0 -// CHECK:STDOUT: %.loc117_11.3: Final* = addr_of %.loc117_11.2 -// CHECK:STDOUT: %.loc117_11.4: Final* = converted %p.ref, %.loc117_11.3 -// CHECK:STDOUT: return %.loc117_11.4 +// CHECK:STDOUT: %.loc121_11.1: ref DeriveFromFinal = deref %p.ref +// CHECK:STDOUT: %.loc121_11.2: ref Final = class_element_access %.loc121_11.1, element0 +// CHECK:STDOUT: %.loc121_11.3: Final* = addr_of %.loc121_11.2 +// CHECK:STDOUT: %.loc121_11.4: Final* = converted %p.ref, %.loc121_11.3 +// CHECK:STDOUT: return %.loc121_11.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseFinal_WithMember(%p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromFinal* = name_ref p, %p -// CHECK:STDOUT: %.loc121_11: ref DeriveFromFinal = deref %p.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Final.%.loc9_8 [template = @Final.%.loc9_8] -// CHECK:STDOUT: %.loc121_14.1: ref Final = class_element_access %.loc121_11, element0 -// CHECK:STDOUT: %.loc121_14.2: ref Final = converted %.loc121_11, %.loc121_14.1 -// CHECK:STDOUT: %.loc121_14.3: ref i32 = class_element_access %.loc121_14.2, element0 -// CHECK:STDOUT: %.loc121_14.4: i32 = bind_value %.loc121_14.3 -// CHECK:STDOUT: return %.loc121_14.4 +// CHECK:STDOUT: %.loc125_11: ref DeriveFromFinal = deref %p.ref +// CHECK:STDOUT: %a.ref: = name_ref a, @Final.%.loc13_8 [template = @Final.%.loc13_8] +// CHECK:STDOUT: %.loc125_14.1: ref Final = class_element_access %.loc125_11, element0 +// CHECK:STDOUT: %.loc125_14.2: ref Final = converted %.loc125_11, %.loc125_14.1 +// CHECK:STDOUT: %.loc125_14.3: ref i32 = class_element_access %.loc125_14.2, element0 +// CHECK:STDOUT: %.loc125_14.4: i32 = bind_value %.loc125_14.3 +// CHECK:STDOUT: return %.loc125_14.4 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AccessMemberWithInvalidBaseFinal_NoMember(%p: DeriveFromFinal*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: DeriveFromFinal* = name_ref p, %p -// CHECK:STDOUT: %.loc128: ref DeriveFromFinal = deref %p.ref +// CHECK:STDOUT: %.loc132: ref DeriveFromFinal = deref %p.ref // CHECK:STDOUT: %b.ref: = name_ref b, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_base_method_define.carbon b/toolchain/check/testdata/class/fail_base_method_define.carbon index 385668115b4b..f846fce174b4 100644 --- a/toolchain/check/testdata/class/fail_base_method_define.carbon +++ b/toolchain/check/testdata/class/fail_base_method_define.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_method_define.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_method_define.carbon base class B { fn F(); @@ -81,11 +85,11 @@ fn D.C.F() {} // CHECK:STDOUT: // CHECK:STDOUT: class @D { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc16: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc20: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .base = %.loc16 +// CHECK:STDOUT: .base = %.loc20 // CHECK:STDOUT: .F = file.%F.decl // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/fail_base_misplaced.carbon b/toolchain/check/testdata/class/fail_base_misplaced.carbon index 7f9ad4f7ce86..a9003dc83203 100644 --- a/toolchain/check/testdata/class/fail_base_misplaced.carbon +++ b/toolchain/check/testdata/class/fail_base_misplaced.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_misplaced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_misplaced.carbon base class B {} diff --git a/toolchain/check/testdata/class/fail_base_modifiers.carbon b/toolchain/check/testdata/class/fail_base_modifiers.carbon index 69fab97319ef..6131bb91af07 100644 --- a/toolchain/check/testdata/class/fail_base_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_base_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_modifiers.carbon base class B {} @@ -89,40 +93,40 @@ class C4 { // CHECK:STDOUT: // CHECK:STDOUT: class @C1 { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc14: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc18: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C1 -// CHECK:STDOUT: .base = %.loc14 +// CHECK:STDOUT: .base = %.loc18 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C2 { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc26: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc30: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C2 -// CHECK:STDOUT: .base = %.loc26 +// CHECK:STDOUT: .base = %.loc30 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C3 { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc37: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc41: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C3 -// CHECK:STDOUT: .base = %.loc37 +// CHECK:STDOUT: .base = %.loc41 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C4 { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc47: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc51: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C4 -// CHECK:STDOUT: .base = %.loc47 +// CHECK:STDOUT: .base = %.loc51 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_no_extend.carbon b/toolchain/check/testdata/class/fail_base_no_extend.carbon index 6d15d5f87aba..a54b61473c6e 100644 --- a/toolchain/check/testdata/class/fail_base_no_extend.carbon +++ b/toolchain/check/testdata/class/fail_base_no_extend.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_no_extend.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_no_extend.carbon base class B {} @@ -43,10 +47,10 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc13: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc17: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .base = %.loc13 +// CHECK:STDOUT: .base = %.loc17 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_repeated.carbon b/toolchain/check/testdata/class/fail_base_repeated.carbon index 341827546f94..6c53b5ed1f24 100644 --- a/toolchain/check/testdata/class/fail_base_repeated.carbon +++ b/toolchain/check/testdata/class/fail_base_repeated.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_repeated.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_repeated.carbon base class B1 {} base class B2 {} @@ -73,23 +77,23 @@ class D { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B1.ref: type = name_ref B1, file.%B1.decl [template = constants.%B1] -// CHECK:STDOUT: %.loc11: = base_decl B1, element0 [template] +// CHECK:STDOUT: %.loc15: = base_decl B1, element0 [template] // CHECK:STDOUT: %B2.ref: type = name_ref B2, file.%B2.decl [template = constants.%B2] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .base = %.loc11 +// CHECK:STDOUT: .base = %.loc15 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { -// CHECK:STDOUT: %B1.ref.loc24: type = name_ref B1, file.%B1.decl [template = constants.%B1] -// CHECK:STDOUT: %.loc24: = base_decl B1, element0 [template] -// CHECK:STDOUT: %B1.ref.loc31: type = name_ref B1, file.%B1.decl [template = constants.%B1] +// CHECK:STDOUT: %B1.ref.loc28: type = name_ref B1, file.%B1.decl [template = constants.%B1] +// CHECK:STDOUT: %.loc28: = base_decl B1, element0 [template] +// CHECK:STDOUT: %B1.ref.loc35: type = name_ref B1, file.%B1.decl [template = constants.%B1] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D -// CHECK:STDOUT: .base = %.loc24 +// CHECK:STDOUT: .base = %.loc28 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_base_unbound.carbon b/toolchain/check/testdata/class/fail_base_unbound.carbon index f517133fada6..ec4a9bacf77b 100644 --- a/toolchain/check/testdata/class/fail_base_unbound.carbon +++ b/toolchain/check/testdata/class/fail_base_unbound.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_base_unbound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_base_unbound.carbon base class B {} @@ -38,7 +42,7 @@ let b: B = C.base; // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc10 [template = @C.%.loc10] +// CHECK:STDOUT: %base.ref: = name_ref base, @C.%.loc14 [template = @C.%.loc14] // CHECK:STDOUT: %b: B = bind_name b, // CHECK:STDOUT: } // CHECK:STDOUT: @@ -49,11 +53,11 @@ let b: B = C.base; // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %.loc10: = base_decl B, element0 [template] +// CHECK:STDOUT: %.loc14: = base_decl B, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .base = %.loc10 +// CHECK:STDOUT: .base = %.loc14 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon index 3a575212a59a..1a16a94de042 100644 --- a/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +++ b/toolchain/check/testdata/class/fail_compound_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_compound_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_compound_type_mismatch.carbon class A { var a: i32; @@ -52,35 +56,35 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AccessBInA.decl: AccessBInA = fn_decl @AccessBInA [template = constants.%struct.2] { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %a.loc15_15.1: A = param a -// CHECK:STDOUT: @AccessBInA.%a: A = bind_name a, %a.loc15_15.1 +// CHECK:STDOUT: %a.loc19_15.1: A = param a +// CHECK:STDOUT: @AccessBInA.%a: A = bind_name a, %a.loc19_15.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc15_24.2: type = converted %int.make_type_32, %.loc15_24.1 [template = i32] +// CHECK:STDOUT: %.loc19_24.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_24.2: type = converted %int.make_type_32, %.loc19_24.1 [template = i32] // CHECK:STDOUT: @AccessBInA.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] -// CHECK:STDOUT: %.loc12_8: = field_decl b, element0 [template] +// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32, %.loc16_10.1 [template = i32] +// CHECK:STDOUT: %.loc16_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .b = %.loc12_8 +// CHECK:STDOUT: .b = %.loc16_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -89,8 +93,8 @@ fn AccessBInA(a: A) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: A = name_ref a, %a // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [template = constants.%B] -// CHECK:STDOUT: %b.ref: = name_ref b, @B.%.loc12_8 [template = @B.%.loc12_8] -// CHECK:STDOUT: %.loc19: i32 = class_element_access , element0 [template = ] +// CHECK:STDOUT: %b.ref: = name_ref b, @B.%.loc16_8 [template = @B.%.loc16_8] +// CHECK:STDOUT: %.loc23: i32 = class_element_access , element0 [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon index 2bfa56d0c509..9cbc17100ee2 100644 --- a/toolchain/check/testdata/class/fail_convert_to_invalid.carbon +++ b/toolchain/check/testdata/class/fail_convert_to_invalid.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_convert_to_invalid.carbon class C { // CHECK:STDERR: fail_convert_to_invalid.carbon:[[@LINE+3]]:10: ERROR: Name `NoSuchType` not found. @@ -42,17 +46,17 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %NoSuchType.ref: = name_ref NoSuchType, [template = ] -// CHECK:STDOUT: %.loc11: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc15: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc11 +// CHECK:STDOUT: .a = %.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> %return: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_16: i32 = int_literal 123 [template = constants.%.2] -// CHECK:STDOUT: %.loc15_19: {.a: i32} = struct_literal (%.loc15_16) +// CHECK:STDOUT: %.loc19_16: i32 = int_literal 123 [template = constants.%.2] +// CHECK:STDOUT: %.loc19_19: {.a: i32} = struct_literal (%.loc19_16) // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_derived_to_base.carbon b/toolchain/check/testdata/class/fail_derived_to_base.carbon index bf59f63343a4..6b92bc2b38d6 100644 --- a/toolchain/check/testdata/class/fail_derived_to_base.carbon +++ b/toolchain/check/testdata/class/fail_derived_to_base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_derived_to_base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_derived_to_base.carbon base class A1 { var a: i32; @@ -79,59 +83,59 @@ fn ConvertIncomplete(p: Incomplete*) -> A2* { return p; } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ConvertUnrelated.decl: ConvertUnrelated = fn_decl @ConvertUnrelated [template = constants.%struct.2] { // CHECK:STDOUT: %B2.ref: type = name_ref B2, %B2.decl [template = constants.%B2] -// CHECK:STDOUT: %.loc24_26: type = ptr_type B2 [template = constants.%.9] -// CHECK:STDOUT: %p.loc24_21.1: B2* = param p -// CHECK:STDOUT: @ConvertUnrelated.%p: B2* = bind_name p, %p.loc24_21.1 +// CHECK:STDOUT: %.loc28_26: type = ptr_type B2 [template = constants.%.9] +// CHECK:STDOUT: %p.loc28_21.1: B2* = param p +// CHECK:STDOUT: @ConvertUnrelated.%p: B2* = bind_name p, %p.loc28_21.1 // CHECK:STDOUT: %A1.ref: type = name_ref A1, %A1.decl [template = constants.%A1] -// CHECK:STDOUT: %.loc24_34: type = ptr_type A1 [template = constants.%.10] +// CHECK:STDOUT: %.loc28_34: type = ptr_type A1 [template = constants.%.10] // CHECK:STDOUT: @ConvertUnrelated.%return: ref A1* = var // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %ConvertIncomplete.decl: ConvertIncomplete = fn_decl @ConvertIncomplete [template = constants.%struct.3] { // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc31_35: type = ptr_type Incomplete [template = constants.%.14] -// CHECK:STDOUT: %p.loc31_22.1: Incomplete* = param p -// CHECK:STDOUT: @ConvertIncomplete.%p: Incomplete* = bind_name p, %p.loc31_22.1 +// CHECK:STDOUT: %.loc35_35: type = ptr_type Incomplete [template = constants.%.14] +// CHECK:STDOUT: %p.loc35_22.1: Incomplete* = param p +// CHECK:STDOUT: @ConvertIncomplete.%p: Incomplete* = bind_name p, %p.loc35_22.1 // CHECK:STDOUT: %A2.ref: type = name_ref A2, %A2.decl [template = constants.%A2] -// CHECK:STDOUT: %.loc31_43: type = ptr_type A2 [template = constants.%.15] +// CHECK:STDOUT: %.loc35_43: type = ptr_type A2 [template = constants.%.15] // CHECK:STDOUT: @ConvertIncomplete.%return: ref A2* = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A1 { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A1 -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A2 { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] -// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32, %.loc16_10.1 [template = i32] +// CHECK:STDOUT: %.loc16_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A2 -// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .a = %.loc16_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B2 { // CHECK:STDOUT: %A2.ref: type = name_ref A2, file.%A2.decl [template = constants.%A2] -// CHECK:STDOUT: %.loc16: = base_decl A2, element0 [template] +// CHECK:STDOUT: %.loc20: = base_decl A2, element0 [template] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] -// CHECK:STDOUT: %.loc17_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %.loc21_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_10.2: type = converted %int.make_type_32, %.loc21_10.1 [template = i32] +// CHECK:STDOUT: %.loc21_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B2 -// CHECK:STDOUT: .base = %.loc16 -// CHECK:STDOUT: .b = %.loc17_8 +// CHECK:STDOUT: .base = %.loc20 +// CHECK:STDOUT: .b = %.loc21_8 // CHECK:STDOUT: extend name_scope3 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_extend_cycle.carbon b/toolchain/check/testdata/class/fail_extend_cycle.carbon index 5039300d12ea..cf5fbb828265 100644 --- a/toolchain/check/testdata/class/fail_extend_cycle.carbon +++ b/toolchain/check/testdata/class/fail_extend_cycle.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_extend_cycle.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_extend_cycle.carbon base class A { } @@ -60,24 +64,24 @@ base class A { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc12: = base_decl A, element0 [template] +// CHECK:STDOUT: %.loc16: = base_decl A, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .base = %.loc12 +// CHECK:STDOUT: .base = %.loc16 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @.1 { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc23: > = base_decl A, element0 [template] +// CHECK:STDOUT: %.loc27: > = base_decl A, element0 [template] // CHECK:STDOUT: %C.ref: = name_ref C, [template = ] -// CHECK:STDOUT: %.loc27: = field_decl c, element1 [template] +// CHECK:STDOUT: %.loc31: = field_decl c, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%.6 -// CHECK:STDOUT: .base = %.loc23 -// CHECK:STDOUT: .c = %.loc27 +// CHECK:STDOUT: .base = %.loc27 +// CHECK:STDOUT: .c = %.loc31 // CHECK:STDOUT: extend name_scope2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_field_modifiers.carbon b/toolchain/check/testdata/class/fail_field_modifiers.carbon index 35448264bebe..532697435d13 100644 --- a/toolchain/check/testdata/class/fail_field_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_field_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_field_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_field_modifiers.carbon class Class { @@ -57,29 +61,29 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc13_18.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_18.2: type = converted %int.make_type_32.loc13, %.loc13_18.1 [template = i32] -// CHECK:STDOUT: %.loc13_16: = field_decl j, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc19_16.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] -// CHECK:STDOUT: %.loc19_16.2: type = converted %int.make_type_32.loc19, %.loc19_16.1 [template = i32] -// CHECK:STDOUT: %.loc19_14: = field_decl k, element1 [template] -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc25_18.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_18.2: type = converted %int.make_type_32.loc25, %.loc25_18.1 [template = i32] -// CHECK:STDOUT: %.loc25_24: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %l: i32 = bind_name l, %.loc25_24 -// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc30_16.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] -// CHECK:STDOUT: %.loc30_16.2: type = converted %int.make_type_32.loc30, %.loc30_16.1 [template = i32] -// CHECK:STDOUT: %.loc30_22: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %m: i32 = bind_name m, %.loc30_22 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_18.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_18.2: type = converted %int.make_type_32.loc17, %.loc17_18.1 [template = i32] +// CHECK:STDOUT: %.loc17_16: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc23_16.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_16.2: type = converted %int.make_type_32.loc23, %.loc23_16.1 [template = i32] +// CHECK:STDOUT: %.loc23_14: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc29_18.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_18.2: type = converted %int.make_type_32.loc29, %.loc29_18.1 [template = i32] +// CHECK:STDOUT: %.loc29_24: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %l: i32 = bind_name l, %.loc29_24 +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc34_16.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_16.2: type = converted %int.make_type_32.loc34, %.loc34_16.1 [template = i32] +// CHECK:STDOUT: %.loc34_22: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %m: i32 = bind_name m, %.loc34_22 // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc13_16 -// CHECK:STDOUT: .k = %.loc19_14 +// CHECK:STDOUT: .j = %.loc17_16 +// CHECK:STDOUT: .k = %.loc23_14 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/class/fail_import_misuses.carbon b/toolchain/check/testdata/class/fail_import_misuses.carbon index d2716f7f72f3..2aa7ac5fb26a 100644 --- a/toolchain/check/testdata/class/fail_import_misuses.carbon +++ b/toolchain/check/testdata/class/fail_import_misuses.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_import_misuses.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_import_misuses.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/fail_incomplete.carbon b/toolchain/check/testdata/class/fail_incomplete.carbon index 4084fabbf826..9282243b67ac 100644 --- a/toolchain/check/testdata/class/fail_incomplete.carbon +++ b/toolchain/check/testdata/class/fail_incomplete.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_incomplete.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_incomplete.carbon class Class; @@ -184,63 +188,63 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %CallClassFunction.decl: CallClassFunction = fn_decl @CallClassFunction [template = constants.%struct.2] {} -// CHECK:STDOUT: %Class.ref.loc36: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc40: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %global_var.var: ref = var global_var // CHECK:STDOUT: %global_var: ref = bind_name global_var, %global_var.var // CHECK:STDOUT: %ConvertFromStruct.decl: ConvertFromStruct = fn_decl @ConvertFromStruct [template = constants.%struct.3] { -// CHECK:STDOUT: %Class.ref.loc45: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc49: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ConvertFromStruct.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.4] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.5] { -// CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc47_14: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc47_6.1: Class* = param p -// CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc47_6.1 -// CHECK:STDOUT: %int.make_type_32.loc47: init type = call constants.%struct.4() [template = i32] -// CHECK:STDOUT: %.loc47_20.1: type = value_of_initializer %int.make_type_32.loc47 [template = i32] -// CHECK:STDOUT: %.loc47_20.2: type = converted %int.make_type_32.loc47, %.loc47_20.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc51: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc51_14: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc51_6.1: Class* = param p +// CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc51_6.1 +// CHECK:STDOUT: %int.make_type_32.loc51: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc51_20.1: type = value_of_initializer %int.make_type_32.loc51 [template = i32] +// CHECK:STDOUT: %.loc51_20.2: type = converted %int.make_type_32.loc51, %.loc51_20.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.4] // CHECK:STDOUT: %MemberAccess.decl: MemberAccess = fn_decl @MemberAccess [template = constants.%struct.6] { -// CHECK:STDOUT: %Class.ref.loc58: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc58_25: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc58_17.1: Class* = param p -// CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc58_17.1 -// CHECK:STDOUT: %int.make_type_32.loc58: init type = call constants.%struct.4() [template = i32] -// CHECK:STDOUT: %.loc58_31.1: type = value_of_initializer %int.make_type_32.loc58 [template = i32] -// CHECK:STDOUT: %.loc58_31.2: type = converted %int.make_type_32.loc58, %.loc58_31.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc62: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc62_25: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc62_17.1: Class* = param p +// CHECK:STDOUT: @MemberAccess.%p: Class* = bind_name p, %p.loc62_17.1 +// CHECK:STDOUT: %int.make_type_32.loc62: init type = call constants.%struct.4() [template = i32] +// CHECK:STDOUT: %.loc62_31.1: type = value_of_initializer %int.make_type_32.loc62 [template = i32] +// CHECK:STDOUT: %.loc62_31.2: type = converted %int.make_type_32.loc62, %.loc62_31.1 [template = i32] // CHECK:STDOUT: @MemberAccess.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Copy.decl: Copy = fn_decl @Copy [template = constants.%struct.7] { -// CHECK:STDOUT: %Class.ref.loc76_12: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc76: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc76_9.1: Class* = param p -// CHECK:STDOUT: @Copy.%p: Class* = bind_name p, %p.loc76_9.1 -// CHECK:STDOUT: %Class.ref.loc76_23: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc80_12: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc80: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc80_9.1: Class* = param p +// CHECK:STDOUT: @Copy.%p: Class* = bind_name p, %p.loc80_9.1 +// CHECK:STDOUT: %Class.ref.loc80_23: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Copy.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %Let.decl: Let = fn_decl @Let [template = constants.%struct.8] { -// CHECK:STDOUT: %Class.ref.loc80: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc80: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc80_8.1: Class* = param p -// CHECK:STDOUT: @Let.%p: Class* = bind_name p, %p.loc80_8.1 +// CHECK:STDOUT: %Class.ref.loc84: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc84: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc84_8.1: Class* = param p +// CHECK:STDOUT: @Let.%p: Class* = bind_name p, %p.loc84_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %TakeIncomplete.decl: TakeIncomplete = fn_decl @TakeIncomplete [template = constants.%struct.9] { -// CHECK:STDOUT: %Class.ref.loc91: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc91_19.1: Class = param c -// CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc91_19.1 +// CHECK:STDOUT: %Class.ref.loc95: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc95_19.1: Class = param c +// CHECK:STDOUT: @TakeIncomplete.%c: Class = bind_name c, %c.loc95_19.1 // CHECK:STDOUT: } // CHECK:STDOUT: %ReturnIncomplete.decl: ReturnIncomplete = fn_decl @ReturnIncomplete [template = constants.%struct.10] { -// CHECK:STDOUT: %Class.ref.loc93: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc97: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @ReturnIncomplete.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %CallTakeIncomplete.decl: CallTakeIncomplete = fn_decl @CallTakeIncomplete [template = constants.%struct.11] { -// CHECK:STDOUT: %Class.ref.loc95: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc95: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc95_23.1: Class* = param p -// CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc95_23.1 +// CHECK:STDOUT: %Class.ref.loc99: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc99: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc99_23.1: Class* = param p +// CHECK:STDOUT: @CallTakeIncomplete.%p: Class* = bind_name p, %p.loc99_23.1 // CHECK:STDOUT: } // CHECK:STDOUT: %CallReturnIncomplete.decl: CallReturnIncomplete = fn_decl @CallReturnIncomplete [template = constants.%struct.12] {} // CHECK:STDOUT: } @@ -261,7 +265,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @ConvertFromStruct() -> Class { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc45: {} = struct_literal () +// CHECK:STDOUT: %.loc49: {} = struct_literal () // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -270,21 +274,21 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: fn @G(%p: Class*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc55: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc59: ref Class = deref %p.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @MemberAccess(%p: Class*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc66: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc70: ref Class = deref %p.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Copy(%p: Class*) -> Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc77: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc81: ref Class = deref %p.ref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -292,7 +296,7 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc88: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc92: ref Class = deref %p.ref // CHECK:STDOUT: %c: = bind_name c, // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -303,13 +307,13 @@ fn CallReturnIncomplete() { // CHECK:STDOUT: // CHECK:STDOUT: fn @CallTakeIncomplete(%p: Class*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %TakeIncomplete.ref.loc106: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] +// CHECK:STDOUT: %TakeIncomplete.ref.loc110: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc106: ref Class = deref %p.ref -// CHECK:STDOUT: %TakeIncomplete.call.loc106: init () = call %TakeIncomplete.ref.loc106() [template = ] -// CHECK:STDOUT: %TakeIncomplete.ref.loc118: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] -// CHECK:STDOUT: %.loc118: {} = struct_literal () -// CHECK:STDOUT: %TakeIncomplete.call.loc118: init () = call %TakeIncomplete.ref.loc118() [template = ] +// CHECK:STDOUT: %.loc110: ref Class = deref %p.ref +// CHECK:STDOUT: %TakeIncomplete.call.loc110: init () = call %TakeIncomplete.ref.loc110() [template = ] +// CHECK:STDOUT: %TakeIncomplete.ref.loc122: TakeIncomplete = name_ref TakeIncomplete, file.%TakeIncomplete.decl [template = constants.%struct.9] +// CHECK:STDOUT: %.loc122: {} = struct_literal () +// CHECK:STDOUT: %TakeIncomplete.call.loc122: init () = call %TakeIncomplete.ref.loc122() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_init.carbon b/toolchain/check/testdata/class/fail_init.carbon index f5c07136c8ed..744e54b2c3a1 100644 --- a/toolchain/check/testdata/class/fail_init.carbon +++ b/toolchain/check/testdata/class/fail_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_init.carbon class Class { var a: i32; @@ -60,48 +64,48 @@ fn F() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc17_10.1: {.a: i32} = struct_literal (%.loc17_9) -// CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc17_10.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc17_10.3: ref Class = temporary %.loc17_10.2, -// CHECK:STDOUT: %.loc17_12: ref Class = converted %.loc17_10.1, %.loc17_10.3 -// CHECK:STDOUT: %.loc22_9: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc22_17: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc22_18.1: {.a: i32, .c: i32} = struct_literal (%.loc22_9, %.loc22_17) -// CHECK:STDOUT: %Class.ref.loc22: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc22_18.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc22_18.3: ref i32 = class_element_access %.loc22_18.2, element0 -// CHECK:STDOUT: %.loc22_18.4: init i32 = initialize_from %.loc22_9 to %.loc22_18.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc22_18.5: ref Class = temporary %.loc22_18.2, -// CHECK:STDOUT: %.loc22_20: ref Class = converted %.loc22_18.1, %.loc22_18.5 +// CHECK:STDOUT: %.loc21_9: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc21_10.1: {.a: i32} = struct_literal (%.loc21_9) +// CHECK:STDOUT: %Class.ref.loc21: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc21_10.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc21_10.3: ref Class = temporary %.loc21_10.2, +// CHECK:STDOUT: %.loc21_12: ref Class = converted %.loc21_10.1, %.loc21_10.3 // CHECK:STDOUT: %.loc26_9: i32 = int_literal 1 [template = constants.%.4] // CHECK:STDOUT: %.loc26_17: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc26_25: i32 = int_literal 3 [template = constants.%.9] -// CHECK:STDOUT: %.loc26_26.1: {.a: i32, .b: i32, .c: i32} = struct_literal (%.loc26_9, %.loc26_17, %.loc26_25) +// CHECK:STDOUT: %.loc26_18.1: {.a: i32, .c: i32} = struct_literal (%.loc26_9, %.loc26_17) // CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc26_26.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc26_26.3: ref Class = temporary %.loc26_26.2, -// CHECK:STDOUT: %.loc26_28: ref Class = converted %.loc26_26.1, %.loc26_26.3 +// CHECK:STDOUT: %.loc26_18.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc26_18.3: ref i32 = class_element_access %.loc26_18.2, element0 +// CHECK:STDOUT: %.loc26_18.4: init i32 = initialize_from %.loc26_9 to %.loc26_18.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc26_18.5: ref Class = temporary %.loc26_18.2, +// CHECK:STDOUT: %.loc26_20: ref Class = converted %.loc26_18.1, %.loc26_18.5 +// CHECK:STDOUT: %.loc30_9: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc30_17: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc30_25: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc30_26.1: {.a: i32, .b: i32, .c: i32} = struct_literal (%.loc30_9, %.loc30_17, %.loc30_25) +// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc30_26.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc30_26.3: ref Class = temporary %.loc30_26.2, +// CHECK:STDOUT: %.loc30_28: ref Class = converted %.loc30_26.1, %.loc30_26.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_init_as_inplace.carbon b/toolchain/check/testdata/class/fail_init_as_inplace.carbon index 0ffd5d1f2010..7522f9371b05 100644 --- a/toolchain/check/testdata/class/fail_init_as_inplace.carbon +++ b/toolchain/check/testdata/class/fail_init_as_inplace.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_init_as_inplace.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_init_as_inplace.carbon class Class { var a: i32; @@ -55,27 +59,27 @@ fn F() { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12: type = ptr_type Class [template = constants.%.4] -// CHECK:STDOUT: %p.loc12_6.1: Class* = param p -// CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc12_6.1 +// CHECK:STDOUT: %.loc16: type = ptr_type Class [template = constants.%.4] +// CHECK:STDOUT: %p.loc16_6.1: Class* = param p +// CHECK:STDOUT: @G.%p: Class* = bind_name p, %p.loc16_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -84,27 +88,27 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc21_10: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc25_10: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var -// CHECK:STDOUT: %.loc21_24: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_32: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_33.1: {.a: i32, .b: i32} = struct_literal (%.loc21_24, %.loc21_32) -// CHECK:STDOUT: %Class.ref.loc21_38: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc21_33.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc21_33.3: ref i32 = class_element_access %.loc21_33.2, element0 -// CHECK:STDOUT: %.loc21_33.4: init i32 = initialize_from %.loc21_24 to %.loc21_33.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc21_33.5: ref i32 = class_element_access %.loc21_33.2, element1 -// CHECK:STDOUT: %.loc21_33.6: init i32 = initialize_from %.loc21_32 to %.loc21_33.5 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_33.7: init Class = class_init (%.loc21_33.4, %.loc21_33.6), %.loc21_33.2 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc21_33.8: ref Class = temporary %.loc21_33.2, %.loc21_33.7 -// CHECK:STDOUT: %.loc21_35.1: ref Class = converted %.loc21_33.1, %.loc21_33.8 -// CHECK:STDOUT: %.loc21_35.2: Class = bind_value %.loc21_35.1 +// CHECK:STDOUT: %.loc25_24: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc25_32: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_33.1: {.a: i32, .b: i32} = struct_literal (%.loc25_24, %.loc25_32) +// CHECK:STDOUT: %Class.ref.loc25_38: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc25_33.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc25_33.3: ref i32 = class_element_access %.loc25_33.2, element0 +// CHECK:STDOUT: %.loc25_33.4: init i32 = initialize_from %.loc25_24 to %.loc25_33.3 [template = constants.%.6] +// CHECK:STDOUT: %.loc25_33.5: ref i32 = class_element_access %.loc25_33.2, element1 +// CHECK:STDOUT: %.loc25_33.6: init i32 = initialize_from %.loc25_32 to %.loc25_33.5 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_33.7: init Class = class_init (%.loc25_33.4, %.loc25_33.6), %.loc25_33.2 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc25_33.8: ref Class = temporary %.loc25_33.2, %.loc25_33.7 +// CHECK:STDOUT: %.loc25_35.1: ref Class = converted %.loc25_33.1, %.loc25_33.8 +// CHECK:STDOUT: %.loc25_35.2: Class = bind_value %.loc25_35.1 // CHECK:STDOUT: assign %c.var, // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c -// CHECK:STDOUT: %.loc22: Class* = addr_of %c.ref -// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc22) +// CHECK:STDOUT: %.loc26: Class* = addr_of %c.ref +// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc26) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_memaccess_category.carbon b/toolchain/check/testdata/class/fail_memaccess_category.carbon index 96eb2c41b003..569f853b7b4a 100644 --- a/toolchain/check/testdata/class/fail_memaccess_category.carbon +++ b/toolchain/check/testdata/class/fail_memaccess_category.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_memaccess_category.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_memaccess_category.carbon class A { fn F[addr self: A*](); @@ -65,22 +69,22 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: %B.decl: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc15: type = struct_type {.a: A} [template = constants.%.6] -// CHECK:STDOUT: %s.loc15_6.1: {.a: A} = param s -// CHECK:STDOUT: @F.2.%s: {.a: A} = bind_name s, %s.loc15_6.1 +// CHECK:STDOUT: %.loc19: type = struct_type {.a: A} [template = constants.%.6] +// CHECK:STDOUT: %s.loc19_6.1: {.a: A} = param s +// CHECK:STDOUT: @F.2.%s: {.a: A} = bind_name s, %s.loc19_6.1 // CHECK:STDOUT: %B.ref: type = name_ref B, %B.decl [template = constants.%B] -// CHECK:STDOUT: %b.loc15_18.1: B = param b -// CHECK:STDOUT: @F.2.%b: B = bind_name b, %b.loc15_18.1 +// CHECK:STDOUT: %b.loc19_18.1: B = param b +// CHECK:STDOUT: @F.2.%b: B = bind_name b, %b.loc19_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc8_20: type = ptr_type A [template = constants.%.1] -// CHECK:STDOUT: %self.loc8_13.1: A* = param self -// CHECK:STDOUT: %self.loc8_13.3: A* = bind_name self, %self.loc8_13.1 -// CHECK:STDOUT: %.loc8_8: A* = addr_pattern %self.loc8_13.3 +// CHECK:STDOUT: %.loc12_20: type = ptr_type A [template = constants.%.1] +// CHECK:STDOUT: %self.loc12_13.1: A* = param self +// CHECK:STDOUT: %self.loc12_13.3: A* = bind_name self, %self.loc12_13.1 +// CHECK:STDOUT: %.loc12_8: A* = addr_pattern %self.loc12_13.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -90,29 +94,29 @@ fn F(s: {.a: A}, b: B) { // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] -// CHECK:STDOUT: %.loc12: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc16: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B -// CHECK:STDOUT: .a = %.loc12 +// CHECK:STDOUT: .a = %.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[addr @A.%self.loc8_13.3: A*](); +// CHECK:STDOUT: fn @F.1[addr @A.%self.loc12_13.3: A*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(%s: {.a: A}, %b: B) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: {.a: A} = name_ref s, %s -// CHECK:STDOUT: %.loc24_4: A = struct_access %s.ref, element0 -// CHECK:STDOUT: %F.ref.loc24: F = name_ref F, @A.%F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc24_6: = bound_method %.loc24_4, %F.ref.loc24 -// CHECK:STDOUT: %F.call.loc24: init () = call %.loc24_6() [template = ] +// CHECK:STDOUT: %.loc28_4: A = struct_access %s.ref, element0 +// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, @A.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc28_6: = bound_method %.loc28_4, %F.ref.loc28 +// CHECK:STDOUT: %F.call.loc28: init () = call %.loc28_6() [template = ] // CHECK:STDOUT: %b.ref: B = name_ref b, %b -// CHECK:STDOUT: %a.ref: = name_ref a, @B.%.loc12 [template = @B.%.loc12] -// CHECK:STDOUT: %.loc34_4.1: ref A = class_element_access %b.ref, element0 -// CHECK:STDOUT: %.loc34_4.2: A = bind_value %.loc34_4.1 -// CHECK:STDOUT: %F.ref.loc34: F = name_ref F, @A.%F.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc34_6: = bound_method %.loc34_4.2, %F.ref.loc34 -// CHECK:STDOUT: %F.call.loc34: init () = call %.loc34_6() [template = ] +// CHECK:STDOUT: %a.ref: = name_ref a, @B.%.loc16 [template = @B.%.loc16] +// CHECK:STDOUT: %.loc38_4.1: ref A = class_element_access %b.ref, element0 +// CHECK:STDOUT: %.loc38_4.2: A = bind_value %.loc38_4.1 +// CHECK:STDOUT: %F.ref.loc38: F = name_ref F, @A.%F.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc38_6: = bound_method %.loc38_4.2, %F.ref.loc38 +// CHECK:STDOUT: %F.call.loc38: init () = call %.loc38_6() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_member_of_let.carbon b/toolchain/check/testdata/class/fail_member_of_let.carbon index c79a8ca5f376..b7b1f758714e 100644 --- a/toolchain/check/testdata/class/fail_member_of_let.carbon +++ b/toolchain/check/testdata/class/fail_member_of_let.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_member_of_let.carbon class Class { fn F() -> i32; @@ -48,8 +52,8 @@ fn T.F() {} // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_method.carbon b/toolchain/check/testdata/class/fail_method.carbon index 5fd175b69106..794920028f69 100644 --- a/toolchain/check/testdata/class/fail_method.carbon +++ b/toolchain/check/testdata/class/fail_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_method.carbon class Class { fn NoSelf(); @@ -66,13 +70,13 @@ fn F(c: Class) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Class.ref.loc12: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: %WithSelf.ref: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] // CHECK:STDOUT: %A: WithSelf = bind_alias A, @Class.%WithSelf.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { -// CHECK:STDOUT: %Class.ref.loc14: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc14_6.1: Class = param c -// CHECK:STDOUT: @F.%c: Class = bind_name c, %c.loc14_6.1 +// CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc18_6.1: Class = param c +// CHECK:STDOUT: @F.%c: Class = bind_name c, %c.loc18_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -80,8 +84,8 @@ fn F(c: Class) { // CHECK:STDOUT: %NoSelf.decl: NoSelf = fn_decl @NoSelf [template = constants.%struct.1] {} // CHECK:STDOUT: %WithSelf.decl: WithSelf = fn_decl @WithSelf [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %self.loc9_15.1: Class = param self -// CHECK:STDOUT: %self.loc9_15.2: Class = bind_name self, %self.loc9_15.1 +// CHECK:STDOUT: %self.loc13_15.1: Class = param self +// CHECK:STDOUT: %self.loc13_15.2: Class = bind_name self, %self.loc13_15.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -92,29 +96,29 @@ fn F(c: Class) { // CHECK:STDOUT: // CHECK:STDOUT: fn @NoSelf(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @WithSelf[@Class.%self.loc9_15.2: Class](); +// CHECK:STDOUT: fn @WithSelf[@Class.%self.loc13_15.2: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%c: Class) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref.loc15: Class = name_ref c, %c -// CHECK:STDOUT: %NoSelf.ref.loc15: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] -// CHECK:STDOUT: %NoSelf.call.loc15: init () = call %NoSelf.ref.loc15() -// CHECK:STDOUT: %c.ref.loc16: Class = name_ref c, %c -// CHECK:STDOUT: %WithSelf.ref.loc16: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc16: = bound_method %c.ref.loc16, %WithSelf.ref.loc16 -// CHECK:STDOUT: %WithSelf.call.loc16: init () = call %.loc16(%c.ref.loc16) -// CHECK:STDOUT: %Class.ref.loc18: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %NoSelf.ref.loc18: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] -// CHECK:STDOUT: %NoSelf.call.loc18: init () = call %NoSelf.ref.loc18() -// CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %WithSelf.ref.loc26: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] -// CHECK:STDOUT: %WithSelf.call.loc26: init () = call %WithSelf.ref.loc26() [template = ] -// CHECK:STDOUT: %Class.ref.loc34: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %WithSelf.ref.loc34: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] -// CHECK:STDOUT: %c.ref.loc34: Class = name_ref c, %c -// CHECK:STDOUT: %WithSelf.call.loc34: init () = call %WithSelf.ref.loc34() [template = ] +// CHECK:STDOUT: %c.ref.loc19: Class = name_ref c, %c +// CHECK:STDOUT: %NoSelf.ref.loc19: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] +// CHECK:STDOUT: %NoSelf.call.loc19: init () = call %NoSelf.ref.loc19() +// CHECK:STDOUT: %c.ref.loc20: Class = name_ref c, %c +// CHECK:STDOUT: %WithSelf.ref.loc20: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc20: = bound_method %c.ref.loc20, %WithSelf.ref.loc20 +// CHECK:STDOUT: %WithSelf.call.loc20: init () = call %.loc20(%c.ref.loc20) +// CHECK:STDOUT: %Class.ref.loc22: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %NoSelf.ref.loc22: NoSelf = name_ref NoSelf, @Class.%NoSelf.decl [template = constants.%struct.1] +// CHECK:STDOUT: %NoSelf.call.loc22: init () = call %NoSelf.ref.loc22() +// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %WithSelf.ref.loc30: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %WithSelf.call.loc30: init () = call %WithSelf.ref.loc30() [template = ] +// CHECK:STDOUT: %Class.ref.loc38: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %WithSelf.ref.loc38: WithSelf = name_ref WithSelf, @Class.%WithSelf.decl [template = constants.%struct.2] +// CHECK:STDOUT: %c.ref.loc38: Class = name_ref c, %c +// CHECK:STDOUT: %WithSelf.call.loc38: init () = call %WithSelf.ref.loc38() [template = ] // CHECK:STDOUT: %A.ref: WithSelf = name_ref A, file.%A [template = constants.%struct.2] -// CHECK:STDOUT: %WithSelf.call.loc42: init () = call %A.ref() [template = ] +// CHECK:STDOUT: %WithSelf.call.loc46: init () = call %A.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_method_modifiers.carbon b/toolchain/check/testdata/class/fail_method_modifiers.carbon index 65baf6e1ddeb..25b7ee26c570 100644 --- a/toolchain/check/testdata/class/fail_method_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_method_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_method_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_method_modifiers.carbon class FinalClass { @@ -86,14 +90,14 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: class @FinalClass { // CHECK:STDOUT: %Abstract.decl: Abstract = fn_decl @Abstract.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] -// CHECK:STDOUT: %self.loc16_24.1: FinalClass = param self -// CHECK:STDOUT: %self.loc16_24.2: FinalClass = bind_name self, %self.loc16_24.1 +// CHECK:STDOUT: %Self.ref.loc20: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] +// CHECK:STDOUT: %self.loc20_24.1: FinalClass = param self +// CHECK:STDOUT: %self.loc20_24.2: FinalClass = bind_name self, %self.loc20_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Virtual.decl: Virtual = fn_decl @Virtual [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc25: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] -// CHECK:STDOUT: %self.loc25_22.1: FinalClass = param self -// CHECK:STDOUT: %self.loc25_22.2: FinalClass = bind_name self, %self.loc25_22.1 +// CHECK:STDOUT: %Self.ref.loc29: type = name_ref Self, constants.%FinalClass [template = constants.%FinalClass] +// CHECK:STDOUT: %self.loc29_22.1: FinalClass = param self +// CHECK:STDOUT: %self.loc29_22.2: FinalClass = bind_name self, %self.loc29_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -104,14 +108,14 @@ base class BaseClass { // CHECK:STDOUT: // CHECK:STDOUT: class @AbstractClass { // CHECK:STDOUT: %Default.decl: Default = fn_decl @Default [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc34: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] -// CHECK:STDOUT: %self.loc34_22.1: AbstractClass = param self -// CHECK:STDOUT: %self.loc34_22.2: AbstractClass = bind_name self, %self.loc34_22.1 +// CHECK:STDOUT: %Self.ref.loc38: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] +// CHECK:STDOUT: %self.loc38_22.1: AbstractClass = param self +// CHECK:STDOUT: %self.loc38_22.2: AbstractClass = bind_name self, %self.loc38_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Final.decl: Final = fn_decl @Final [template = constants.%struct.4] { -// CHECK:STDOUT: %Self.ref.loc40: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] -// CHECK:STDOUT: %self.loc40_18.1: AbstractClass = param self -// CHECK:STDOUT: %self.loc40_18.2: AbstractClass = bind_name self, %self.loc40_18.1 +// CHECK:STDOUT: %Self.ref.loc44: type = name_ref Self, constants.%AbstractClass [template = constants.%AbstractClass] +// CHECK:STDOUT: %self.loc44_18.1: AbstractClass = param self +// CHECK:STDOUT: %self.loc44_18.2: AbstractClass = bind_name self, %self.loc44_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -123,8 +127,8 @@ base class BaseClass { // CHECK:STDOUT: class @BaseClass { // CHECK:STDOUT: %Abstract.decl: Abstract = fn_decl @Abstract.2 [template = constants.%struct.5] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%BaseClass [template = constants.%BaseClass] -// CHECK:STDOUT: %self.loc51_24.1: BaseClass = param self -// CHECK:STDOUT: %self.loc51_24.2: BaseClass = bind_name self, %self.loc51_24.1 +// CHECK:STDOUT: %self.loc55_24.1: BaseClass = param self +// CHECK:STDOUT: %self.loc55_24.2: BaseClass = bind_name self, %self.loc55_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -132,13 +136,13 @@ base class BaseClass { // CHECK:STDOUT: .Abstract = %Abstract.decl // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Abstract.1[@FinalClass.%self.loc16_24.2: FinalClass](); +// CHECK:STDOUT: fn @Abstract.1[@FinalClass.%self.loc20_24.2: FinalClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Virtual[@FinalClass.%self.loc25_22.2: FinalClass](); +// CHECK:STDOUT: fn @Virtual[@FinalClass.%self.loc29_22.2: FinalClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Default[@AbstractClass.%self.loc34_22.2: AbstractClass](); +// CHECK:STDOUT: fn @Default[@AbstractClass.%self.loc38_22.2: AbstractClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Final[@AbstractClass.%self.loc40_18.2: AbstractClass](); +// CHECK:STDOUT: fn @Final[@AbstractClass.%self.loc44_18.2: AbstractClass](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Abstract.2[@BaseClass.%self.loc51_24.2: BaseClass](); +// CHECK:STDOUT: fn @Abstract.2[@BaseClass.%self.loc55_24.2: BaseClass](); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_method_redefinition.carbon b/toolchain/check/testdata/class/fail_method_redefinition.carbon index f307e96cfa1b..c87b35764b9c 100644 --- a/toolchain/check/testdata/class/fail_method_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_method_redefinition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_method_redefinition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_method_redefinition.carbon class Class { fn F() {} @@ -35,19 +39,19 @@ class Class { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %F.decl.loc8: F = fn_decl @F [template = constants.%struct] {} -// CHECK:STDOUT: %F.decl.loc15: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc12: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc19: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .F = %F.decl.loc8 +// CHECK:STDOUT: .F = %F.decl.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: -// CHECK:STDOUT: !.loc15: +// CHECK:STDOUT: !.loc19: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_modifiers.carbon b/toolchain/check/testdata/class/fail_modifiers.carbon index 1c9262245db0..b4d4bafc1468 100644 --- a/toolchain/check/testdata/class/fail_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: ERROR: Semantics TODO: `access modifier`. // CHECK:STDERR: private abstract private class DuplicatePrivate; diff --git a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon index 52b15e0b0db6..bebde0ee707e 100644 --- a/toolchain/check/testdata/class/fail_out_of_line_decl.carbon +++ b/toolchain/check/testdata/class/fail_out_of_line_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_out_of_line_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_out_of_line_decl.carbon class C {} diff --git a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon index 8ee5f5f564fc..9b433b4989c6 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_introducer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_redeclaration_introducer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_redeclaration_introducer.carbon // --- fail_add_base.carbon diff --git a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon index a09209d3cf6e..164052accad7 100644 --- a/toolchain/check/testdata/class/fail_redeclaration_scope.carbon +++ b/toolchain/check/testdata/class/fail_redeclaration_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_redeclaration_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_redeclaration_scope.carbon class A; @@ -37,14 +41,14 @@ class Y { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.decl.loc7 +// CHECK:STDOUT: .A = %A.decl.loc11 // CHECK:STDOUT: .X = %X.decl // CHECK:STDOUT: .Y = %Y.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl.loc7: type = class_decl @A.1 [template = constants.%A.1] {} +// CHECK:STDOUT: %A.decl.loc11: type = class_decl @A.1 [template = constants.%A.1] {} // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} -// CHECK:STDOUT: %A.decl.loc15: type = class_decl @A.1 [template = constants.%A.1] {} +// CHECK:STDOUT: %A.decl.loc19: type = class_decl @A.1 [template = constants.%A.1] {} // CHECK:STDOUT: %Y.decl: type = class_decl @Y [template = constants.%Y] {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_redefinition.carbon b/toolchain/check/testdata/class/fail_redefinition.carbon index c7dc4f332262..984548e04445 100644 --- a/toolchain/check/testdata/class/fail_redefinition.carbon +++ b/toolchain/check/testdata/class/fail_redefinition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_redefinition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_redefinition.carbon class Class { fn F(); @@ -114,7 +118,7 @@ fn Class.I() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: -// CHECK:STDOUT: !.loc39: +// CHECK:STDOUT: !.loc43: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_scope.carbon b/toolchain/check/testdata/class/fail_scope.carbon index 6fc7d1909920..8967318a20fd 100644 --- a/toolchain/check/testdata/class/fail_scope.carbon +++ b/toolchain/check/testdata/class/fail_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_scope.carbon class Class { fn F() -> i32 { @@ -44,8 +48,8 @@ fn G() -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32, %.loc13_11.1 [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32, %.loc17_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -53,8 +57,8 @@ fn G() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -67,8 +71,8 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: return %.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { diff --git a/toolchain/check/testdata/class/fail_self.carbon b/toolchain/check/testdata/class/fail_self.carbon index 09c664f1d625..7d82744e90f2 100644 --- a/toolchain/check/testdata/class/fail_self.carbon +++ b/toolchain/check/testdata/class/fail_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_self.carbon class Class { // CHECK:STDERR: fail_self.carbon:[[@LINE+4]]:8: ERROR: `self` can only be declared in an implicit parameter list. @@ -76,30 +80,30 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc21_12.1: Class = param self -// CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc21_12.1 +// CHECK:STDOUT: %Self.ref.loc25: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc25_12.1: Class = param self +// CHECK:STDOUT: @F.1.%self: Class = bind_name self, %self.loc25_12.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc24: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Self.ref.loc28: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: @G.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %WrongSelf.decl: type = class_decl @WrongSelf [template = constants.%WrongSelf] {} // CHECK:STDOUT: %CallWrongSelf.decl: CallWrongSelf = fn_decl @CallWrongSelf [template = constants.%struct.4] { // CHECK:STDOUT: %WrongSelf.ref: type = name_ref WrongSelf, %WrongSelf.decl [template = constants.%WrongSelf] -// CHECK:STDOUT: %ws.loc41_18.1: WrongSelf = param ws -// CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc41_18.1 +// CHECK:STDOUT: %ws.loc45_18.1: WrongSelf = param ws +// CHECK:STDOUT: @CallWrongSelf.%ws: WrongSelf = bind_name ws, %ws.loc45_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc12_8.1: Class = param self -// CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %Self.ref.loc16: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc16_8.1: Class = param self +// CHECK:STDOUT: %self.loc16_8.2: Class = bind_name self, %self.loc16_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] // CHECK:STDOUT: %return.var: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -112,8 +116,8 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: class @WrongSelf { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %self.loc38_8.1: Class = param self -// CHECK:STDOUT: %self.loc38_8.2: Class = bind_name self, %self.loc38_8.1 +// CHECK:STDOUT: %self.loc42_8.1: Class = param self +// CHECK:STDOUT: %self.loc42_8.2: Class = bind_name self, %self.loc42_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -132,18 +136,18 @@ fn CallWrongSelf(ws: WrongSelf) { // CHECK:STDOUT: %self.var: ref Class = var self // CHECK:STDOUT: %self: ref Class = bind_name self, %self.var // CHECK:STDOUT: %self.ref: ref Class = name_ref self, %self -// CHECK:STDOUT: %.loc34: Class = bind_value %self.ref +// CHECK:STDOUT: %.loc38: Class = bind_value %self.ref // CHECK:STDOUT: return to %return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@WrongSelf.%self.loc38_8.2: Class](); +// CHECK:STDOUT: fn @F.2[@WrongSelf.%self.loc42_8.2: Class](); // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWrongSelf(%ws: WrongSelf) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %ws.ref: WrongSelf = name_ref ws, %ws // CHECK:STDOUT: %F.ref: F = name_ref F, @WrongSelf.%F.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc48: = bound_method %ws.ref, %F.ref -// CHECK:STDOUT: %F.call: init () = call %.loc48() [template = ] +// CHECK:STDOUT: %.loc52: = bound_method %ws.ref, %F.ref +// CHECK:STDOUT: %F.call: init () = call %.loc52() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_self_type_member.carbon b/toolchain/check/testdata/class/fail_self_type_member.carbon index 865eb969b641..0c7a687dc832 100644 --- a/toolchain/check/testdata/class/fail_self_type_member.carbon +++ b/toolchain/check/testdata/class/fail_self_type_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_self_type_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_self_type_member.carbon class Class { var b: bool; @@ -41,13 +45,13 @@ fn F() -> bool { // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc8_10.2: type = converted %bool.make_type, %.loc8_10.1 [template = bool] -// CHECK:STDOUT: %.loc8_8: = field_decl b, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc12_10.2: type = converted %bool.make_type, %.loc12_10.1 [template = bool] +// CHECK:STDOUT: %.loc12_8: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .b = %.loc8_8 +// CHECK:STDOUT: .b = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; diff --git a/toolchain/check/testdata/class/fail_todo_generic_method.carbon b/toolchain/check/testdata/class/fail_todo_generic_method.carbon index 812e313fb6df..a9fb5e325e8a 100644 --- a/toolchain/check/testdata/class/fail_todo_generic_method.carbon +++ b/toolchain/check/testdata/class/fail_todo_generic_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_todo_generic_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_todo_generic_method.carbon class Class(T:! type) { var a: T; @@ -36,36 +40,36 @@ fn Class(T:! type).F[self: Self](n: T) {} // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc7_13.1: type = param T -// CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_13.1: type = param T +// CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %T.loc15_10.1: type = param T -// CHECK:STDOUT: %T.loc15_10.2: type = bind_symbolic_name T 0, %T.loc15_10.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc19_10.1: type = param T +// CHECK:STDOUT: %T.loc19_10.2: type = bind_symbolic_name T 0, %T.loc19_10.1 [symbolic = constants.%T] // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] -// CHECK:STDOUT: %self.loc15_22.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc15_22.1 -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_10.2 [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc15_34.1: T = param n -// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc15_34.1 +// CHECK:STDOUT: %self.loc19_22.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc19_22.1 +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc19_10.2 [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc19_34.1: T = param n +// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc19_34.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8: = field_decl a, element0 [template] +// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc12: = field_decl a, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] -// CHECK:STDOUT: %self.loc9_8.1: Class = param self -// CHECK:STDOUT: %self.loc9_8.2: Class = bind_name self, %self.loc9_8.1 -// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc9_20.1: T = param n -// CHECK:STDOUT: %n.loc9_20.2: T = bind_name n, %n.loc9_20.1 +// CHECK:STDOUT: %self.loc13_8.1: Class = param self +// CHECK:STDOUT: %self.loc13_8.2: Class = bind_name self, %self.loc13_8.1 +// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc13_20.1: T = param n +// CHECK:STDOUT: %n.loc13_20.2: T = bind_name n, %n.loc13_20.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class.2 -// CHECK:STDOUT: .a = %.loc8 +// CHECK:STDOUT: .a = %.loc12 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_todo_local_class.carbon b/toolchain/check/testdata/class/fail_todo_local_class.carbon index 315bd257941e..f62a1546958a 100644 --- a/toolchain/check/testdata/class/fail_todo_local_class.carbon +++ b/toolchain/check/testdata/class/fail_todo_local_class.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_todo_local_class.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_todo_local_class.carbon // TODO: Support parsing classes at function scope. class A { diff --git a/toolchain/check/testdata/class/fail_todo_modifiers.carbon b/toolchain/check/testdata/class/fail_todo_modifiers.carbon index 6bfd0c0a09ff..da57f89a9935 100644 --- a/toolchain/check/testdata/class/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/class/fail_todo_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_todo_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_todo_modifiers.carbon class Access { @@ -112,21 +116,21 @@ abstract class Abstract { // CHECK:STDOUT: class @Access { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc25_18.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_18.2: type = converted %int.make_type_32.loc25, %.loc25_18.1 [template = i32] -// CHECK:STDOUT: %.loc25_16: = field_decl k, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc31: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc31_20.1: type = value_of_initializer %int.make_type_32.loc31 [template = i32] -// CHECK:STDOUT: %.loc31_20.2: type = converted %int.make_type_32.loc31, %.loc31_20.1 [template = i32] -// CHECK:STDOUT: %.loc31_18: = field_decl l, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc29_18.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_18.2: type = converted %int.make_type_32.loc29, %.loc29_18.1 [template = i32] +// CHECK:STDOUT: %.loc29_16: = field_decl k, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc35: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc35_20.1: type = value_of_initializer %int.make_type_32.loc35 [template = i32] +// CHECK:STDOUT: %.loc35_20.2: type = converted %int.make_type_32.loc35, %.loc35_20.1 [template = i32] +// CHECK:STDOUT: %.loc35_18: = field_decl l, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Access // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .k = %.loc25_16 -// CHECK:STDOUT: .l = %.loc31_18 +// CHECK:STDOUT: .k = %.loc29_16 +// CHECK:STDOUT: .l = %.loc35_18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { diff --git a/toolchain/check/testdata/class/fail_unbound_field.carbon b/toolchain/check/testdata/class/fail_unbound_field.carbon index 6fd9e711bcf2..1a68a95e8597 100644 --- a/toolchain/check/testdata/class/fail_unbound_field.carbon +++ b/toolchain/check/testdata/class/fail_unbound_field.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_unbound_field.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_unbound_field.carbon class Class { var field: i32; @@ -50,27 +54,27 @@ fn G() -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32] +// CHECK:STDOUT: %.loc22_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_11.2: type = converted %int.make_type_32, %.loc22_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_14.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_14.2: type = converted %int.make_type_32.loc8, %.loc8_14.1 [template = i32] -// CHECK:STDOUT: %.loc8_12: = field_decl field, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_14.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_14.2: type = converted %int.make_type_32.loc12, %.loc12_14.1 [template = i32] +// CHECK:STDOUT: %.loc12_12: = field_decl field, element0 [template] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .field = %.loc8_12 +// CHECK:STDOUT: .field = %.loc12_12 // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: @@ -78,14 +82,14 @@ fn G() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8_12 [template = @Class.%.loc8_12] +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc12_12 [template = @Class.%.loc12_12] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc8_12 [template = @Class.%.loc8_12] +// CHECK:STDOUT: %field.ref: = name_ref field, @Class.%.loc12_12 [template = @Class.%.loc12_12] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/fail_unknown_member.carbon b/toolchain/check/testdata/class/fail_unknown_member.carbon index 87fdb0242390..42def61ad49f 100644 --- a/toolchain/check/testdata/class/fail_unknown_member.carbon +++ b/toolchain/check/testdata/class/fail_unknown_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/fail_unknown_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/fail_unknown_member.carbon class Class { var n: i32; @@ -42,24 +46,24 @@ fn G(c: Class) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %Class.ref: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc11_6.1: Class = param c -// CHECK:STDOUT: @G.%c: Class = bind_name c, %c.loc11_6.1 +// CHECK:STDOUT: %c.loc15_6.1: Class = param c +// CHECK:STDOUT: @G.%c: Class = bind_name c, %c.loc15_6.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %.loc15_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_19.2: type = converted %int.make_type_32, %.loc15_19.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl n, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .n = %.loc8_8 +// CHECK:STDOUT: .n = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/class/field_access.carbon b/toolchain/check/testdata/class/field_access.carbon index 8ecf3f950a46..f0187dbf6a8d 100644 --- a/toolchain/check/testdata/class/field_access.carbon +++ b/toolchain/check/testdata/class/field_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/field_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/field_access.carbon class Class { var j: i32; @@ -49,19 +53,19 @@ fn Run() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl j, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl k, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc8_8 -// CHECK:STDOUT: .k = %.loc9_8 +// CHECK:STDOUT: .j = %.loc12_8 +// CHECK:STDOUT: .k = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -71,36 +75,36 @@ fn Run() { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %c.var: ref Class = var c // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var -// CHECK:STDOUT: %c.ref.loc14: ref Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] -// CHECK:STDOUT: %.loc14_4: ref i32 = class_element_access %c.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: assign %.loc14_4, %.loc14_9 -// CHECK:STDOUT: %c.ref.loc15: ref Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] -// CHECK:STDOUT: %.loc15_4: ref i32 = class_element_access %c.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_9: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc15_4, %.loc15_9 -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32.loc16, %.loc16_11.1 [template = i32] +// CHECK:STDOUT: %c.ref.loc18: ref Class = name_ref c, %c +// CHECK:STDOUT: %j.ref.loc18: = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] +// CHECK:STDOUT: %.loc18_4: ref i32 = class_element_access %c.ref.loc18, element0 +// CHECK:STDOUT: %.loc18_9: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: assign %.loc18_4, %.loc18_9 +// CHECK:STDOUT: %c.ref.loc19: ref Class = name_ref c, %c +// CHECK:STDOUT: %k.ref.loc19: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] +// CHECK:STDOUT: %.loc19_4: ref i32 = class_element_access %c.ref.loc19, element1 +// CHECK:STDOUT: %.loc19_9: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: assign %.loc19_4, %.loc19_9 +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_11.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_11.2: type = converted %int.make_type_32.loc20, %.loc20_11.1 [template = i32] // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var -// CHECK:STDOUT: %c.ref.loc16: ref Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc16: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] -// CHECK:STDOUT: %.loc16_18.1: ref i32 = class_element_access %c.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_18.2: i32 = bind_value %.loc16_18.1 -// CHECK:STDOUT: assign %cj.var, %.loc16_18.2 -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] +// CHECK:STDOUT: %c.ref.loc20: ref Class = name_ref c, %c +// CHECK:STDOUT: %j.ref.loc20: = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] +// CHECK:STDOUT: %.loc20_18.1: ref i32 = class_element_access %c.ref.loc20, element0 +// CHECK:STDOUT: %.loc20_18.2: i32 = bind_value %.loc20_18.1 +// CHECK:STDOUT: assign %cj.var, %.loc20_18.2 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_11.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_11.2: type = converted %int.make_type_32.loc21, %.loc21_11.1 [template = i32] // CHECK:STDOUT: %ck.var: ref i32 = var ck // CHECK:STDOUT: %ck: ref i32 = bind_name ck, %ck.var -// CHECK:STDOUT: %c.ref.loc17: ref Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc17: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] -// CHECK:STDOUT: %.loc17_18.1: ref i32 = class_element_access %c.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_18.2: i32 = bind_value %.loc17_18.1 -// CHECK:STDOUT: assign %ck.var, %.loc17_18.2 +// CHECK:STDOUT: %c.ref.loc21: ref Class = name_ref c, %c +// CHECK:STDOUT: %k.ref.loc21: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] +// CHECK:STDOUT: %.loc21_18.1: ref i32 = class_element_access %c.ref.loc21, element1 +// CHECK:STDOUT: %.loc21_18.2: i32 = bind_value %.loc21_18.1 +// CHECK:STDOUT: assign %ck.var, %.loc21_18.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/field_access_in_value.carbon b/toolchain/check/testdata/class/field_access_in_value.carbon index 37da2f757934..6edc846f6ffc 100644 --- a/toolchain/check/testdata/class/field_access_in_value.carbon +++ b/toolchain/check/testdata/class/field_access_in_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/field_access_in_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/field_access_in_value.carbon class Class { var j: i32; @@ -50,62 +54,62 @@ fn Test() { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl j, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl k, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl j, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl k, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .j = %.loc8_8 -// CHECK:STDOUT: .k = %.loc9_8 +// CHECK:STDOUT: .j = %.loc12_8 +// CHECK:STDOUT: .k = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Class.ref.loc13: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc17: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %cv.var: ref Class = var cv // CHECK:STDOUT: %cv: ref Class = bind_name cv, %cv.var -// CHECK:STDOUT: %cv.ref.loc14: ref Class = name_ref cv, %cv -// CHECK:STDOUT: %j.ref.loc14: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] -// CHECK:STDOUT: %.loc14_5: ref i32 = class_element_access %cv.ref.loc14, element0 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: assign %.loc14_5, %.loc14_10 -// CHECK:STDOUT: %cv.ref.loc15: ref Class = name_ref cv, %cv -// CHECK:STDOUT: %k.ref.loc15: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] -// CHECK:STDOUT: %.loc15_5: ref i32 = class_element_access %cv.ref.loc15, element1 -// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: assign %.loc15_5, %.loc15_10 -// CHECK:STDOUT: %Class.ref.loc16: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %cv.ref.loc16: ref Class = name_ref cv, %cv -// CHECK:STDOUT: %.loc16: Class = bind_value %cv.ref.loc16 -// CHECK:STDOUT: %c: Class = bind_name c, %.loc16 -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] +// CHECK:STDOUT: %cv.ref.loc18: ref Class = name_ref cv, %cv +// CHECK:STDOUT: %j.ref.loc18: = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] +// CHECK:STDOUT: %.loc18_5: ref i32 = class_element_access %cv.ref.loc18, element0 +// CHECK:STDOUT: %.loc18_10: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: assign %.loc18_5, %.loc18_10 +// CHECK:STDOUT: %cv.ref.loc19: ref Class = name_ref cv, %cv +// CHECK:STDOUT: %k.ref.loc19: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] +// CHECK:STDOUT: %.loc19_5: ref i32 = class_element_access %cv.ref.loc19, element1 +// CHECK:STDOUT: %.loc19_10: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: assign %.loc19_5, %.loc19_10 +// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, file.%Class.decl [template = constants.%Class] +// CHECK:STDOUT: %cv.ref.loc20: ref Class = name_ref cv, %cv +// CHECK:STDOUT: %.loc20: Class = bind_value %cv.ref.loc20 +// CHECK:STDOUT: %c: Class = bind_name c, %.loc20 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_11.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_11.2: type = converted %int.make_type_32.loc21, %.loc21_11.1 [template = i32] // CHECK:STDOUT: %cj.var: ref i32 = var cj // CHECK:STDOUT: %cj: ref i32 = bind_name cj, %cj.var -// CHECK:STDOUT: %c.ref.loc17: Class = name_ref c, %c -// CHECK:STDOUT: %j.ref.loc17: = name_ref j, @Class.%.loc8_8 [template = @Class.%.loc8_8] -// CHECK:STDOUT: %.loc17_18.1: ref i32 = class_element_access %c.ref.loc17, element0 -// CHECK:STDOUT: %.loc17_18.2: i32 = bind_value %.loc17_18.1 -// CHECK:STDOUT: assign %cj.var, %.loc17_18.2 -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32.loc18, %.loc18_11.1 [template = i32] +// CHECK:STDOUT: %c.ref.loc21: Class = name_ref c, %c +// CHECK:STDOUT: %j.ref.loc21: = name_ref j, @Class.%.loc12_8 [template = @Class.%.loc12_8] +// CHECK:STDOUT: %.loc21_18.1: ref i32 = class_element_access %c.ref.loc21, element0 +// CHECK:STDOUT: %.loc21_18.2: i32 = bind_value %.loc21_18.1 +// CHECK:STDOUT: assign %cj.var, %.loc21_18.2 +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_11.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_11.2: type = converted %int.make_type_32.loc22, %.loc22_11.1 [template = i32] // CHECK:STDOUT: %ck.var: ref i32 = var ck // CHECK:STDOUT: %ck: ref i32 = bind_name ck, %ck.var -// CHECK:STDOUT: %c.ref.loc18: Class = name_ref c, %c -// CHECK:STDOUT: %k.ref.loc18: = name_ref k, @Class.%.loc9_8 [template = @Class.%.loc9_8] -// CHECK:STDOUT: %.loc18_18.1: ref i32 = class_element_access %c.ref.loc18, element1 -// CHECK:STDOUT: %.loc18_18.2: i32 = bind_value %.loc18_18.1 -// CHECK:STDOUT: assign %ck.var, %.loc18_18.2 +// CHECK:STDOUT: %c.ref.loc22: Class = name_ref c, %c +// CHECK:STDOUT: %k.ref.loc22: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] +// CHECK:STDOUT: %.loc22_18.1: ref i32 = class_element_access %c.ref.loc22, element1 +// CHECK:STDOUT: %.loc22_18.2: i32 = bind_value %.loc22_18.1 +// CHECK:STDOUT: assign %ck.var, %.loc22_18.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/forward_declared.carbon b/toolchain/check/testdata/class/forward_declared.carbon index e143fd47e134..e61b688696ed 100644 --- a/toolchain/check/testdata/class/forward_declared.carbon +++ b/toolchain/check/testdata/class/forward_declared.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/forward_declared.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/forward_declared.carbon class Class; @@ -27,12 +31,12 @@ fn F(p: Class*) -> Class* { return p; } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %Class.ref.loc9_9: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc9_14: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %p.loc9_6.1: Class* = param p -// CHECK:STDOUT: @F.%p: Class* = bind_name p, %p.loc9_6.1 -// CHECK:STDOUT: %Class.ref.loc9_20: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc9_25: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %Class.ref.loc13_9: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc13_14: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %p.loc13_6.1: Class* = param p +// CHECK:STDOUT: @F.%p: Class* = bind_name p, %p.loc13_6.1 +// CHECK:STDOUT: %Class.ref.loc13_20: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc13_25: type = ptr_type Class [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref Class* = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/class/generic.carbon b/toolchain/check/testdata/class/generic.carbon index e71e959821e6..ac9bb0852854 100644 --- a/toolchain/check/testdata/class/generic.carbon +++ b/toolchain/check/testdata/class/generic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic.carbon class C[](); diff --git a/toolchain/check/testdata/class/generic/basic.carbon b/toolchain/check/testdata/class/generic/basic.carbon index a5af5ce44b8f..b851419718e3 100644 --- a/toolchain/check/testdata/class/generic/basic.carbon +++ b/toolchain/check/testdata/class/generic/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/basic.carbon class Class(T:! type) { fn GetAddr[addr self: Self*]() -> T* { @@ -44,55 +48,55 @@ class Class(T:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc7_13.1: type = param T -// CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_13.1: type = param T +// CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %GetAddr.decl: GetAddr = fn_decl @GetAddr [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] -// CHECK:STDOUT: %.loc8_29: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %self.loc8_19.1: Class* = param self -// CHECK:STDOUT: %self.loc8_19.3: Class* = bind_name self, %self.loc8_19.1 -// CHECK:STDOUT: %.loc8_14: Class* = addr_pattern %self.loc8_19.3 -// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8_38: type = ptr_type T [symbolic = constants.%.3] -// CHECK:STDOUT: %return.var.loc8: ref T* = var +// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] +// CHECK:STDOUT: %.loc12_29: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %self.loc12_19.1: Class* = param self +// CHECK:STDOUT: %self.loc12_19.3: Class* = bind_name self, %self.loc12_19.1 +// CHECK:STDOUT: %.loc12_14: Class* = addr_pattern %self.loc12_19.3 +// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc12_38: type = ptr_type T [symbolic = constants.%.3] +// CHECK:STDOUT: %return.var.loc12: ref T* = var // CHECK:STDOUT: } // CHECK:STDOUT: %GetValue.decl: GetValue = fn_decl @GetValue [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] -// CHECK:STDOUT: %self.loc13_15.1: Class = param self -// CHECK:STDOUT: %self.loc13_15.2: Class = bind_name self, %self.loc13_15.1 -// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %return.var.loc13: ref T = var +// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] +// CHECK:STDOUT: %self.loc17_15.1: Class = param self +// CHECK:STDOUT: %self.loc17_15.2: Class = bind_name self, %self.loc17_15.1 +// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %return.var.loc17: ref T = var // CHECK:STDOUT: } -// CHECK:STDOUT: %T.ref.loc17: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc17: = field_decl k, element0 [template] +// CHECK:STDOUT: %T.ref.loc21: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc21: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: .GetAddr = %GetAddr.decl // CHECK:STDOUT: .GetValue = %GetValue.decl -// CHECK:STDOUT: .k = %.loc17 +// CHECK:STDOUT: .k = %.loc21 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @GetAddr[addr @Class.%self.loc8_19.3: Class*]() -> T* { +// CHECK:STDOUT: fn @GetAddr[addr @Class.%self.loc12_19.3: Class*]() -> T* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: Class* = name_ref self, @Class.%self.loc8_19.3 -// CHECK:STDOUT: %.loc9_17.1: ref Class = deref %self.ref -// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc17 [template = @Class.%.loc17] -// CHECK:STDOUT: %.loc9_17.2: ref T = class_element_access %.loc9_17.1, element0 -// CHECK:STDOUT: %.loc9_12: T* = addr_of %.loc9_17.2 -// CHECK:STDOUT: return %.loc9_12 +// CHECK:STDOUT: %self.ref: Class* = name_ref self, @Class.%self.loc12_19.3 +// CHECK:STDOUT: %.loc13_17.1: ref Class = deref %self.ref +// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc21 [template = @Class.%.loc21] +// CHECK:STDOUT: %.loc13_17.2: ref T = class_element_access %.loc13_17.1, element0 +// CHECK:STDOUT: %.loc13_12: T* = addr_of %.loc13_17.2 +// CHECK:STDOUT: return %.loc13_12 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @GetValue[@Class.%self.loc13_15.2: Class]() -> T { +// CHECK:STDOUT: fn @GetValue[@Class.%self.loc17_15.2: Class]() -> T { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: Class = name_ref self, @Class.%self.loc13_15.2 -// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc17 [template = @Class.%.loc17] -// CHECK:STDOUT: %.loc14_16.1: ref T = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc14_16.2: T = bind_value %.loc14_16.1 -// CHECK:STDOUT: return %.loc14_16.2 +// CHECK:STDOUT: %self.ref: Class = name_ref self, @Class.%self.loc17_15.2 +// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc21 [template = @Class.%.loc21] +// CHECK:STDOUT: %.loc18_16.1: ref T = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc18_16.2: T = bind_value %.loc18_16.1 +// CHECK:STDOUT: return %.loc18_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/call.carbon b/toolchain/check/testdata/class/generic/call.carbon index 43b0ecd67cd6..7a71f602f0e1 100644 --- a/toolchain/check/testdata/class/generic/call.carbon +++ b/toolchain/check/testdata/class/generic/call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/call.carbon // --- call.carbon diff --git a/toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon b/toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon index f360eb3ff665..0545d91804dd 100644 --- a/toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon +++ b/toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/fail_todo_member_out_of_line.carbon class Class(T:! type) { fn F(n: T) -> T; @@ -35,26 +39,26 @@ fn Class(T:! type).F(n: T) -> T { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc7_13.1: type = param T -// CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_13.1: type = param T +// CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %T.loc14_10.1: type = param T -// CHECK:STDOUT: %T.loc14_10.2: type = bind_symbolic_name T 0, %T.loc14_10.1 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref.loc14_25: type = name_ref T, %T.loc14_10.2 [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc14_22.1: T = param n -// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc14_22.1 -// CHECK:STDOUT: %T.ref.loc14_31: type = name_ref T, %T.loc14_10.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc18_10.1: type = param T +// CHECK:STDOUT: %T.loc18_10.2: type = bind_symbolic_name T 0, %T.loc18_10.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc18_25: type = name_ref T, %T.loc18_10.2 [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc18_22.1: T = param n +// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc18_22.1 +// CHECK:STDOUT: %T.ref.loc18_31: type = name_ref T, %T.loc18_10.2 [symbolic = constants.%T] // CHECK:STDOUT: @F.%return: ref T = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %T.ref.loc8_11: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc8_8.1: T = param n -// CHECK:STDOUT: %n.loc8_8.2: T = bind_name n, %n.loc8_8.1 -// CHECK:STDOUT: %T.ref.loc8_17: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc12_11: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc12_8.1: T = param n +// CHECK:STDOUT: %n.loc12_8.2: T = bind_name n, %n.loc12_8.1 +// CHECK:STDOUT: %T.ref.loc12_17: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] // CHECK:STDOUT: %return.var: ref T = var // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/fail_todo_use.carbon b/toolchain/check/testdata/class/generic/fail_todo_use.carbon index 9ab5b65f968c..be4f3c0f4d3e 100644 --- a/toolchain/check/testdata/class/generic/fail_todo_use.carbon +++ b/toolchain/check/testdata/class/generic/fail_todo_use.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/fail_todo_use.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/fail_todo_use.carbon class Class(T:! type) { fn Get[addr self: Self*]() -> T* { @@ -51,7 +55,7 @@ fn Run() -> i32 { // CHECK:STDOUT: %struct.3: Int32 = struct_value () [template] // CHECK:STDOUT: %Run: type = fn_type @Run [template] // CHECK:STDOUT: %struct.4: Run = struct_value () [template] -// CHECK:STDOUT: %Class.3: type = class_type @Class, (@Run.%.loc21_15.2) [template] +// CHECK:STDOUT: %Class.3: type = class_type @Class, (@Run.%.loc25_15.2) [template] // CHECK:STDOUT: %.7: i32 = int_literal 0 [template] // CHECK:STDOUT: %.8: type = struct_type {.k: i32} [template] // CHECK:STDOUT: %.9: type = ptr_type Class [template] @@ -65,14 +69,14 @@ fn Run() -> i32 { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc7_13.1: type = param T -// CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_13.1: type = param T +// CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.4] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32, %.loc16_13.1 [template = i32] +// CHECK:STDOUT: %.loc20_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc20_13.2: type = converted %int.make_type_32, %.loc20_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] @@ -81,31 +85,31 @@ fn Run() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %Get.decl: Get = fn_decl @Get [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class.2 [template = constants.%Class.2] -// CHECK:STDOUT: %.loc8_25: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %self.loc8_15.1: Class* = param self -// CHECK:STDOUT: %self.loc8_15.3: Class* = bind_name self, %self.loc8_15.1 -// CHECK:STDOUT: %.loc8_10: Class* = addr_pattern %self.loc8_15.3 -// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8_34: type = ptr_type T [symbolic = constants.%.3] +// CHECK:STDOUT: %.loc12_25: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %self.loc12_15.1: Class* = param self +// CHECK:STDOUT: %self.loc12_15.3: Class* = bind_name self, %self.loc12_15.1 +// CHECK:STDOUT: %.loc12_10: Class* = addr_pattern %self.loc12_15.3 +// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc12_34: type = ptr_type T [symbolic = constants.%.3] // CHECK:STDOUT: %return.var: ref T* = var // CHECK:STDOUT: } -// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %.loc12: = field_decl k, element0 [template] +// CHECK:STDOUT: %T.ref.loc16: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc16: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class.2 // CHECK:STDOUT: .Get = %Get.decl -// CHECK:STDOUT: .k = %.loc12 +// CHECK:STDOUT: .k = %.loc16 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Get[addr @Class.%self.loc8_15.3: Class*]() -> T* { +// CHECK:STDOUT: fn @Get[addr @Class.%self.loc12_15.3: Class*]() -> T* { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref: Class* = name_ref self, @Class.%self.loc8_15.3 -// CHECK:STDOUT: %.loc9_17.1: ref Class = deref %self.ref -// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc12 [template = @Class.%.loc12] -// CHECK:STDOUT: %.loc9_17.2: ref T = class_element_access %.loc9_17.1, element0 -// CHECK:STDOUT: %.loc9_12: T* = addr_of %.loc9_17.2 -// CHECK:STDOUT: return %.loc9_12 +// CHECK:STDOUT: %self.ref: Class* = name_ref self, @Class.%self.loc12_15.3 +// CHECK:STDOUT: %.loc13_17.1: ref Class = deref %self.ref +// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc16 [template = @Class.%.loc16] +// CHECK:STDOUT: %.loc13_17.2: ref T = class_element_access %.loc13_17.1, element0 +// CHECK:STDOUT: %.loc13_12: T* = addr_of %.loc13_17.2 +// CHECK:STDOUT: return %.loc13_12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -114,19 +118,19 @@ fn Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Class.ref: Class = name_ref Class, file.%Class.decl [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc21_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc21_15.2: type = converted %int.make_type_32, %.loc21_15.1 [template = i32] -// CHECK:STDOUT: %Class: type = class_type @Class, (%.loc21_15.2) [template = constants.%Class.3] +// CHECK:STDOUT: %.loc25_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc25_15.2: type = converted %int.make_type_32, %.loc25_15.1 [template = i32] +// CHECK:STDOUT: %Class: type = class_type @Class, (%.loc25_15.2) [template = constants.%Class.3] // CHECK:STDOUT: %v.var: ref Class = var v // CHECK:STDOUT: %v: ref Class = bind_name v, %v.var -// CHECK:STDOUT: %.loc21_29: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_30: {.k: i32} = struct_literal (%.loc21_29) +// CHECK:STDOUT: %.loc25_29: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_30: {.k: i32} = struct_literal (%.loc25_29) // CHECK:STDOUT: assign %v.var, // CHECK:STDOUT: %v.ref: ref Class = name_ref v, %v // CHECK:STDOUT: %Get.ref: Get = name_ref Get, @Class.%Get.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc32_11: = bound_method %v.ref, %Get.ref -// CHECK:STDOUT: %.loc32_10: Class* = addr_of %v.ref -// CHECK:STDOUT: %Get.call: init T* = call %.loc32_11() [template = ] +// CHECK:STDOUT: %.loc36_11: = bound_method %v.ref, %Get.ref +// CHECK:STDOUT: %.loc36_10: Class* = addr_of %v.ref +// CHECK:STDOUT: %Get.call: init T* = call %.loc36_11() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/import.carbon b/toolchain/check/testdata/class/generic/import.carbon index 17d7008fde80..1d05e94421b7 100644 --- a/toolchain/check/testdata/class/generic/import.carbon +++ b/toolchain/check/testdata/class/generic/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/import.carbon // --- foo.carbon diff --git a/toolchain/check/testdata/class/generic/member_inline.carbon b/toolchain/check/testdata/class/generic/member_inline.carbon index e1cf7a65e8fa..c8ebd81ab42f 100644 --- a/toolchain/check/testdata/class/generic/member_inline.carbon +++ b/toolchain/check/testdata/class/generic/member_inline.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/member_inline.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/member_inline.carbon class Class(T:! type) { fn F(n: T) -> T { @@ -30,17 +34,17 @@ class Class(T:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Class.decl: Class = class_decl @Class [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc7_13.1: type = param T -// CHECK:STDOUT: %T.loc7_13.2: type = bind_symbolic_name T 0, %T.loc7_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_13.1: type = param T +// CHECK:STDOUT: %T.loc11_13.2: type = bind_symbolic_name T 0, %T.loc11_13.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %T.ref.loc8_11: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc8_8.1: T = param n -// CHECK:STDOUT: %n.loc8_8.2: T = bind_name n, %n.loc8_8.1 -// CHECK:STDOUT: %T.ref.loc8_17: type = name_ref T, file.%T.loc7_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc12_11: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc12_8.1: T = param n +// CHECK:STDOUT: %n.loc12_8.2: T = bind_name n, %n.loc12_8.1 +// CHECK:STDOUT: %T.ref.loc12_17: type = name_ref T, file.%T.loc11_13.2 [symbolic = constants.%T] // CHECK:STDOUT: %return.var: ref T = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -49,9 +53,9 @@ class Class(T:! type) { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(@Class.%n.loc8_8.2: T) -> T { +// CHECK:STDOUT: fn @F(@Class.%n.loc12_8.2: T) -> T { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: T = name_ref n, @Class.%n.loc8_8.2 +// CHECK:STDOUT: %n.ref: T = name_ref n, @Class.%n.loc12_8.2 // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/generic/redeclare.carbon b/toolchain/check/testdata/class/generic/redeclare.carbon index bb4799dababa..60b3a30da403 100644 --- a/toolchain/check/testdata/class/generic/redeclare.carbon +++ b/toolchain/check/testdata/class/generic/redeclare.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/redeclare.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/redeclare.carbon // --- valid.carbon diff --git a/toolchain/check/testdata/class/import.carbon b/toolchain/check/testdata/class/import.carbon index 8cb3a651fd7e..a0b51ae6e6cf 100644 --- a/toolchain/check/testdata/class/import.carbon +++ b/toolchain/check/testdata/class/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/import_base.carbon b/toolchain/check/testdata/class/import_base.carbon index 13ec028625d1..29468638c7b2 100644 --- a/toolchain/check/testdata/class/import_base.carbon +++ b/toolchain/check/testdata/class/import_base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import_base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_base.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/import_forward_decl.carbon b/toolchain/check/testdata/class/import_forward_decl.carbon index 890e6939d78c..abc53d25b19a 100644 --- a/toolchain/check/testdata/class/import_forward_decl.carbon +++ b/toolchain/check/testdata/class/import_forward_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import_forward_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_forward_decl.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/import_indirect.carbon b/toolchain/check/testdata/class/import_indirect.carbon index 96a810d7cb05..1794dfcab981 100644 --- a/toolchain/check/testdata/class/import_indirect.carbon +++ b/toolchain/check/testdata/class/import_indirect.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import_indirect.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_indirect.carbon // Triangle: // diff --git a/toolchain/check/testdata/class/import_member_cycle.carbon b/toolchain/check/testdata/class/import_member_cycle.carbon index 5737bad160e4..9d769ee5cc5d 100644 --- a/toolchain/check/testdata/class/import_member_cycle.carbon +++ b/toolchain/check/testdata/class/import_member_cycle.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import_member_cycle.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_member_cycle.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/import_struct_cyle.carbon b/toolchain/check/testdata/class/import_struct_cyle.carbon index 72a0dd2f626f..b3292a27d9ad 100644 --- a/toolchain/check/testdata/class/import_struct_cyle.carbon +++ b/toolchain/check/testdata/class/import_struct_cyle.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/import_struct_cyle.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/import_struct_cyle.carbon // --- a.carbon diff --git a/toolchain/check/testdata/class/init.carbon b/toolchain/check/testdata/class/init.carbon index 07f983c1e60b..dfbebbd9c8c8 100644 --- a/toolchain/check/testdata/class/init.carbon +++ b/toolchain/check/testdata/class/init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/init.carbon class Class { var n: i32; @@ -48,47 +52,47 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32.loc12, %.loc12_12.1 [template = i32] -// CHECK:STDOUT: %n.loc12_9.1: i32 = param n -// CHECK:STDOUT: @Make.%n: i32 = bind_name n, %n.loc12_9.1 -// CHECK:STDOUT: %Class.ref.loc12_23: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc12_28: type = ptr_type Class [template = constants.%.3] -// CHECK:STDOUT: %next.loc12_17.1: Class* = param next -// CHECK:STDOUT: @Make.%next: Class* = bind_name next, %next.loc12_17.1 -// CHECK:STDOUT: %Class.ref.loc12_34: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_12.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_12.2: type = converted %int.make_type_32.loc16, %.loc16_12.1 [template = i32] +// CHECK:STDOUT: %n.loc16_9.1: i32 = param n +// CHECK:STDOUT: @Make.%n: i32 = bind_name n, %n.loc16_9.1 +// CHECK:STDOUT: %Class.ref.loc16_23: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc16_28: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %next.loc16_17.1: Class* = param next +// CHECK:STDOUT: @Make.%next: Class* = bind_name next, %next.loc16_17.1 +// CHECK:STDOUT: %Class.ref.loc16_34: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %MakeReorder.decl: MakeReorder = fn_decl @MakeReorder [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16, %.loc16_19.1 [template = i32] -// CHECK:STDOUT: %n.loc16_16.1: i32 = param n -// CHECK:STDOUT: @MakeReorder.%n: i32 = bind_name n, %n.loc16_16.1 -// CHECK:STDOUT: %Class.ref.loc16_30: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc16_35: type = ptr_type Class [template = constants.%.3] -// CHECK:STDOUT: %next.loc16_24.1: Class* = param next -// CHECK:STDOUT: @MakeReorder.%next: Class* = bind_name next, %next.loc16_24.1 -// CHECK:STDOUT: %Class.ref.loc16_41: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_19.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_19.2: type = converted %int.make_type_32.loc20, %.loc20_19.1 [template = i32] +// CHECK:STDOUT: %n.loc20_16.1: i32 = param n +// CHECK:STDOUT: @MakeReorder.%n: i32 = bind_name n, %n.loc20_16.1 +// CHECK:STDOUT: %Class.ref.loc20_30: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc20_35: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %next.loc20_24.1: Class* = param next +// CHECK:STDOUT: @MakeReorder.%next: Class* = bind_name next, %next.loc20_24.1 +// CHECK:STDOUT: %Class.ref.loc20_41: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @MakeReorder.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl n, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl n, element0 [template] // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc9_18: type = ptr_type Class [template = constants.%.3] -// CHECK:STDOUT: %.loc9_11: = field_decl next, element1 [template] +// CHECK:STDOUT: %.loc13_18: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %.loc13_11: = field_decl next, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .n = %.loc8_8 -// CHECK:STDOUT: .next = %.loc9_11 +// CHECK:STDOUT: .n = %.loc12_8 +// CHECK:STDOUT: .next = %.loc13_11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -97,27 +101,27 @@ fn MakeReorder(n: i32, next: Class*) -> Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %next.ref: Class* = name_ref next, %next -// CHECK:STDOUT: %.loc13_31.1: {.n: i32, .next: Class*} = struct_literal (%n.ref, %next.ref) -// CHECK:STDOUT: %.loc13_31.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc13_31.3: init i32 = initialize_from %n.ref to %.loc13_31.2 -// CHECK:STDOUT: %.loc13_31.4: ref Class* = class_element_access %return, element1 -// CHECK:STDOUT: %.loc13_31.5: init Class* = initialize_from %next.ref to %.loc13_31.4 -// CHECK:STDOUT: %.loc13_31.6: init Class = class_init (%.loc13_31.3, %.loc13_31.5), %return -// CHECK:STDOUT: %.loc13_32: init Class = converted %.loc13_31.1, %.loc13_31.6 -// CHECK:STDOUT: return %.loc13_32 to %return -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @MakeReorder(%n: i32, %next: Class*) -> %return: Class { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %next.ref: Class* = name_ref next, %next -// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc17_31.1: {.next: Class*, .n: i32} = struct_literal (%next.ref, %n.ref) -// CHECK:STDOUT: %.loc17_31.2: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc17_31.1: {.n: i32, .next: Class*} = struct_literal (%n.ref, %next.ref) +// CHECK:STDOUT: %.loc17_31.2: ref i32 = class_element_access %return, element0 // CHECK:STDOUT: %.loc17_31.3: init i32 = initialize_from %n.ref to %.loc17_31.2 -// CHECK:STDOUT: %.loc17_31.4: ref Class* = class_element_access %return, element0 +// CHECK:STDOUT: %.loc17_31.4: ref Class* = class_element_access %return, element1 // CHECK:STDOUT: %.loc17_31.5: init Class* = initialize_from %next.ref to %.loc17_31.4 // CHECK:STDOUT: %.loc17_31.6: init Class = class_init (%.loc17_31.3, %.loc17_31.5), %return // CHECK:STDOUT: %.loc17_32: init Class = converted %.loc17_31.1, %.loc17_31.6 // CHECK:STDOUT: return %.loc17_32 to %return // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @MakeReorder(%n: i32, %next: Class*) -> %return: Class { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %next.ref: Class* = name_ref next, %next +// CHECK:STDOUT: %n.ref: i32 = name_ref n, %n +// CHECK:STDOUT: %.loc21_31.1: {.next: Class*, .n: i32} = struct_literal (%next.ref, %n.ref) +// CHECK:STDOUT: %.loc21_31.2: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc21_31.3: init i32 = initialize_from %n.ref to %.loc21_31.2 +// CHECK:STDOUT: %.loc21_31.4: ref Class* = class_element_access %return, element0 +// CHECK:STDOUT: %.loc21_31.5: init Class* = initialize_from %next.ref to %.loc21_31.4 +// CHECK:STDOUT: %.loc21_31.6: init Class = class_init (%.loc21_31.3, %.loc21_31.5), %return +// CHECK:STDOUT: %.loc21_32: init Class = converted %.loc21_31.1, %.loc21_31.6 +// CHECK:STDOUT: return %.loc21_32 to %return +// CHECK:STDOUT: } +// CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_adapt.carbon b/toolchain/check/testdata/class/init_adapt.carbon index 88b848f64f57..0048c42bc404 100644 --- a/toolchain/check/testdata/class/init_adapt.carbon +++ b/toolchain/check/testdata/class/init_adapt.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/init_adapt.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/init_adapt.carbon // --- init_adapt.carbon diff --git a/toolchain/check/testdata/class/init_as.carbon b/toolchain/check/testdata/class/init_as.carbon index 14445b8b4709..c072889eb126 100644 --- a/toolchain/check/testdata/class/init_as.carbon +++ b/toolchain/check/testdata/class/init_as.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/init_as.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/init_as.carbon class Class { var a: i32; @@ -43,47 +47,47 @@ fn F() -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32, %.loc12_11.1 [template = i32] +// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32, %.loc16_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13_17: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_25: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_26.1: {.a: i32, .b: i32} = struct_literal (%.loc13_17, %.loc13_25) +// CHECK:STDOUT: %.loc17_17: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_25: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_26.1: {.a: i32, .b: i32} = struct_literal (%.loc17_17, %.loc17_25) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc13_26.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc13_26.3: ref i32 = class_element_access %.loc13_26.2, element0 -// CHECK:STDOUT: %.loc13_26.4: init i32 = initialize_from %.loc13_17 to %.loc13_26.3 [template = constants.%.4] -// CHECK:STDOUT: %.loc13_26.5: ref i32 = class_element_access %.loc13_26.2, element1 -// CHECK:STDOUT: %.loc13_26.6: init i32 = initialize_from %.loc13_25 to %.loc13_26.5 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_26.7: init Class = class_init (%.loc13_26.4, %.loc13_26.6), %.loc13_26.2 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc13_26.8: ref Class = temporary %.loc13_26.2, %.loc13_26.7 -// CHECK:STDOUT: %.loc13_28: ref Class = converted %.loc13_26.1, %.loc13_26.8 -// CHECK:STDOUT: %a.ref: = name_ref a, @Class.%.loc8_8 [template = @Class.%.loc8_8] -// CHECK:STDOUT: %.loc13_37.1: ref i32 = class_element_access %.loc13_28, element0 -// CHECK:STDOUT: %.loc13_37.2: i32 = bind_value %.loc13_37.1 -// CHECK:STDOUT: return %.loc13_37.2 +// CHECK:STDOUT: %.loc17_26.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc17_26.3: ref i32 = class_element_access %.loc17_26.2, element0 +// CHECK:STDOUT: %.loc17_26.4: init i32 = initialize_from %.loc17_17 to %.loc17_26.3 [template = constants.%.4] +// CHECK:STDOUT: %.loc17_26.5: ref i32 = class_element_access %.loc17_26.2, element1 +// CHECK:STDOUT: %.loc17_26.6: init i32 = initialize_from %.loc17_25 to %.loc17_26.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_26.7: init Class = class_init (%.loc17_26.4, %.loc17_26.6), %.loc17_26.2 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_26.8: ref Class = temporary %.loc17_26.2, %.loc17_26.7 +// CHECK:STDOUT: %.loc17_28: ref Class = converted %.loc17_26.1, %.loc17_26.8 +// CHECK:STDOUT: %a.ref: = name_ref a, @Class.%.loc12_8 [template = @Class.%.loc12_8] +// CHECK:STDOUT: %.loc17_37.1: ref i32 = class_element_access %.loc17_28, element0 +// CHECK:STDOUT: %.loc17_37.2: i32 = bind_value %.loc17_37.1 +// CHECK:STDOUT: return %.loc17_37.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/init_nested.carbon b/toolchain/check/testdata/class/init_nested.carbon index c5c91442f6e0..66069fbe9a8b 100644 --- a/toolchain/check/testdata/class/init_nested.carbon +++ b/toolchain/check/testdata/class/init_nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/init_nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/init_nested.carbon class Inner { var a: i32; @@ -66,31 +70,31 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Outer { -// CHECK:STDOUT: %Inner.ref.loc15: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc15: = field_decl c, element0 [template] -// CHECK:STDOUT: %Inner.ref.loc16: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc16: = field_decl d, element1 [template] +// CHECK:STDOUT: %Inner.ref.loc19: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] +// CHECK:STDOUT: %.loc19: = field_decl c, element0 [template] +// CHECK:STDOUT: %Inner.ref.loc20: type = name_ref Inner, file.%Inner.decl [template = constants.%Inner] +// CHECK:STDOUT: %.loc20: = field_decl d, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Outer -// CHECK:STDOUT: .c = %.loc15 -// CHECK:STDOUT: .d = %.loc16 +// CHECK:STDOUT: .c = %.loc19 +// CHECK:STDOUT: .d = %.loc20 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -99,15 +103,15 @@ fn MakeOuter() -> Outer { // CHECK:STDOUT: // CHECK:STDOUT: fn @MakeOuter() -> %return: Outer { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %MakeInner.ref.loc20_16: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc20_45.1: ref Inner = class_element_access %return, element0 -// CHECK:STDOUT: %MakeInner.call.loc20_25: init Inner = call %MakeInner.ref.loc20_16() to %.loc20_45.1 -// CHECK:STDOUT: %MakeInner.ref.loc20_34: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc20_45.2: ref Inner = class_element_access %return, element1 -// CHECK:STDOUT: %MakeInner.call.loc20_43: init Inner = call %MakeInner.ref.loc20_34() to %.loc20_45.2 -// CHECK:STDOUT: %.loc20_45.3: {.c: Inner, .d: Inner} = struct_literal (%MakeInner.call.loc20_25, %MakeInner.call.loc20_43) -// CHECK:STDOUT: %.loc20_45.4: init Outer = class_init (%MakeInner.call.loc20_25, %MakeInner.call.loc20_43), %return -// CHECK:STDOUT: %.loc20_46: init Outer = converted %.loc20_45.3, %.loc20_45.4 -// CHECK:STDOUT: return %.loc20_46 to %return +// CHECK:STDOUT: %MakeInner.ref.loc24_16: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc24_45.1: ref Inner = class_element_access %return, element0 +// CHECK:STDOUT: %MakeInner.call.loc24_25: init Inner = call %MakeInner.ref.loc24_16() to %.loc24_45.1 +// CHECK:STDOUT: %MakeInner.ref.loc24_34: MakeInner = name_ref MakeInner, file.%MakeInner.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc24_45.2: ref Inner = class_element_access %return, element1 +// CHECK:STDOUT: %MakeInner.call.loc24_43: init Inner = call %MakeInner.ref.loc24_34() to %.loc24_45.2 +// CHECK:STDOUT: %.loc24_45.3: {.c: Inner, .d: Inner} = struct_literal (%MakeInner.call.loc24_25, %MakeInner.call.loc24_43) +// CHECK:STDOUT: %.loc24_45.4: init Outer = class_init (%MakeInner.call.loc24_25, %MakeInner.call.loc24_43), %return +// CHECK:STDOUT: %.loc24_46: init Outer = converted %.loc24_45.3, %.loc24_45.4 +// CHECK:STDOUT: return %.loc24_46 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/method.carbon b/toolchain/check/testdata/class/method.carbon index 87b047539667..afe03cfc8298 100644 --- a/toolchain/check/testdata/class/method.carbon +++ b/toolchain/check/testdata/class/method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/method.carbon class Class { fn F[self: Self]() -> i32; @@ -113,123 +117,123 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc16_12.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc16_12.1 -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc16_29.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_29.2: type = converted %int.make_type_32.loc16, %.loc16_29.1 [template = i32] +// CHECK:STDOUT: %self.loc20_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc20_12.1 +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc20_29.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_29.2: type = converted %int.make_type_32.loc20, %.loc20_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { -// CHECK:STDOUT: %Class.ref.loc20: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc20_9.1: Class = param c -// CHECK:STDOUT: @Call.%c: Class = bind_name c, %c.loc20_9.1 -// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc20_22.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] -// CHECK:STDOUT: %.loc20_22.2: type = converted %int.make_type_32.loc20, %.loc20_22.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc24: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc24_9.1: Class = param c +// CHECK:STDOUT: @Call.%c: Class = bind_name c, %c.loc24_9.1 +// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_22.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] +// CHECK:STDOUT: %.loc24_22.2: type = converted %int.make_type_32.loc24, %.loc24_22.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallAlias.decl: CallAlias = fn_decl @CallAlias [template = constants.%struct.5] { -// CHECK:STDOUT: %Class.ref.loc26: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %c.loc26_14.1: Class = param c -// CHECK:STDOUT: @CallAlias.%c: Class = bind_name c, %c.loc26_14.1 -// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc26_27.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] -// CHECK:STDOUT: %.loc26_27.2: type = converted %int.make_type_32.loc26, %.loc26_27.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc30: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %c.loc30_14.1: Class = param c +// CHECK:STDOUT: @CallAlias.%c: Class = bind_name c, %c.loc30_14.1 +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_27.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_27.2: type = converted %int.make_type_32.loc30, %.loc30_27.1 [template = i32] // CHECK:STDOUT: @CallAlias.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallOnConstBoundMethod.decl: CallOnConstBoundMethod = fn_decl @CallOnConstBoundMethod [template = constants.%struct.6] { -// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc30_32.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] -// CHECK:STDOUT: %.loc30_32.2: type = converted %int.make_type_32.loc30, %.loc30_32.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_32.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_32.2: type = converted %int.make_type_32.loc34, %.loc34_32.1 [template = i32] // CHECK:STDOUT: @CallOnConstBoundMethod.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallWithAddr.decl: CallWithAddr = fn_decl @CallWithAddr [template = constants.%struct.8] { -// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc34_22.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] -// CHECK:STDOUT: %.loc34_22.2: type = converted %int.make_type_32.loc34, %.loc34_22.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc38: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc38_22.1: type = value_of_initializer %int.make_type_32.loc38 [template = i32] +// CHECK:STDOUT: %.loc38_22.2: type = converted %int.make_type_32.loc38, %.loc38_22.1 [template = i32] // CHECK:STDOUT: @CallWithAddr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallFThroughPointer.decl: CallFThroughPointer = fn_decl @CallFThroughPointer [template = constants.%struct.9] { -// CHECK:STDOUT: %Class.ref.loc39: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc39_32: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %p.loc39_24.1: Class* = param p -// CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc39_24.1 -// CHECK:STDOUT: %int.make_type_32.loc39: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc39_38.1: type = value_of_initializer %int.make_type_32.loc39 [template = i32] -// CHECK:STDOUT: %.loc39_38.2: type = converted %int.make_type_32.loc39, %.loc39_38.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc43: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc43_32: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc43_24.1: Class* = param p +// CHECK:STDOUT: @CallFThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 +// CHECK:STDOUT: %int.make_type_32.loc43: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc43_38.1: type = value_of_initializer %int.make_type_32.loc43 [template = i32] +// CHECK:STDOUT: %.loc43_38.2: type = converted %int.make_type_32.loc43, %.loc43_38.1 [template = i32] // CHECK:STDOUT: @CallFThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallGThroughPointer.decl: CallGThroughPointer = fn_decl @CallGThroughPointer [template = constants.%struct.10] { -// CHECK:STDOUT: %Class.ref.loc43: type = name_ref Class, %Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc43_32: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %p.loc43_24.1: Class* = param p -// CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc43_24.1 -// CHECK:STDOUT: %int.make_type_32.loc43: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc43_38.1: type = value_of_initializer %int.make_type_32.loc43 [template = i32] -// CHECK:STDOUT: %.loc43_38.2: type = converted %int.make_type_32.loc43, %.loc43_38.1 [template = i32] +// CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %.loc47_32: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %p.loc47_24.1: Class* = param p +// CHECK:STDOUT: @CallGThroughPointer.%p: Class* = bind_name p, %p.loc47_24.1 +// CHECK:STDOUT: %int.make_type_32.loc47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc47_38.1: type = value_of_initializer %int.make_type_32.loc47 [template = i32] +// CHECK:STDOUT: %.loc47_38.2: type = converted %int.make_type_32.loc47, %.loc47_38.1 [template = i32] // CHECK:STDOUT: @CallGThroughPointer.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.11] { -// CHECK:STDOUT: %Class.ref.loc47: type = name_ref Class, %Class.decl [template = constants.%Class] +// CHECK:STDOUT: %Class.ref.loc51: type = name_ref Class, %Class.decl [template = constants.%Class] // CHECK:STDOUT: @Make.%return: ref Class = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallFOnInitializingExpr.decl: CallFOnInitializingExpr = fn_decl @CallFOnInitializingExpr [template = constants.%struct.12] { -// CHECK:STDOUT: %int.make_type_32.loc49: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc49_33.1: type = value_of_initializer %int.make_type_32.loc49 [template = i32] -// CHECK:STDOUT: %.loc49_33.2: type = converted %int.make_type_32.loc49, %.loc49_33.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_33.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32] +// CHECK:STDOUT: %.loc53_33.2: type = converted %int.make_type_32.loc53, %.loc53_33.1 [template = i32] // CHECK:STDOUT: @CallFOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %CallGOnInitializingExpr.decl: CallGOnInitializingExpr = fn_decl @CallGOnInitializingExpr [template = constants.%struct.13] { -// CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc53_33.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32] -// CHECK:STDOUT: %.loc53_33.2: type = converted %int.make_type_32.loc53, %.loc53_33.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc57: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc57_33.1: type = value_of_initializer %int.make_type_32.loc57 [template = i32] +// CHECK:STDOUT: %.loc57_33.2: type = converted %int.make_type_32.loc57, %.loc57_33.1 [template = i32] // CHECK:STDOUT: @CallGOnInitializingExpr.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc8_8.1: Class = param self -// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32.loc8, %.loc8_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc12_8.1: Class = param self +// CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_25.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_25.2: type = converted %int.make_type_32.loc12, %.loc12_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %self.loc9_13.1: Class* = param self -// CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 -// CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_31.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_31.2: type = converted %int.make_type_32.loc9, %.loc9_31.1 [template = i32] -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc13_23: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %self.loc13_13.1: Class* = param self +// CHECK:STDOUT: %self.loc13_13.3: Class* = bind_name self, %self.loc13_13.1 +// CHECK:STDOUT: %.loc13_8: Class* = addr_pattern %self.loc13_13.3 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13, %.loc13_31.1 [template = i32] +// CHECK:STDOUT: %return.var.loc13: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %F.ref: F = name_ref F, %F.decl [template = constants.%struct.2] // CHECK:STDOUT: %A: F = bind_alias A, %F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] -// CHECK:STDOUT: %.loc13_8: = field_decl k, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32.loc17, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_8: = field_decl k, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: .A = %A -// CHECK:STDOUT: .k = %.loc13_8 +// CHECK:STDOUT: .k = %.loc17_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -237,54 +241,54 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc13_8 [template = @Class.%.loc13_8] -// CHECK:STDOUT: %.loc17_14.1: ref i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc17_14.2: i32 = bind_value %.loc17_14.1 -// CHECK:STDOUT: return %.loc17_14.2 +// CHECK:STDOUT: %k.ref: = name_ref k, @Class.%.loc17_8 [template = @Class.%.loc17_8] +// CHECK:STDOUT: %.loc21_14.1: ref i32 = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc21_14.2: i32 = bind_value %.loc21_14.1 +// CHECK:STDOUT: return %.loc21_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[addr @Class.%self.loc9_13.3: Class*]() -> i32; +// CHECK:STDOUT: fn @G[addr @Class.%self.loc13_13.3: Class*]() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%c: Class) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: Class = name_ref c, %c // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc23_11: = bound_method %c.ref, %F.ref -// CHECK:STDOUT: %F.call: init i32 = call %.loc23_11(%c.ref) -// CHECK:STDOUT: %.loc23_15.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc23_15.2: i32 = converted %F.call, %.loc23_15.1 -// CHECK:STDOUT: return %.loc23_15.2 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @CallAlias(%c: Class) -> i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %c.ref: Class = name_ref c, %c -// CHECK:STDOUT: %A.ref: F = name_ref A, @Class.%A [template = constants.%struct.2] -// CHECK:STDOUT: %.loc27_11: = bound_method %c.ref, %A.ref +// CHECK:STDOUT: %.loc27_11: = bound_method %c.ref, %F.ref // CHECK:STDOUT: %F.call: init i32 = call %.loc27_11(%c.ref) // CHECK:STDOUT: %.loc27_15.1: i32 = value_of_initializer %F.call // CHECK:STDOUT: %.loc27_15.2: i32 = converted %F.call, %.loc27_15.1 // CHECK:STDOUT: return %.loc27_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @CallAlias(%c: Class) -> i32 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %c.ref: Class = name_ref c, %c +// CHECK:STDOUT: %A.ref: F = name_ref A, @Class.%A [template = constants.%struct.2] +// CHECK:STDOUT: %.loc31_11: = bound_method %c.ref, %A.ref +// CHECK:STDOUT: %F.call: init i32 = call %.loc31_11(%c.ref) +// CHECK:STDOUT: %.loc31_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc31_15.2: i32 = converted %F.call, %.loc31_15.1 +// CHECK:STDOUT: return %.loc31_15.2 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @CallOnConstBoundMethod() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc31_17: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc31_18.1: {.k: i32} = struct_literal (%.loc31_17) +// CHECK:STDOUT: %.loc35_17: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc35_18.1: {.k: i32} = struct_literal (%.loc35_17) // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %.loc31_18.2: ref Class = temporary_storage -// CHECK:STDOUT: %.loc31_18.3: ref i32 = class_element_access %.loc31_18.2, element0 -// CHECK:STDOUT: %.loc31_18.4: init i32 = initialize_from %.loc31_17 to %.loc31_18.3 [template = constants.%.6] -// CHECK:STDOUT: %.loc31_18.5: init Class = class_init (%.loc31_18.4), %.loc31_18.2 [template = constants.%struct.7] -// CHECK:STDOUT: %.loc31_18.6: ref Class = temporary %.loc31_18.2, %.loc31_18.5 -// CHECK:STDOUT: %.loc31_20.1: ref Class = converted %.loc31_18.1, %.loc31_18.6 +// CHECK:STDOUT: %.loc35_18.2: ref Class = temporary_storage +// CHECK:STDOUT: %.loc35_18.3: ref i32 = class_element_access %.loc35_18.2, element0 +// CHECK:STDOUT: %.loc35_18.4: init i32 = initialize_from %.loc35_17 to %.loc35_18.3 [template = constants.%.6] +// CHECK:STDOUT: %.loc35_18.5: init Class = class_init (%.loc35_18.4), %.loc35_18.2 [template = constants.%struct.7] +// CHECK:STDOUT: %.loc35_18.6: ref Class = temporary %.loc35_18.2, %.loc35_18.5 +// CHECK:STDOUT: %.loc35_20.1: ref Class = converted %.loc35_18.1, %.loc35_18.6 // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc31_29: = bound_method %.loc31_20.1, %F.ref -// CHECK:STDOUT: %.loc31_20.2: Class = bind_value %.loc31_20.1 -// CHECK:STDOUT: %F.call: init i32 = call %.loc31_29(%.loc31_20.2) -// CHECK:STDOUT: %.loc31_33.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc31_33.2: i32 = converted %F.call, %.loc31_33.1 -// CHECK:STDOUT: return %.loc31_33.2 +// CHECK:STDOUT: %.loc35_29: = bound_method %.loc35_20.1, %F.ref +// CHECK:STDOUT: %.loc35_20.2: Class = bind_value %.loc35_20.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc35_29(%.loc35_20.2) +// CHECK:STDOUT: %.loc35_33.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc35_33.2: i32 = converted %F.call, %.loc35_33.1 +// CHECK:STDOUT: return %.loc35_33.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallWithAddr() -> i32 { @@ -294,38 +298,38 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: %c: ref Class = bind_name c, %c.var // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc36_11: = bound_method %c.ref, %G.ref -// CHECK:STDOUT: %.loc36_10: Class* = addr_of %c.ref -// CHECK:STDOUT: %G.call: init i32 = call %.loc36_11(%.loc36_10) -// CHECK:STDOUT: %.loc36_15.1: i32 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc36_15.2: i32 = converted %G.call, %.loc36_15.1 -// CHECK:STDOUT: return %.loc36_15.2 +// CHECK:STDOUT: %.loc40_11: = bound_method %c.ref, %G.ref +// CHECK:STDOUT: %.loc40_10: Class* = addr_of %c.ref +// CHECK:STDOUT: %G.call: init i32 = call %.loc40_11(%.loc40_10) +// CHECK:STDOUT: %.loc40_15.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc40_15.2: i32 = converted %G.call, %.loc40_15.1 +// CHECK:STDOUT: return %.loc40_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallFThroughPointer(%p: Class*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc40_11.1: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc44_11.1: ref Class = deref %p.ref // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc40_14: = bound_method %.loc40_11.1, %F.ref -// CHECK:STDOUT: %.loc40_11.2: Class = bind_value %.loc40_11.1 -// CHECK:STDOUT: %F.call: init i32 = call %.loc40_14(%.loc40_11.2) -// CHECK:STDOUT: %.loc40_18.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc40_18.2: i32 = converted %F.call, %.loc40_18.1 -// CHECK:STDOUT: return %.loc40_18.2 +// CHECK:STDOUT: %.loc44_14: = bound_method %.loc44_11.1, %F.ref +// CHECK:STDOUT: %.loc44_11.2: Class = bind_value %.loc44_11.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc44_14(%.loc44_11.2) +// CHECK:STDOUT: %.loc44_18.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc44_18.2: i32 = converted %F.call, %.loc44_18.1 +// CHECK:STDOUT: return %.loc44_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallGThroughPointer(%p: Class*) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: Class* = name_ref p, %p -// CHECK:STDOUT: %.loc44_11.1: ref Class = deref %p.ref +// CHECK:STDOUT: %.loc48_11.1: ref Class = deref %p.ref // CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc44_14: = bound_method %.loc44_11.1, %G.ref -// CHECK:STDOUT: %.loc44_11.2: Class* = addr_of %.loc44_11.1 -// CHECK:STDOUT: %G.call: init i32 = call %.loc44_14(%.loc44_11.2) -// CHECK:STDOUT: %.loc44_18.1: i32 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc44_18.2: i32 = converted %G.call, %.loc44_18.1 -// CHECK:STDOUT: return %.loc44_18.2 +// CHECK:STDOUT: %.loc48_14: = bound_method %.loc48_11.1, %G.ref +// CHECK:STDOUT: %.loc48_11.2: Class* = addr_of %.loc48_11.1 +// CHECK:STDOUT: %G.call: init i32 = call %.loc48_14(%.loc48_11.2) +// CHECK:STDOUT: %.loc48_18.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc48_18.2: i32 = converted %G.call, %.loc48_18.1 +// CHECK:STDOUT: return %.loc48_18.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Make() -> Class; @@ -333,30 +337,30 @@ fn CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: fn @CallFOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.11] -// CHECK:STDOUT: %.loc50_14.1: ref Class = temporary_storage -// CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc50_14.1 -// CHECK:STDOUT: %.loc50_14.2: ref Class = temporary %.loc50_14.1, %Make.call +// CHECK:STDOUT: %.loc54_14.1: ref Class = temporary_storage +// CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc54_14.1 +// CHECK:STDOUT: %.loc54_14.2: ref Class = temporary %.loc54_14.1, %Make.call // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc50_16: = bound_method %.loc50_14.2, %F.ref -// CHECK:STDOUT: %.loc50_14.3: Class = bind_value %.loc50_14.2 -// CHECK:STDOUT: %F.call: init i32 = call %.loc50_16(%.loc50_14.3) -// CHECK:STDOUT: %.loc50_20.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc50_20.2: i32 = converted %F.call, %.loc50_20.1 -// CHECK:STDOUT: return %.loc50_20.2 +// CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.2, %F.ref +// CHECK:STDOUT: %.loc54_14.3: Class = bind_value %.loc54_14.2 +// CHECK:STDOUT: %F.call: init i32 = call %.loc54_16(%.loc54_14.3) +// CHECK:STDOUT: %.loc54_20.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc54_20.2: i32 = converted %F.call, %.loc54_20.1 +// CHECK:STDOUT: return %.loc54_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @CallGOnInitializingExpr() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Make.ref: Make = name_ref Make, file.%Make.decl [template = constants.%struct.11] -// CHECK:STDOUT: %.loc54_14.1: ref Class = temporary_storage -// CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc54_14.1 -// CHECK:STDOUT: %.loc54_14.2: ref Class = temporary %.loc54_14.1, %Make.call +// CHECK:STDOUT: %.loc58_14.1: ref Class = temporary_storage +// CHECK:STDOUT: %Make.call: init Class = call %Make.ref() to %.loc58_14.1 +// CHECK:STDOUT: %.loc58_14.2: ref Class = temporary %.loc58_14.1, %Make.call // CHECK:STDOUT: %G.ref: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc54_16: = bound_method %.loc54_14.2, %G.ref -// CHECK:STDOUT: %.loc54_14.3: Class* = addr_of %.loc54_14.2 -// CHECK:STDOUT: %G.call: init i32 = call %.loc54_16(%.loc54_14.3) -// CHECK:STDOUT: %.loc54_20.1: i32 = value_of_initializer %G.call -// CHECK:STDOUT: %.loc54_20.2: i32 = converted %G.call, %.loc54_20.1 -// CHECK:STDOUT: return %.loc54_20.2 +// CHECK:STDOUT: %.loc58_16: = bound_method %.loc58_14.2, %G.ref +// CHECK:STDOUT: %.loc58_14.3: Class* = addr_of %.loc58_14.2 +// CHECK:STDOUT: %G.call: init i32 = call %.loc58_16(%.loc58_14.3) +// CHECK:STDOUT: %.loc58_20.1: i32 = value_of_initializer %G.call +// CHECK:STDOUT: %.loc58_20.2: i32 = converted %G.call, %.loc58_20.1 +// CHECK:STDOUT: return %.loc58_20.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested.carbon b/toolchain/check/testdata/class/nested.carbon index 9430d5164bc7..ca5cfe0df2b1 100644 --- a/toolchain/check/testdata/class/nested.carbon +++ b/toolchain/check/testdata/class/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/nested.carbon class Outer { fn F() { @@ -81,9 +85,9 @@ fn F(a: Outer*) { // CHECK:STDOUT: %Outer.decl: type = class_decl @Outer [template = constants.%Outer] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, %Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc37: type = ptr_type Outer [template = constants.%.4] -// CHECK:STDOUT: %a.loc37_6.1: Outer* = param a -// CHECK:STDOUT: @F.2.%a: Outer* = bind_name a, %a.loc37_6.1 +// CHECK:STDOUT: %.loc41: type = ptr_type Outer [template = constants.%.4] +// CHECK:STDOUT: %a.loc41_6.1: Outer* = param a +// CHECK:STDOUT: @F.2.%a: Outer* = bind_name a, %a.loc41_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -92,42 +96,42 @@ fn F(a: Outer*) { // CHECK:STDOUT: %Inner.decl: type = class_decl @Inner [template = constants.%Inner] {} // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] {} // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Outer [template = constants.%Outer] -// CHECK:STDOUT: %.loc32_15: type = ptr_type Outer [template = constants.%.4] -// CHECK:STDOUT: %.loc32_9: = field_decl po, element0 [template] +// CHECK:STDOUT: %.loc36_15: type = ptr_type Outer [template = constants.%.4] +// CHECK:STDOUT: %.loc36_9: = field_decl po, element0 [template] // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc33_16: type = ptr_type Outer [template = constants.%.4] -// CHECK:STDOUT: %.loc33_9: = field_decl qo, element1 [template] +// CHECK:STDOUT: %.loc37_16: type = ptr_type Outer [template = constants.%.4] +// CHECK:STDOUT: %.loc37_9: = field_decl qo, element1 [template] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, %Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc34_16: type = ptr_type Inner [template = constants.%.2] -// CHECK:STDOUT: %.loc34_9: = field_decl pi, element2 [template] +// CHECK:STDOUT: %.loc38_16: type = ptr_type Inner [template = constants.%.2] +// CHECK:STDOUT: %.loc38_9: = field_decl pi, element2 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Outer // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .Inner = %Inner.decl // CHECK:STDOUT: .H = %H.decl -// CHECK:STDOUT: .po = %.loc32_9 -// CHECK:STDOUT: .qo = %.loc33_9 -// CHECK:STDOUT: .pi = %.loc34_9 +// CHECK:STDOUT: .po = %.loc36_9 +// CHECK:STDOUT: .qo = %.loc37_9 +// CHECK:STDOUT: .pi = %.loc38_9 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Inner [template = constants.%Inner] -// CHECK:STDOUT: %.loc15_17: type = ptr_type Inner [template = constants.%.2] -// CHECK:STDOUT: %.loc15_11: = field_decl pi, element0 [template] +// CHECK:STDOUT: %.loc19_17: type = ptr_type Inner [template = constants.%.2] +// CHECK:STDOUT: %.loc19_11: = field_decl pi, element0 [template] // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %.loc16_18: type = ptr_type Outer [template = constants.%.4] -// CHECK:STDOUT: %.loc16_11: = field_decl po, element1 [template] +// CHECK:STDOUT: %.loc20_18: type = ptr_type Outer [template = constants.%.4] +// CHECK:STDOUT: %.loc20_11: = field_decl po, element1 [template] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc17_18: type = ptr_type Inner [template = constants.%.2] -// CHECK:STDOUT: %.loc17_11: = field_decl qi, element2 [template] +// CHECK:STDOUT: %.loc21_18: type = ptr_type Inner [template = constants.%.2] +// CHECK:STDOUT: %.loc21_11: = field_decl qi, element2 [template] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner -// CHECK:STDOUT: .pi = %.loc15_11 -// CHECK:STDOUT: .po = %.loc16_11 -// CHECK:STDOUT: .qi = %.loc17_11 +// CHECK:STDOUT: .pi = %.loc19_11 +// CHECK:STDOUT: .po = %.loc20_11 +// CHECK:STDOUT: .qi = %.loc21_11 // CHECK:STDOUT: .G = %G.decl // CHECK:STDOUT: } // CHECK:STDOUT: @@ -168,61 +172,61 @@ fn F(a: Outer*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Outer.ref: type = name_ref Outer, file.%Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %.loc38_21: type = ptr_type Inner [template = constants.%.2] -// CHECK:STDOUT: %a.ref.loc38: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc38_26: ref Outer = deref %a.ref.loc38 -// CHECK:STDOUT: %pi.ref.loc38: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] -// CHECK:STDOUT: %.loc38_29.1: ref Inner* = class_element_access %.loc38_26, element2 -// CHECK:STDOUT: %.loc38_29.2: Inner* = bind_value %.loc38_29.1 -// CHECK:STDOUT: %b: Inner* = bind_name b, %.loc38_29.2 -// CHECK:STDOUT: %a.ref.loc40_3: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc40_4.1: ref Outer = deref %a.ref.loc40_3 -// CHECK:STDOUT: %po.ref.loc40: = name_ref po, @Outer.%.loc32_9 [template = @Outer.%.loc32_9] -// CHECK:STDOUT: %.loc40_4.2: ref Outer* = class_element_access %.loc40_4.1, element0 -// CHECK:STDOUT: %a.ref.loc40_11: Outer* = name_ref a, %a -// CHECK:STDOUT: assign %.loc40_4.2, %a.ref.loc40_11 -// CHECK:STDOUT: %a.ref.loc41_3: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc41_4.1: ref Outer = deref %a.ref.loc41_3 -// CHECK:STDOUT: %qo.ref: = name_ref qo, @Outer.%.loc33_9 [template = @Outer.%.loc33_9] -// CHECK:STDOUT: %.loc41_4.2: ref Outer* = class_element_access %.loc41_4.1, element1 -// CHECK:STDOUT: %a.ref.loc41_11: Outer* = name_ref a, %a -// CHECK:STDOUT: assign %.loc41_4.2, %a.ref.loc41_11 -// CHECK:STDOUT: %a.ref.loc42_3: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc42_4.1: ref Outer = deref %a.ref.loc42_3 -// CHECK:STDOUT: %pi.ref.loc42_4: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] -// CHECK:STDOUT: %.loc42_4.2: ref Inner* = class_element_access %.loc42_4.1, element2 -// CHECK:STDOUT: %a.ref.loc42_11: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc42_12.1: ref Outer = deref %a.ref.loc42_11 -// CHECK:STDOUT: %pi.ref.loc42_12: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] -// CHECK:STDOUT: %.loc42_12.2: ref Inner* = class_element_access %.loc42_12.1, element2 -// CHECK:STDOUT: %.loc42_12.3: Inner* = bind_value %.loc42_12.2 -// CHECK:STDOUT: assign %.loc42_4.2, %.loc42_12.3 -// CHECK:STDOUT: %b.ref.loc43: Inner* = name_ref b, %b -// CHECK:STDOUT: %.loc43_4.1: ref Inner = deref %b.ref.loc43 -// CHECK:STDOUT: %po.ref.loc43: = name_ref po, @Inner.%.loc16_11 [template = @Inner.%.loc16_11] -// CHECK:STDOUT: %.loc43_4.2: ref Outer* = class_element_access %.loc43_4.1, element1 -// CHECK:STDOUT: %a.ref.loc43: Outer* = name_ref a, %a -// CHECK:STDOUT: assign %.loc43_4.2, %a.ref.loc43 -// CHECK:STDOUT: %b.ref.loc44: Inner* = name_ref b, %b -// CHECK:STDOUT: %.loc44_4.1: ref Inner = deref %b.ref.loc44 -// CHECK:STDOUT: %pi.ref.loc44_4: = name_ref pi, @Inner.%.loc15_11 [template = @Inner.%.loc15_11] -// CHECK:STDOUT: %.loc44_4.2: ref Inner* = class_element_access %.loc44_4.1, element0 -// CHECK:STDOUT: %a.ref.loc44: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc44_12.1: ref Outer = deref %a.ref.loc44 -// CHECK:STDOUT: %pi.ref.loc44_12: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] -// CHECK:STDOUT: %.loc44_12.2: ref Inner* = class_element_access %.loc44_12.1, element2 -// CHECK:STDOUT: %.loc44_12.3: Inner* = bind_value %.loc44_12.2 -// CHECK:STDOUT: assign %.loc44_4.2, %.loc44_12.3 -// CHECK:STDOUT: %b.ref.loc45: Inner* = name_ref b, %b -// CHECK:STDOUT: %.loc45_4.1: ref Inner = deref %b.ref.loc45 -// CHECK:STDOUT: %qi.ref: = name_ref qi, @Inner.%.loc17_11 [template = @Inner.%.loc17_11] -// CHECK:STDOUT: %.loc45_4.2: ref Inner* = class_element_access %.loc45_4.1, element2 -// CHECK:STDOUT: %a.ref.loc45: Outer* = name_ref a, %a -// CHECK:STDOUT: %.loc45_12.1: ref Outer = deref %a.ref.loc45 -// CHECK:STDOUT: %pi.ref.loc45: = name_ref pi, @Outer.%.loc34_9 [template = @Outer.%.loc34_9] -// CHECK:STDOUT: %.loc45_12.2: ref Inner* = class_element_access %.loc45_12.1, element2 -// CHECK:STDOUT: %.loc45_12.3: Inner* = bind_value %.loc45_12.2 -// CHECK:STDOUT: assign %.loc45_4.2, %.loc45_12.3 +// CHECK:STDOUT: %.loc42_21: type = ptr_type Inner [template = constants.%.2] +// CHECK:STDOUT: %a.ref.loc42: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc42_26: ref Outer = deref %a.ref.loc42 +// CHECK:STDOUT: %pi.ref.loc42: = name_ref pi, @Outer.%.loc38_9 [template = @Outer.%.loc38_9] +// CHECK:STDOUT: %.loc42_29.1: ref Inner* = class_element_access %.loc42_26, element2 +// CHECK:STDOUT: %.loc42_29.2: Inner* = bind_value %.loc42_29.1 +// CHECK:STDOUT: %b: Inner* = bind_name b, %.loc42_29.2 +// CHECK:STDOUT: %a.ref.loc44_3: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc44_4.1: ref Outer = deref %a.ref.loc44_3 +// CHECK:STDOUT: %po.ref.loc44: = name_ref po, @Outer.%.loc36_9 [template = @Outer.%.loc36_9] +// CHECK:STDOUT: %.loc44_4.2: ref Outer* = class_element_access %.loc44_4.1, element0 +// CHECK:STDOUT: %a.ref.loc44_11: Outer* = name_ref a, %a +// CHECK:STDOUT: assign %.loc44_4.2, %a.ref.loc44_11 +// CHECK:STDOUT: %a.ref.loc45_3: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc45_4.1: ref Outer = deref %a.ref.loc45_3 +// CHECK:STDOUT: %qo.ref: = name_ref qo, @Outer.%.loc37_9 [template = @Outer.%.loc37_9] +// CHECK:STDOUT: %.loc45_4.2: ref Outer* = class_element_access %.loc45_4.1, element1 +// CHECK:STDOUT: %a.ref.loc45_11: Outer* = name_ref a, %a +// CHECK:STDOUT: assign %.loc45_4.2, %a.ref.loc45_11 +// CHECK:STDOUT: %a.ref.loc46_3: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc46_4.1: ref Outer = deref %a.ref.loc46_3 +// CHECK:STDOUT: %pi.ref.loc46_4: = name_ref pi, @Outer.%.loc38_9 [template = @Outer.%.loc38_9] +// CHECK:STDOUT: %.loc46_4.2: ref Inner* = class_element_access %.loc46_4.1, element2 +// CHECK:STDOUT: %a.ref.loc46_11: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc46_12.1: ref Outer = deref %a.ref.loc46_11 +// CHECK:STDOUT: %pi.ref.loc46_12: = name_ref pi, @Outer.%.loc38_9 [template = @Outer.%.loc38_9] +// CHECK:STDOUT: %.loc46_12.2: ref Inner* = class_element_access %.loc46_12.1, element2 +// CHECK:STDOUT: %.loc46_12.3: Inner* = bind_value %.loc46_12.2 +// CHECK:STDOUT: assign %.loc46_4.2, %.loc46_12.3 +// CHECK:STDOUT: %b.ref.loc47: Inner* = name_ref b, %b +// CHECK:STDOUT: %.loc47_4.1: ref Inner = deref %b.ref.loc47 +// CHECK:STDOUT: %po.ref.loc47: = name_ref po, @Inner.%.loc20_11 [template = @Inner.%.loc20_11] +// CHECK:STDOUT: %.loc47_4.2: ref Outer* = class_element_access %.loc47_4.1, element1 +// CHECK:STDOUT: %a.ref.loc47: Outer* = name_ref a, %a +// CHECK:STDOUT: assign %.loc47_4.2, %a.ref.loc47 +// CHECK:STDOUT: %b.ref.loc48: Inner* = name_ref b, %b +// CHECK:STDOUT: %.loc48_4.1: ref Inner = deref %b.ref.loc48 +// CHECK:STDOUT: %pi.ref.loc48_4: = name_ref pi, @Inner.%.loc19_11 [template = @Inner.%.loc19_11] +// CHECK:STDOUT: %.loc48_4.2: ref Inner* = class_element_access %.loc48_4.1, element0 +// CHECK:STDOUT: %a.ref.loc48: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc48_12.1: ref Outer = deref %a.ref.loc48 +// CHECK:STDOUT: %pi.ref.loc48_12: = name_ref pi, @Outer.%.loc38_9 [template = @Outer.%.loc38_9] +// CHECK:STDOUT: %.loc48_12.2: ref Inner* = class_element_access %.loc48_12.1, element2 +// CHECK:STDOUT: %.loc48_12.3: Inner* = bind_value %.loc48_12.2 +// CHECK:STDOUT: assign %.loc48_4.2, %.loc48_12.3 +// CHECK:STDOUT: %b.ref.loc49: Inner* = name_ref b, %b +// CHECK:STDOUT: %.loc49_4.1: ref Inner = deref %b.ref.loc49 +// CHECK:STDOUT: %qi.ref: = name_ref qi, @Inner.%.loc21_11 [template = @Inner.%.loc21_11] +// CHECK:STDOUT: %.loc49_4.2: ref Inner* = class_element_access %.loc49_4.1, element2 +// CHECK:STDOUT: %a.ref.loc49: Outer* = name_ref a, %a +// CHECK:STDOUT: %.loc49_12.1: ref Outer = deref %a.ref.loc49 +// CHECK:STDOUT: %pi.ref.loc49: = name_ref pi, @Outer.%.loc38_9 [template = @Outer.%.loc38_9] +// CHECK:STDOUT: %.loc49_12.2: ref Inner* = class_element_access %.loc49_12.1, element2 +// CHECK:STDOUT: %.loc49_12.3: Inner* = bind_value %.loc49_12.2 +// CHECK:STDOUT: assign %.loc49_4.2, %.loc49_12.3 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/nested_name.carbon b/toolchain/check/testdata/class/nested_name.carbon index 070d98d31ab4..06d85e66da16 100644 --- a/toolchain/check/testdata/class/nested_name.carbon +++ b/toolchain/check/testdata/class/nested_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/nested_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/nested_name.carbon class Outer { class Inner { @@ -49,19 +53,19 @@ fn G(o: Outer) { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Outer.ref.loc13: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: %Outer.ref.loc17: type = name_ref Outer, %Outer.decl [template = constants.%Outer] // CHECK:STDOUT: %Inner.ref: type = name_ref Inner, @Outer.%Inner.decl [template = constants.%Inner] -// CHECK:STDOUT: %oi.loc13_6.1: Inner = param oi -// CHECK:STDOUT: @F.%oi: Inner = bind_name oi, %oi.loc13_6.1 +// CHECK:STDOUT: %oi.loc17_6.1: Inner = param oi +// CHECK:STDOUT: @F.%oi: Inner = bind_name oi, %oi.loc17_6.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_26.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc13_26.2: type = converted %int.make_type_32, %.loc13_26.1 [template = i32] +// CHECK:STDOUT: %.loc17_26.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_26.2: type = converted %int.make_type_32, %.loc17_26.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Outer.ref.loc17: type = name_ref Outer, %Outer.decl [template = constants.%Outer] -// CHECK:STDOUT: %o.loc17_6.1: Outer = param o -// CHECK:STDOUT: @G.%o: Outer = bind_name o, %o.loc17_6.1 +// CHECK:STDOUT: %Outer.ref.loc21: type = name_ref Outer, %Outer.decl [template = constants.%Outer] +// CHECK:STDOUT: %o.loc21_6.1: Outer = param o +// CHECK:STDOUT: @G.%o: Outer = bind_name o, %o.loc21_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -75,13 +79,13 @@ fn G(o: Outer) { // CHECK:STDOUT: // CHECK:STDOUT: class @Inner { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32, %.loc9_12.1 [template = i32] -// CHECK:STDOUT: %.loc9_10: = field_decl n, element0 [template] +// CHECK:STDOUT: %.loc13_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_12.2: type = converted %int.make_type_32, %.loc13_12.1 [template = i32] +// CHECK:STDOUT: %.loc13_10: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Inner -// CHECK:STDOUT: .n = %.loc9_10 +// CHECK:STDOUT: .n = %.loc13_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -89,10 +93,10 @@ fn G(o: Outer) { // CHECK:STDOUT: fn @F(%oi: Inner) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %oi.ref: Inner = name_ref oi, %oi -// CHECK:STDOUT: %n.ref: = name_ref n, @Inner.%.loc9_10 [template = @Inner.%.loc9_10] -// CHECK:STDOUT: %.loc14_12.1: ref i32 = class_element_access %oi.ref, element0 -// CHECK:STDOUT: %.loc14_12.2: i32 = bind_value %.loc14_12.1 -// CHECK:STDOUT: return %.loc14_12.2 +// CHECK:STDOUT: %n.ref: = name_ref n, @Inner.%.loc13_10 [template = @Inner.%.loc13_10] +// CHECK:STDOUT: %.loc18_12.1: ref i32 = class_element_access %oi.ref, element0 +// CHECK:STDOUT: %.loc18_12.2: i32 = bind_value %.loc18_12.1 +// CHECK:STDOUT: return %.loc18_12.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%o: Outer) { diff --git a/toolchain/check/testdata/class/no_prelude/export_name.carbon b/toolchain/check/testdata/class/no_prelude/export_name.carbon index a244da2a970f..6208e3711ac6 100644 --- a/toolchain/check/testdata/class/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/class/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/class/no_prelude/implicit_import.carbon b/toolchain/check/testdata/class/no_prelude/implicit_import.carbon index 7936f7eeb47b..f249bda5630d 100644 --- a/toolchain/check/testdata/class/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/class/no_prelude/implicit_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/no_prelude/implicit_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/implicit_import.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon b/toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon index 97b482f5e244..f89025f71d23 100644 --- a/toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon +++ b/toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/class/raw_self.carbon b/toolchain/check/testdata/class/raw_self.carbon index 6de7e9885244..f510eecf5754 100644 --- a/toolchain/check/testdata/class/raw_self.carbon +++ b/toolchain/check/testdata/class/raw_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/raw_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/raw_self.carbon class Class { fn F[addr self: Self*](r#self: i32); @@ -52,112 +56,112 @@ fn Class.G[self: Self](r#self: i32) -> (i32, i32) { // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc13_27: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %self.loc13_17.1: Class* = param self -// CHECK:STDOUT: @F.%self.loc13_17: Class* = bind_name self, %self.loc13_17.1 -// CHECK:STDOUT: @F.%.loc13: Class* = addr_pattern @F.%self.loc13_17 -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_38.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_38.2: type = converted %int.make_type_32.loc13, %.loc13_38.1 [template = i32] -// CHECK:STDOUT: %self.loc13_30.1: i32 = param r#self -// CHECK:STDOUT: @F.%self.loc13_30: i32 = bind_name r#self, %self.loc13_30.1 +// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc17_27: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc17_17.1: Class* = param self +// CHECK:STDOUT: @F.%self.loc17_17: Class* = bind_name self, %self.loc17_17.1 +// CHECK:STDOUT: @F.%.loc17: Class* = addr_pattern @F.%self.loc17_17 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_38.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_38.2: type = converted %int.make_type_32.loc17, %.loc17_38.1 [template = i32] +// CHECK:STDOUT: %self.loc17_30.1: i32 = param r#self +// CHECK:STDOUT: @F.%self.loc17_30: i32 = bind_name r#self, %self.loc17_30.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc17: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc17_12.1: Class = param self -// CHECK:STDOUT: @G.%self.loc17_12: Class = bind_name self, %self.loc17_12.1 -// CHECK:STDOUT: %int.make_type_32.loc17_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_32.1: type = value_of_initializer %int.make_type_32.loc17_32 [template = i32] -// CHECK:STDOUT: %.loc17_32.2: type = converted %int.make_type_32.loc17_32, %.loc17_32.1 [template = i32] -// CHECK:STDOUT: %self.loc17_24.1: i32 = param r#self -// CHECK:STDOUT: @G.%self.loc17_24: i32 = bind_name r#self, %self.loc17_24.1 -// CHECK:STDOUT: %int.make_type_32.loc17_41: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc17_46: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_49.1: (type, type) = tuple_literal (%int.make_type_32.loc17_41, %int.make_type_32.loc17_46) -// CHECK:STDOUT: %.loc17_49.2: type = value_of_initializer %int.make_type_32.loc17_41 [template = i32] -// CHECK:STDOUT: %.loc17_49.3: type = converted %int.make_type_32.loc17_41, %.loc17_49.2 [template = i32] -// CHECK:STDOUT: %.loc17_49.4: type = value_of_initializer %int.make_type_32.loc17_46 [template = i32] -// CHECK:STDOUT: %.loc17_49.5: type = converted %int.make_type_32.loc17_46, %.loc17_49.4 [template = i32] -// CHECK:STDOUT: %.loc17_49.6: type = converted %.loc17_49.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %Self.ref.loc21: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc21_12.1: Class = param self +// CHECK:STDOUT: @G.%self.loc21_12: Class = bind_name self, %self.loc21_12.1 +// CHECK:STDOUT: %int.make_type_32.loc21_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_32.1: type = value_of_initializer %int.make_type_32.loc21_32 [template = i32] +// CHECK:STDOUT: %.loc21_32.2: type = converted %int.make_type_32.loc21_32, %.loc21_32.1 [template = i32] +// CHECK:STDOUT: %self.loc21_24.1: i32 = param r#self +// CHECK:STDOUT: @G.%self.loc21_24: i32 = bind_name r#self, %self.loc21_24.1 +// CHECK:STDOUT: %int.make_type_32.loc21_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21_46: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_49.1: (type, type) = tuple_literal (%int.make_type_32.loc21_41, %int.make_type_32.loc21_46) +// CHECK:STDOUT: %.loc21_49.2: type = value_of_initializer %int.make_type_32.loc21_41 [template = i32] +// CHECK:STDOUT: %.loc21_49.3: type = converted %int.make_type_32.loc21_41, %.loc21_49.2 [template = i32] +// CHECK:STDOUT: %.loc21_49.4: type = value_of_initializer %int.make_type_32.loc21_46 [template = i32] +// CHECK:STDOUT: %.loc21_49.5: type = converted %int.make_type_32.loc21_46, %.loc21_49.4 [template = i32] +// CHECK:STDOUT: %.loc21_49.6: type = converted %.loc21_49.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc8_23: type = ptr_type Class [template = constants.%.1] -// CHECK:STDOUT: %self.loc8_13.1: Class* = param self -// CHECK:STDOUT: %self.loc8_13.3: Class* = bind_name self, %self.loc8_13.1 -// CHECK:STDOUT: %.loc8_8: Class* = addr_pattern %self.loc8_13.3 -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_34.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_34.2: type = converted %int.make_type_32.loc8, %.loc8_34.1 [template = i32] -// CHECK:STDOUT: %self.loc8_26.1: i32 = param r#self -// CHECK:STDOUT: %self.loc8_26.2: i32 = bind_name r#self, %self.loc8_26.1 +// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc12_23: type = ptr_type Class [template = constants.%.1] +// CHECK:STDOUT: %self.loc12_13.1: Class* = param self +// CHECK:STDOUT: %self.loc12_13.3: Class* = bind_name self, %self.loc12_13.1 +// CHECK:STDOUT: %.loc12_8: Class* = addr_pattern %self.loc12_13.3 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_34.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_34.2: type = converted %int.make_type_32.loc12, %.loc12_34.1 [template = i32] +// CHECK:STDOUT: %self.loc12_26.1: i32 = param r#self +// CHECK:STDOUT: %self.loc12_26.2: i32 = bind_name r#self, %self.loc12_26.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc9_8.1: Class = param self -// CHECK:STDOUT: %self.loc9_8.2: Class = bind_name self, %self.loc9_8.1 -// CHECK:STDOUT: %int.make_type_32.loc9_28: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_28.1: type = value_of_initializer %int.make_type_32.loc9_28 [template = i32] -// CHECK:STDOUT: %.loc9_28.2: type = converted %int.make_type_32.loc9_28, %.loc9_28.1 [template = i32] -// CHECK:STDOUT: %self.loc9_20.1: i32 = param r#self -// CHECK:STDOUT: %self.loc9_20.2: i32 = bind_name r#self, %self.loc9_20.1 -// CHECK:STDOUT: %int.make_type_32.loc9_37: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc9_42: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_45.1: (type, type) = tuple_literal (%int.make_type_32.loc9_37, %int.make_type_32.loc9_42) -// CHECK:STDOUT: %.loc9_45.2: type = value_of_initializer %int.make_type_32.loc9_37 [template = i32] -// CHECK:STDOUT: %.loc9_45.3: type = converted %int.make_type_32.loc9_37, %.loc9_45.2 [template = i32] -// CHECK:STDOUT: %.loc9_45.4: type = value_of_initializer %int.make_type_32.loc9_42 [template = i32] -// CHECK:STDOUT: %.loc9_45.5: type = converted %int.make_type_32.loc9_42, %.loc9_45.4 [template = i32] -// CHECK:STDOUT: %.loc9_45.6: type = converted %.loc9_45.1, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc13_8.1: Class = param self +// CHECK:STDOUT: %self.loc13_8.2: Class = bind_name self, %self.loc13_8.1 +// CHECK:STDOUT: %int.make_type_32.loc13_28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_28.1: type = value_of_initializer %int.make_type_32.loc13_28 [template = i32] +// CHECK:STDOUT: %.loc13_28.2: type = converted %int.make_type_32.loc13_28, %.loc13_28.1 [template = i32] +// CHECK:STDOUT: %self.loc13_20.1: i32 = param r#self +// CHECK:STDOUT: %self.loc13_20.2: i32 = bind_name r#self, %self.loc13_20.1 +// CHECK:STDOUT: %int.make_type_32.loc13_37: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_45.1: (type, type) = tuple_literal (%int.make_type_32.loc13_37, %int.make_type_32.loc13_42) +// CHECK:STDOUT: %.loc13_45.2: type = value_of_initializer %int.make_type_32.loc13_37 [template = i32] +// CHECK:STDOUT: %.loc13_45.3: type = converted %int.make_type_32.loc13_37, %.loc13_45.2 [template = i32] +// CHECK:STDOUT: %.loc13_45.4: type = value_of_initializer %int.make_type_32.loc13_42 [template = i32] +// CHECK:STDOUT: %.loc13_45.5: type = converted %int.make_type_32.loc13_42, %.loc13_45.4 [template = i32] +// CHECK:STDOUT: %.loc13_45.6: type = converted %.loc13_45.1, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %return.var: ref (i32, i32) = var // CHECK:STDOUT: } -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10, %.loc10_10.1 [template = i32] -// CHECK:STDOUT: %.loc10_8: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .n = %.loc10_8 +// CHECK:STDOUT: .n = %.loc14_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[addr %self.loc13_17: Class*](%self.loc13_30: i32) { +// CHECK:STDOUT: fn @F[addr %self.loc17_17: Class*](%self.loc17_30: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref.loc14_5: Class* = name_ref self, %self.loc13_17 -// CHECK:STDOUT: %.loc14_4: ref Class = deref %self.ref.loc14_5 -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10_8 [template = @Class.%.loc10_8] -// CHECK:STDOUT: %.loc14_10: ref i32 = class_element_access %.loc14_4, element0 -// CHECK:STDOUT: %self.ref.loc14_15: i32 = name_ref r#self, %self.loc13_30 -// CHECK:STDOUT: assign %.loc14_10, %self.ref.loc14_15 +// CHECK:STDOUT: %self.ref.loc18_5: Class* = name_ref self, %self.loc17_17 +// CHECK:STDOUT: %.loc18_4: ref Class = deref %self.ref.loc18_5 +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc14_8 [template = @Class.%.loc14_8] +// CHECK:STDOUT: %.loc18_10: ref i32 = class_element_access %.loc18_4, element0 +// CHECK:STDOUT: %self.ref.loc18_15: i32 = name_ref r#self, %self.loc17_30 +// CHECK:STDOUT: assign %.loc18_10, %self.ref.loc18_15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G[%self.loc17_12: Class](%self.loc17_24: i32) -> %return: (i32, i32) { +// CHECK:STDOUT: fn @G[%self.loc21_12: Class](%self.loc21_24: i32) -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %self.ref.loc18_11: Class = name_ref self, %self.loc17_12 -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc10_8 [template = @Class.%.loc10_8] -// CHECK:STDOUT: %.loc18_15.1: ref i32 = class_element_access %self.ref.loc18_11, element0 -// CHECK:STDOUT: %.loc18_15.2: i32 = bind_value %.loc18_15.1 -// CHECK:STDOUT: %self.ref.loc18_19: i32 = name_ref r#self, %self.loc17_24 -// CHECK:STDOUT: %.loc18_25.1: (i32, i32) = tuple_literal (%.loc18_15.2, %self.ref.loc18_19) -// CHECK:STDOUT: %.loc18_25.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc18_25.3: init i32 = initialize_from %.loc18_15.2 to %.loc18_25.2 -// CHECK:STDOUT: %.loc18_25.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc18_25.5: init i32 = initialize_from %self.ref.loc18_19 to %.loc18_25.4 -// CHECK:STDOUT: %.loc18_25.6: init (i32, i32) = tuple_init (%.loc18_25.3, %.loc18_25.5) to %return -// CHECK:STDOUT: %.loc18_26: init (i32, i32) = converted %.loc18_25.1, %.loc18_25.6 -// CHECK:STDOUT: return %.loc18_26 to %return +// CHECK:STDOUT: %self.ref.loc22_11: Class = name_ref self, %self.loc21_12 +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc14_8 [template = @Class.%.loc14_8] +// CHECK:STDOUT: %.loc22_15.1: ref i32 = class_element_access %self.ref.loc22_11, element0 +// CHECK:STDOUT: %.loc22_15.2: i32 = bind_value %.loc22_15.1 +// CHECK:STDOUT: %self.ref.loc22_19: i32 = name_ref r#self, %self.loc21_24 +// CHECK:STDOUT: %.loc22_25.1: (i32, i32) = tuple_literal (%.loc22_15.2, %self.ref.loc22_19) +// CHECK:STDOUT: %.loc22_25.2: ref i32 = tuple_access %return, element0 +// CHECK:STDOUT: %.loc22_25.3: init i32 = initialize_from %.loc22_15.2 to %.loc22_25.2 +// CHECK:STDOUT: %.loc22_25.4: ref i32 = tuple_access %return, element1 +// CHECK:STDOUT: %.loc22_25.5: init i32 = initialize_from %self.ref.loc22_19 to %.loc22_25.4 +// CHECK:STDOUT: %.loc22_25.6: init (i32, i32) = tuple_init (%.loc22_25.3, %.loc22_25.5) to %return +// CHECK:STDOUT: %.loc22_26: init (i32, i32) = converted %.loc22_25.1, %.loc22_25.6 +// CHECK:STDOUT: return %.loc22_26 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/raw_self_type.carbon b/toolchain/check/testdata/class/raw_self_type.carbon index cbe938fd84bb..358b75cfc5dd 100644 --- a/toolchain/check/testdata/class/raw_self_type.carbon +++ b/toolchain/check/testdata/class/raw_self_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/raw_self_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/raw_self_type.carbon class Class { fn F() { @@ -45,12 +49,12 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %MemberNamedSelf.decl: type = class_decl @MemberNamedSelf [template = constants.%MemberNamedSelf] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc20_25: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] -// CHECK:STDOUT: %x.loc20_22.1: MemberNamedSelf = param x -// CHECK:STDOUT: @F.2.%x: MemberNamedSelf = bind_name x, %x.loc20_22.1 -// CHECK:STDOUT: %Self.ref.loc20_34: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [template = constants.%Self] -// CHECK:STDOUT: %y.loc20_31.1: r#Self = param y -// CHECK:STDOUT: @F.2.%y: r#Self = bind_name y, %y.loc20_31.1 +// CHECK:STDOUT: %Self.ref.loc24_25: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] +// CHECK:STDOUT: %x.loc24_22.1: MemberNamedSelf = param x +// CHECK:STDOUT: @F.2.%x: MemberNamedSelf = bind_name x, %x.loc24_22.1 +// CHECK:STDOUT: %Self.ref.loc24_34: type = name_ref r#Self, @MemberNamedSelf.%Self.decl [template = constants.%Self] +// CHECK:STDOUT: %y.loc24_31.1: r#Self = param y +// CHECK:STDOUT: @F.2.%y: r#Self = bind_name y, %y.loc24_31.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -65,12 +69,12 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: class @MemberNamedSelf { // CHECK:STDOUT: %Self.decl: type = class_decl @Self [template = constants.%Self] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc17_11: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] -// CHECK:STDOUT: %x.loc17_8.1: MemberNamedSelf = param x -// CHECK:STDOUT: %x.loc17_8.2: MemberNamedSelf = bind_name x, %x.loc17_8.1 -// CHECK:STDOUT: %Self.ref.loc17_20: type = name_ref r#Self, %Self.decl [template = constants.%Self] -// CHECK:STDOUT: %y.loc17_17.1: r#Self = param y -// CHECK:STDOUT: %y.loc17_17.2: r#Self = bind_name y, %y.loc17_17.1 +// CHECK:STDOUT: %Self.ref.loc21_11: type = name_ref Self, constants.%MemberNamedSelf [template = constants.%MemberNamedSelf] +// CHECK:STDOUT: %x.loc21_8.1: MemberNamedSelf = param x +// CHECK:STDOUT: %x.loc21_8.2: MemberNamedSelf = bind_name x, %x.loc21_8.1 +// CHECK:STDOUT: %Self.ref.loc21_20: type = name_ref r#Self, %Self.decl [template = constants.%Self] +// CHECK:STDOUT: %y.loc21_17.1: r#Self = param y +// CHECK:STDOUT: %y.loc21_17.2: r#Self = bind_name y, %y.loc21_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -86,17 +90,17 @@ fn MemberNamedSelf.F(x: Self, y: r#Self) {} // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc13: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %Self.var: ref Class* = var r#Self // CHECK:STDOUT: %Self: ref Class* = bind_name r#Self, %Self.var -// CHECK:STDOUT: %Self.ref.loc10_12: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc10_16: type = ptr_type Class [template = constants.%.3] +// CHECK:STDOUT: %Self.ref.loc14_12: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc14_16: type = ptr_type Class [template = constants.%.3] // CHECK:STDOUT: %p.var: ref Class* = var p // CHECK:STDOUT: %p: ref Class* = bind_name p, %p.var -// CHECK:STDOUT: %Self.ref.loc10_20: ref Class* = name_ref r#Self, %Self -// CHECK:STDOUT: %.loc10_20: Class* = bind_value %Self.ref.loc10_20 -// CHECK:STDOUT: assign %p.var, %.loc10_20 +// CHECK:STDOUT: %Self.ref.loc14_20: ref Class* = name_ref r#Self, %Self +// CHECK:STDOUT: %.loc14_20: Class* = bind_value %Self.ref.loc14_20 +// CHECK:STDOUT: assign %p.var, %.loc14_20 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/redeclaration.carbon b/toolchain/check/testdata/class/redeclaration.carbon index c22f0dc8dd3a..57904a626d04 100644 --- a/toolchain/check/testdata/class/redeclaration.carbon +++ b/toolchain/check/testdata/class/redeclaration.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/redeclaration.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/redeclaration.carbon class Class; @@ -28,35 +32,35 @@ fn Class.F[self: Self](b: bool) {} // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .Class = %Class.decl.loc7 +// CHECK:STDOUT: .Class = %Class.decl.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %Class.decl.loc7: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %Class.decl.loc9: type = class_decl @Class [template = constants.%Class] {} +// CHECK:STDOUT: %Class.decl.loc11: type = class_decl @Class [template = constants.%Class] {} +// CHECK:STDOUT: %Class.decl.loc13: type = class_decl @Class [template = constants.%Class] {} // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc13_12.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc13_12.1 +// CHECK:STDOUT: %self.loc17_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc17_12.1 // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc13_27.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc13_27.2: type = converted %bool.make_type, %.loc13_27.1 [template = bool] -// CHECK:STDOUT: %b.loc13_24.1: bool = param b -// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc13_24.1 +// CHECK:STDOUT: %.loc17_27.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc17_27.2: type = converted %bool.make_type, %.loc17_27.1 [template = bool] +// CHECK:STDOUT: %b.loc17_24.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc17_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc10_8.1: Class = param self -// CHECK:STDOUT: %self.loc10_8.2: Class = bind_name self, %self.loc10_8.1 +// CHECK:STDOUT: %self.loc14_8.1: Class = param self +// CHECK:STDOUT: %self.loc14_8.2: Class = bind_name self, %self.loc14_8.1 // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc10_23.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc10_23.2: type = converted %bool.make_type, %.loc10_23.1 [template = bool] -// CHECK:STDOUT: %b.loc10_20.1: bool = param b -// CHECK:STDOUT: %b.loc10_20.2: bool = bind_name b, %b.loc10_20.1 +// CHECK:STDOUT: %.loc14_23.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc14_23.2: type = converted %bool.make_type, %.loc14_23.1 [template = bool] +// CHECK:STDOUT: %b.loc14_20.1: bool = param b +// CHECK:STDOUT: %b.loc14_20.2: bool = bind_name b, %b.loc14_20.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: diff --git a/toolchain/check/testdata/class/redeclaration_introducer.carbon b/toolchain/check/testdata/class/redeclaration_introducer.carbon index 8f7c951da656..c164fdaad2eb 100644 --- a/toolchain/check/testdata/class/redeclaration_introducer.carbon +++ b/toolchain/check/testdata/class/redeclaration_introducer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/redeclaration_introducer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/redeclaration_introducer.carbon class A; base class B; @@ -24,17 +28,17 @@ abstract class C {} // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.decl.loc7 -// CHECK:STDOUT: .B = %B.decl.loc8 -// CHECK:STDOUT: .C = %C.decl.loc9 +// CHECK:STDOUT: .A = %A.decl.loc11 +// CHECK:STDOUT: .B = %B.decl.loc12 +// CHECK:STDOUT: .C = %C.decl.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl.loc7: type = class_decl @A [template = constants.%A] {} -// CHECK:STDOUT: %B.decl.loc8: type = class_decl @B [template = constants.%B] {} -// CHECK:STDOUT: %C.decl.loc9: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %A.decl.loc11: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %B.decl.loc12: type = class_decl @B [template = constants.%B] {} // CHECK:STDOUT: %C.decl.loc13: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %A.decl.loc15: type = class_decl @A [template = constants.%A] {} +// CHECK:STDOUT: %B.decl.loc16: type = class_decl @B [template = constants.%B] {} +// CHECK:STDOUT: %C.decl.loc17: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @A { diff --git a/toolchain/check/testdata/class/reenter_scope.carbon b/toolchain/check/testdata/class/reenter_scope.carbon index a5db0494c656..ebf8f9a995c0 100644 --- a/toolchain/check/testdata/class/reenter_scope.carbon +++ b/toolchain/check/testdata/class/reenter_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/reenter_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/reenter_scope.carbon class Class { fn F() -> i32; @@ -40,24 +44,24 @@ fn Class.F() -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_17.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_17.2: type = converted %int.make_type_32, %.loc12_17.1 [template = i32] +// CHECK:STDOUT: %.loc16_17.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_17.2: type = converted %int.make_type_32, %.loc16_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] +// CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] +// CHECK:STDOUT: %return.var.loc13: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -71,13 +75,13 @@ fn Class.F() -> i32 { // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %G.ref.loc13: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %G.call.loc13: init i32 = call %G.ref.loc13() -// CHECK:STDOUT: %G.ref.loc14: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %G.call.loc14: init i32 = call %G.ref.loc14() -// CHECK:STDOUT: %.loc14_13.1: i32 = value_of_initializer %G.call.loc14 -// CHECK:STDOUT: %.loc14_13.2: i32 = converted %G.call.loc14, %.loc14_13.1 -// CHECK:STDOUT: return %.loc14_13.2 +// CHECK:STDOUT: %G.ref.loc17: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] +// CHECK:STDOUT: %G.call.loc17: init i32 = call %G.ref.loc17() +// CHECK:STDOUT: %G.ref.loc18: G = name_ref G, @Class.%G.decl [template = constants.%struct.3] +// CHECK:STDOUT: %G.call.loc18: init i32 = call %G.ref.loc18() +// CHECK:STDOUT: %.loc18_13.1: i32 = value_of_initializer %G.call.loc18 +// CHECK:STDOUT: %.loc18_13.2: i32 = converted %G.call.loc18, %.loc18_13.1 +// CHECK:STDOUT: return %.loc18_13.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32; diff --git a/toolchain/check/testdata/class/reorder.carbon b/toolchain/check/testdata/class/reorder.carbon index 5a20a64ee05c..9d117f533289 100644 --- a/toolchain/check/testdata/class/reorder.carbon +++ b/toolchain/check/testdata/class/reorder.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/reorder.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/reorder.carbon class Class { fn G() -> i32 { @@ -42,17 +46,17 @@ class Class { // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var -// CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] +// CHECK:STDOUT: %return.var.loc16: ref i32 = var +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class @@ -67,14 +71,14 @@ class Class { // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.3] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc9_21.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc9_21.2: i32 = converted %F.call, %.loc9_21.1 -// CHECK:STDOUT: return %.loc9_21.2 +// CHECK:STDOUT: %.loc13_21.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc13_21.2: i32 = converted %F.call, %.loc13_21.1 +// CHECK:STDOUT: return %.loc13_21.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc13 +// CHECK:STDOUT: %.loc17: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: return %.loc17 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/reorder_qualified.carbon b/toolchain/check/testdata/class/reorder_qualified.carbon index c3f54c5c6bd7..42f4c458353c 100644 --- a/toolchain/check/testdata/class/reorder_qualified.carbon +++ b/toolchain/check/testdata/class/reorder_qualified.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/reorder_qualified.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/reorder_qualified.carbon class A { class B { @@ -102,30 +106,30 @@ class A { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %AF.decl: AF = fn_decl @AF [template = constants.%struct.6] {} // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc42_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc42_10.2: type = converted %int.make_type_32, %.loc42_10.1 [template = i32] -// CHECK:STDOUT: %.loc42_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc46_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc46_10.2: type = converted %int.make_type_32, %.loc46_10.1 [template = i32] +// CHECK:STDOUT: %.loc46_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%A // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: .AF = %AF.decl -// CHECK:STDOUT: .a = %.loc42_8 +// CHECK:STDOUT: .a = %.loc46_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @B { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %BF.decl: BF = fn_decl @BF [template = constants.%struct.1] {} // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32, %.loc12_12.1 [template = i32] -// CHECK:STDOUT: %.loc12_10: = field_decl b, element0 [template] +// CHECK:STDOUT: %.loc16_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_12.2: type = converted %int.make_type_32, %.loc16_12.1 [template = i32] +// CHECK:STDOUT: %.loc16_10: = field_decl b, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%B // CHECK:STDOUT: .C = %C.decl // CHECK:STDOUT: .BF = %BF.decl -// CHECK:STDOUT: .b = %.loc12_10 +// CHECK:STDOUT: .b = %.loc16_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { @@ -133,30 +137,30 @@ class A { // CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.4] {} // CHECK:STDOUT: %CF.decl: CF = fn_decl @CF [template = constants.%struct.5] {} // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc38_12.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc38_12.2: type = converted %int.make_type_32, %.loc38_12.1 [template = i32] -// CHECK:STDOUT: %.loc38_10: = field_decl c, element0 [template] +// CHECK:STDOUT: %.loc42_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc42_12.2: type = converted %int.make_type_32, %.loc42_12.1 [template = i32] +// CHECK:STDOUT: %.loc42_10: = field_decl c, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .D = %D.decl // CHECK:STDOUT: .CF = %CF.decl -// CHECK:STDOUT: .c = %.loc38_10 +// CHECK:STDOUT: .c = %.loc42_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @D { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} // CHECK:STDOUT: %DF.decl: DF = fn_decl @DF [template = constants.%struct.4] {} // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc20_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc20_14.2: type = converted %int.make_type_32, %.loc20_14.1 [template = i32] -// CHECK:STDOUT: %.loc20_12: = field_decl d, element0 [template] +// CHECK:STDOUT: %.loc24_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc24_14.2: type = converted %int.make_type_32, %.loc24_14.1 [template = i32] +// CHECK:STDOUT: %.loc24_12: = field_decl d, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .DF = %DF.decl -// CHECK:STDOUT: .d = %.loc20_12 +// CHECK:STDOUT: .d = %.loc24_12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @BF(); @@ -170,43 +174,43 @@ class A { // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var -// CHECK:STDOUT: %.loc25_24: i32 = int_literal 1 [template = constants.%.11] -// CHECK:STDOUT: %.loc25_25.1: {.a: i32} = struct_literal (%.loc25_24) -// CHECK:STDOUT: %.loc25_25.2: ref i32 = class_element_access %a.var, element0 -// CHECK:STDOUT: %.loc25_25.3: init i32 = initialize_from %.loc25_24 to %.loc25_25.2 [template = constants.%.11] -// CHECK:STDOUT: %.loc25_25.4: init A = class_init (%.loc25_25.3), %a.var [template = constants.%struct.7] -// CHECK:STDOUT: %.loc25_26: init A = converted %.loc25_25.1, %.loc25_25.4 [template = constants.%struct.7] -// CHECK:STDOUT: assign %a.var, %.loc25_26 +// CHECK:STDOUT: %.loc29_24: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc29_25.1: {.a: i32} = struct_literal (%.loc29_24) +// CHECK:STDOUT: %.loc29_25.2: ref i32 = class_element_access %a.var, element0 +// CHECK:STDOUT: %.loc29_25.3: init i32 = initialize_from %.loc29_24 to %.loc29_25.2 [template = constants.%.11] +// CHECK:STDOUT: %.loc29_25.4: init A = class_init (%.loc29_25.3), %a.var [template = constants.%struct.7] +// CHECK:STDOUT: %.loc29_26: init A = converted %.loc29_25.1, %.loc29_25.4 [template = constants.%struct.7] +// CHECK:STDOUT: assign %a.var, %.loc29_26 // CHECK:STDOUT: %B.ref: type = name_ref B, @A.%B.decl [template = constants.%B] // CHECK:STDOUT: %b.var: ref B = var b // CHECK:STDOUT: %b: ref B = bind_name b, %b.var -// CHECK:STDOUT: %.loc26_24: i32 = int_literal 2 [template = constants.%.13] -// CHECK:STDOUT: %.loc26_25.1: {.b: i32} = struct_literal (%.loc26_24) -// CHECK:STDOUT: %.loc26_25.2: ref i32 = class_element_access %b.var, element0 -// CHECK:STDOUT: %.loc26_25.3: init i32 = initialize_from %.loc26_24 to %.loc26_25.2 [template = constants.%.13] -// CHECK:STDOUT: %.loc26_25.4: init B = class_init (%.loc26_25.3), %b.var [template = constants.%struct.8] -// CHECK:STDOUT: %.loc26_26: init B = converted %.loc26_25.1, %.loc26_25.4 [template = constants.%struct.8] -// CHECK:STDOUT: assign %b.var, %.loc26_26 +// CHECK:STDOUT: %.loc30_24: i32 = int_literal 2 [template = constants.%.13] +// CHECK:STDOUT: %.loc30_25.1: {.b: i32} = struct_literal (%.loc30_24) +// CHECK:STDOUT: %.loc30_25.2: ref i32 = class_element_access %b.var, element0 +// CHECK:STDOUT: %.loc30_25.3: init i32 = initialize_from %.loc30_24 to %.loc30_25.2 [template = constants.%.13] +// CHECK:STDOUT: %.loc30_25.4: init B = class_init (%.loc30_25.3), %b.var [template = constants.%struct.8] +// CHECK:STDOUT: %.loc30_26: init B = converted %.loc30_25.1, %.loc30_25.4 [template = constants.%struct.8] +// CHECK:STDOUT: assign %b.var, %.loc30_26 // CHECK:STDOUT: %C.ref: type = name_ref C, @B.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc27_24: i32 = int_literal 3 [template = constants.%.15] -// CHECK:STDOUT: %.loc27_25.1: {.c: i32} = struct_literal (%.loc27_24) -// CHECK:STDOUT: %.loc27_25.2: ref i32 = class_element_access %c.var, element0 -// CHECK:STDOUT: %.loc27_25.3: init i32 = initialize_from %.loc27_24 to %.loc27_25.2 [template = constants.%.15] -// CHECK:STDOUT: %.loc27_25.4: init C = class_init (%.loc27_25.3), %c.var [template = constants.%struct.9] -// CHECK:STDOUT: %.loc27_26: init C = converted %.loc27_25.1, %.loc27_25.4 [template = constants.%struct.9] -// CHECK:STDOUT: assign %c.var, %.loc27_26 +// CHECK:STDOUT: %.loc31_24: i32 = int_literal 3 [template = constants.%.15] +// CHECK:STDOUT: %.loc31_25.1: {.c: i32} = struct_literal (%.loc31_24) +// CHECK:STDOUT: %.loc31_25.2: ref i32 = class_element_access %c.var, element0 +// CHECK:STDOUT: %.loc31_25.3: init i32 = initialize_from %.loc31_24 to %.loc31_25.2 [template = constants.%.15] +// CHECK:STDOUT: %.loc31_25.4: init C = class_init (%.loc31_25.3), %c.var [template = constants.%struct.9] +// CHECK:STDOUT: %.loc31_26: init C = converted %.loc31_25.1, %.loc31_25.4 [template = constants.%struct.9] +// CHECK:STDOUT: assign %c.var, %.loc31_26 // CHECK:STDOUT: %D.ref: type = name_ref D, @C.%D.decl [template = constants.%D] // CHECK:STDOUT: %d.var: ref D = var d // CHECK:STDOUT: %d: ref D = bind_name d, %d.var -// CHECK:STDOUT: %.loc28_24: i32 = int_literal 4 [template = constants.%.17] -// CHECK:STDOUT: %.loc28_25.1: {.d: i32} = struct_literal (%.loc28_24) -// CHECK:STDOUT: %.loc28_25.2: ref i32 = class_element_access %d.var, element0 -// CHECK:STDOUT: %.loc28_25.3: init i32 = initialize_from %.loc28_24 to %.loc28_25.2 [template = constants.%.17] -// CHECK:STDOUT: %.loc28_25.4: init D = class_init (%.loc28_25.3), %d.var [template = constants.%struct.10] -// CHECK:STDOUT: %.loc28_26: init D = converted %.loc28_25.1, %.loc28_25.4 [template = constants.%struct.10] -// CHECK:STDOUT: assign %d.var, %.loc28_26 +// CHECK:STDOUT: %.loc32_24: i32 = int_literal 4 [template = constants.%.17] +// CHECK:STDOUT: %.loc32_25.1: {.d: i32} = struct_literal (%.loc32_24) +// CHECK:STDOUT: %.loc32_25.2: ref i32 = class_element_access %d.var, element0 +// CHECK:STDOUT: %.loc32_25.3: init i32 = initialize_from %.loc32_24 to %.loc32_25.2 [template = constants.%.17] +// CHECK:STDOUT: %.loc32_25.4: init D = class_init (%.loc32_25.3), %d.var [template = constants.%struct.10] +// CHECK:STDOUT: %.loc32_26: init D = converted %.loc32_25.1, %.loc32_25.4 [template = constants.%struct.10] +// CHECK:STDOUT: assign %d.var, %.loc32_26 // CHECK:STDOUT: %AF.ref: AF = name_ref AF, @A.%AF.decl [template = constants.%struct.6] // CHECK:STDOUT: %AF.call: init () = call %AF.ref() // CHECK:STDOUT: %BF.ref: BF = name_ref BF, @B.%BF.decl [template = constants.%struct.1] diff --git a/toolchain/check/testdata/class/scope.carbon b/toolchain/check/testdata/class/scope.carbon index a868d5d0e9c3..f039a405a2fd 100644 --- a/toolchain/check/testdata/class/scope.carbon +++ b/toolchain/check/testdata/class/scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/scope.carbon class Class { fn F() -> i32 { @@ -57,8 +61,8 @@ fn Run() { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32, %.loc17_11.1 [template = i32] +// CHECK:STDOUT: %.loc21_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_11.2: type = converted %int.make_type_32, %.loc21_11.1 [template = i32] // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.5] {} @@ -68,17 +72,17 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var -// CHECK:STDOUT: } -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] +// CHECK:STDOUT: %return.var.loc16: ref i32 = var +// CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class @@ -90,44 +94,44 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: return %.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 -// CHECK:STDOUT: return %.loc13_15.2 +// CHECK:STDOUT: %.loc17_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc17_15.2: i32 = converted %F.call, %.loc17_15.1 +// CHECK:STDOUT: return %.loc17_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: return %.loc18 +// CHECK:STDOUT: %.loc22: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: return %.loc22 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc22_10.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] -// CHECK:STDOUT: %.loc22_10.2: type = converted %int.make_type_32.loc22, %.loc22_10.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_10.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_10.2: type = converted %int.make_type_32.loc26, %.loc26_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %F.ref.loc22: F = name_ref F, file.%F.decl [template = constants.%struct.4] -// CHECK:STDOUT: %F.call.loc22: init i32 = call %F.ref.loc22() -// CHECK:STDOUT: assign %a.var, %F.call.loc22 -// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc23_10.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] -// CHECK:STDOUT: %.loc23_10.2: type = converted %int.make_type_32.loc23, %.loc23_10.1 [template = i32] +// CHECK:STDOUT: %F.ref.loc26: F = name_ref F, file.%F.decl [template = constants.%struct.4] +// CHECK:STDOUT: %F.call.loc26: init i32 = call %F.ref.loc26() +// CHECK:STDOUT: assign %a.var, %F.call.loc26 +// CHECK:STDOUT: %int.make_type_32.loc27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_10.1: type = value_of_initializer %int.make_type_32.loc27 [template = i32] +// CHECK:STDOUT: %.loc27_10.2: type = converted %int.make_type_32.loc27, %.loc27_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Class.ref: type = name_ref Class, file.%Class.decl [template = constants.%Class] -// CHECK:STDOUT: %F.ref.loc23: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %F.call.loc23: init i32 = call %F.ref.loc23() -// CHECK:STDOUT: assign %b.var, %F.call.loc23 +// CHECK:STDOUT: %F.ref.loc27: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %F.call.loc27: init i32 = call %F.ref.loc27() +// CHECK:STDOUT: assign %b.var, %F.call.loc27 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self.carbon b/toolchain/check/testdata/class/self.carbon index d7b9b81db99a..ec1113eeb974 100644 --- a/toolchain/check/testdata/class/self.carbon +++ b/toolchain/check/testdata/class/self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self.carbon class Class { fn F[self: Self]() -> i32; @@ -48,59 +52,59 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc14_12.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc14_12.1 -// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_29.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] -// CHECK:STDOUT: %.loc14_29.2: type = converted %int.make_type_32.loc14, %.loc14_29.1 [template = i32] +// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc18_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc18_12.1 +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_29.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_29.2: type = converted %int.make_type_32.loc18, %.loc18_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc18_27: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %self.loc18_17.1: Class* = param self -// CHECK:STDOUT: @G.%self: Class* = bind_name self, %self.loc18_17.1 -// CHECK:STDOUT: @G.%.loc18: Class* = addr_pattern @G.%self -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_35.2: type = converted %int.make_type_32.loc18, %.loc18_35.1 [template = i32] +// CHECK:STDOUT: %Self.ref.loc22: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc22_27: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %self.loc22_17.1: Class* = param self +// CHECK:STDOUT: @G.%self: Class* = bind_name self, %self.loc22_17.1 +// CHECK:STDOUT: @G.%.loc22: Class* = addr_pattern @G.%self +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_35.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_35.2: type = converted %int.make_type_32.loc22, %.loc22_35.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc8_8.1: Class = param self -// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32.loc8, %.loc8_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc12_8.1: Class = param self +// CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_25.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_25.2: type = converted %int.make_type_32.loc12, %.loc12_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc9_23: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %self.loc9_13.1: Class* = param self -// CHECK:STDOUT: %self.loc9_13.3: Class* = bind_name self, %self.loc9_13.1 -// CHECK:STDOUT: %.loc9_8: Class* = addr_pattern %self.loc9_13.3 -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_31.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_31.2: type = converted %int.make_type_32.loc9, %.loc9_31.1 [template = i32] -// CHECK:STDOUT: %return.var.loc9: ref i32 = var +// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc13_23: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %self.loc13_13.1: Class* = param self +// CHECK:STDOUT: %self.loc13_13.3: Class* = bind_name self, %self.loc13_13.1 +// CHECK:STDOUT: %.loc13_8: Class* = addr_pattern %self.loc13_13.3 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_31.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_31.2: type = converted %int.make_type_32.loc13, %.loc13_31.1 [template = i32] +// CHECK:STDOUT: %return.var.loc13: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32.loc11, %.loc11_10.1 [template = i32] -// CHECK:STDOUT: %.loc11_8: = field_decl n, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32.loc15, %.loc15_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_8: = field_decl n, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .G = %G.decl -// CHECK:STDOUT: .n = %.loc11_8 +// CHECK:STDOUT: .n = %.loc15_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -108,19 +112,19 @@ fn Class.G[addr self: Self*]() -> i32 { // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11_8 [template = @Class.%.loc11_8] -// CHECK:STDOUT: %.loc15_14.1: ref i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc15_14.2: i32 = bind_value %.loc15_14.1 -// CHECK:STDOUT: return %.loc15_14.2 +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc15_8 [template = @Class.%.loc15_8] +// CHECK:STDOUT: %.loc19_14.1: ref i32 = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc19_14.2: i32 = bind_value %.loc19_14.1 +// CHECK:STDOUT: return %.loc19_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G[addr %self: Class*]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class* = name_ref self, %self -// CHECK:STDOUT: %.loc19_11: ref Class = deref %self.ref -// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc11_8 [template = @Class.%.loc11_8] -// CHECK:STDOUT: %.loc19_17.1: ref i32 = class_element_access %.loc19_11, element0 -// CHECK:STDOUT: %.loc19_17.2: i32 = bind_value %.loc19_17.1 -// CHECK:STDOUT: return %.loc19_17.2 +// CHECK:STDOUT: %.loc23_11: ref Class = deref %self.ref +// CHECK:STDOUT: %n.ref: = name_ref n, @Class.%.loc15_8 [template = @Class.%.loc15_8] +// CHECK:STDOUT: %.loc23_17.1: ref i32 = class_element_access %.loc23_11, element0 +// CHECK:STDOUT: %.loc23_17.2: i32 = bind_value %.loc23_17.1 +// CHECK:STDOUT: return %.loc23_17.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_conversion.carbon b/toolchain/check/testdata/class/self_conversion.carbon index 69c800ff79e5..52f096a697e0 100644 --- a/toolchain/check/testdata/class/self_conversion.carbon +++ b/toolchain/check/testdata/class/self_conversion.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/self_conversion.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self_conversion.carbon base class Base { var a: i32; @@ -68,68 +72,68 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.2] { -// CHECK:STDOUT: %Base.ref.loc18: type = name_ref Base, %Base.decl [template = constants.%Base] -// CHECK:STDOUT: %self.loc18_21.1: Base = param self -// CHECK:STDOUT: @SelfBase.%self: Base = bind_name self, %self.loc18_21.1 -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_38.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_38.2: type = converted %int.make_type_32.loc18, %.loc18_38.1 [template = i32] +// CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %self.loc22_21.1: Base = param self +// CHECK:STDOUT: @SelfBase.%self: Base = bind_name self, %self.loc22_21.1 +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_38.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_38.2: type = converted %int.make_type_32.loc22, %.loc22_38.1 [template = i32] // CHECK:STDOUT: @SelfBase.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.3] { -// CHECK:STDOUT: %Base.ref.loc22: type = name_ref Base, %Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc22_40: type = ptr_type Base [template = constants.%.6] -// CHECK:STDOUT: %self.loc22_30.1: Base* = param self -// CHECK:STDOUT: @AddrSelfBase.%self: Base* = bind_name self, %self.loc22_30.1 -// CHECK:STDOUT: @AddrSelfBase.%.loc22: Base* = addr_pattern @AddrSelfBase.%self +// CHECK:STDOUT: %Base.ref.loc26: type = name_ref Base, %Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc26_40: type = ptr_type Base [template = constants.%.6] +// CHECK:STDOUT: %self.loc26_30.1: Base* = param self +// CHECK:STDOUT: @AddrSelfBase.%self: Base* = bind_name self, %self.loc26_30.1 +// CHECK:STDOUT: @AddrSelfBase.%.loc26: Base* = addr_pattern @AddrSelfBase.%self // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Call.decl: Call = fn_decl @Call [template = constants.%struct.4] { // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, %Derived.decl [template = constants.%Derived] -// CHECK:STDOUT: %.loc26_19: type = ptr_type Derived [template = constants.%.9] -// CHECK:STDOUT: %p.loc26_9.1: Derived* = param p -// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc26_9.1 -// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc26_25.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] -// CHECK:STDOUT: %.loc26_25.2: type = converted %int.make_type_32.loc26, %.loc26_25.1 [template = i32] +// CHECK:STDOUT: %.loc30_19: type = ptr_type Derived [template = constants.%.9] +// CHECK:STDOUT: %p.loc30_9.1: Derived* = param p +// CHECK:STDOUT: @Call.%p: Derived* = bind_name p, %p.loc30_9.1 +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_25.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_25.2: type = converted %int.make_type_32.loc30, %.loc30_25.1 [template = i32] // CHECK:STDOUT: @Call.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Base { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Base -// CHECK:STDOUT: .a = %.loc8_8 +// CHECK:STDOUT: .a = %.loc12_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Derived { -// CHECK:STDOUT: %Base.ref.loc12: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc12: = base_decl Base, element0 [template] +// CHECK:STDOUT: %Base.ref.loc16: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc16: = base_decl Base, element0 [template] // CHECK:STDOUT: %SelfBase.decl: SelfBase = fn_decl @SelfBase [template = constants.%struct.2] { -// CHECK:STDOUT: %Base.ref.loc14: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %self.loc14_15.1: Base = param self -// CHECK:STDOUT: %self.loc14_15.2: Base = bind_name self, %self.loc14_15.1 +// CHECK:STDOUT: %Base.ref.loc18: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %self.loc18_15.1: Base = param self +// CHECK:STDOUT: %self.loc18_15.2: Base = bind_name self, %self.loc18_15.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_32.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_32.2: type = converted %int.make_type_32, %.loc14_32.1 [template = i32] +// CHECK:STDOUT: %.loc18_32.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_32.2: type = converted %int.make_type_32, %.loc18_32.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %AddrSelfBase.decl: AddrSelfBase = fn_decl @AddrSelfBase [template = constants.%struct.3] { -// CHECK:STDOUT: %Base.ref.loc15: type = name_ref Base, file.%Base.decl [template = constants.%Base] -// CHECK:STDOUT: %.loc15_34: type = ptr_type Base [template = constants.%.6] -// CHECK:STDOUT: %self.loc15_24.1: Base* = param self -// CHECK:STDOUT: %self.loc15_24.3: Base* = bind_name self, %self.loc15_24.1 -// CHECK:STDOUT: %.loc15_19: Base* = addr_pattern %self.loc15_24.3 +// CHECK:STDOUT: %Base.ref.loc19: type = name_ref Base, file.%Base.decl [template = constants.%Base] +// CHECK:STDOUT: %.loc19_34: type = ptr_type Base [template = constants.%.6] +// CHECK:STDOUT: %self.loc19_24.1: Base* = param self +// CHECK:STDOUT: %self.loc19_24.3: Base* = bind_name self, %self.loc19_24.1 +// CHECK:STDOUT: %.loc19_19: Base* = addr_pattern %self.loc19_24.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Derived -// CHECK:STDOUT: .base = %.loc12 +// CHECK:STDOUT: .base = %.loc16 // CHECK:STDOUT: .SelfBase = %SelfBase.decl // CHECK:STDOUT: .AddrSelfBase = %AddrSelfBase.decl // CHECK:STDOUT: extend name_scope2 @@ -140,45 +144,45 @@ fn Call(p: Derived*) -> i32 { // CHECK:STDOUT: fn @SelfBase[%self: Base]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base = name_ref self, %self -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] -// CHECK:STDOUT: %.loc19_14.1: ref i32 = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc19_14.2: i32 = bind_value %.loc19_14.1 -// CHECK:STDOUT: return %.loc19_14.2 +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc12_8 [template = @Base.%.loc12_8] +// CHECK:STDOUT: %.loc23_14.1: ref i32 = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc23_14.2: i32 = bind_value %.loc23_14.1 +// CHECK:STDOUT: return %.loc23_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddrSelfBase[addr %self: Base*]() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Base* = name_ref self, %self -// CHECK:STDOUT: %.loc23_4: ref Base = deref %self.ref -// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc8_8 [template = @Base.%.loc8_8] -// CHECK:STDOUT: %.loc23_10: ref i32 = class_element_access %.loc23_4, element0 -// CHECK:STDOUT: %.loc23_15: i32 = int_literal 1 [template = constants.%.8] -// CHECK:STDOUT: assign %.loc23_10, %.loc23_15 +// CHECK:STDOUT: %.loc27_4: ref Base = deref %self.ref +// CHECK:STDOUT: %a.ref: = name_ref a, @Base.%.loc12_8 [template = @Base.%.loc12_8] +// CHECK:STDOUT: %.loc27_10: ref i32 = class_element_access %.loc27_4, element0 +// CHECK:STDOUT: %.loc27_15: i32 = int_literal 1 [template = constants.%.8] +// CHECK:STDOUT: assign %.loc27_10, %.loc27_15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Call(%p: Derived*) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %p.ref.loc27: Derived* = name_ref p, %p -// CHECK:STDOUT: %.loc27_4.1: ref Derived = deref %p.ref.loc27 +// CHECK:STDOUT: %p.ref.loc31: Derived* = name_ref p, %p +// CHECK:STDOUT: %.loc31_4.1: ref Derived = deref %p.ref.loc31 // CHECK:STDOUT: %AddrSelfBase.ref: AddrSelfBase = name_ref AddrSelfBase, @Derived.%AddrSelfBase.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc27_7: = bound_method %.loc27_4.1, %AddrSelfBase.ref -// CHECK:STDOUT: %.loc27_4.2: Derived* = addr_of %.loc27_4.1 -// CHECK:STDOUT: %.loc27_20.1: ref Derived = deref %.loc27_4.2 -// CHECK:STDOUT: %.loc27_20.2: ref Base = class_element_access %.loc27_20.1, element0 -// CHECK:STDOUT: %.loc27_20.3: Base* = addr_of %.loc27_20.2 -// CHECK:STDOUT: %.loc27_20.4: Base* = converted %.loc27_4.2, %.loc27_20.3 -// CHECK:STDOUT: %AddrSelfBase.call: init () = call %.loc27_7(%.loc27_20.4) -// CHECK:STDOUT: %p.ref.loc28: Derived* = name_ref p, %p -// CHECK:STDOUT: %.loc28_11: ref Derived = deref %p.ref.loc28 +// CHECK:STDOUT: %.loc31_7: = bound_method %.loc31_4.1, %AddrSelfBase.ref +// CHECK:STDOUT: %.loc31_4.2: Derived* = addr_of %.loc31_4.1 +// CHECK:STDOUT: %.loc31_20.1: ref Derived = deref %.loc31_4.2 +// CHECK:STDOUT: %.loc31_20.2: ref Base = class_element_access %.loc31_20.1, element0 +// CHECK:STDOUT: %.loc31_20.3: Base* = addr_of %.loc31_20.2 +// CHECK:STDOUT: %.loc31_20.4: Base* = converted %.loc31_4.2, %.loc31_20.3 +// CHECK:STDOUT: %AddrSelfBase.call: init () = call %.loc31_7(%.loc31_20.4) +// CHECK:STDOUT: %p.ref.loc32: Derived* = name_ref p, %p +// CHECK:STDOUT: %.loc32_11: ref Derived = deref %p.ref.loc32 // CHECK:STDOUT: %SelfBase.ref: SelfBase = name_ref SelfBase, @Derived.%SelfBase.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc28_14: = bound_method %.loc28_11, %SelfBase.ref -// CHECK:STDOUT: %.loc28_23.1: ref Base = class_element_access %.loc28_11, element0 -// CHECK:STDOUT: %.loc28_23.2: ref Base = converted %.loc28_11, %.loc28_23.1 -// CHECK:STDOUT: %.loc28_23.3: Base = bind_value %.loc28_23.2 -// CHECK:STDOUT: %SelfBase.call: init i32 = call %.loc28_14(%.loc28_23.3) -// CHECK:STDOUT: %.loc28_25.1: i32 = value_of_initializer %SelfBase.call -// CHECK:STDOUT: %.loc28_25.2: i32 = converted %SelfBase.call, %.loc28_25.1 -// CHECK:STDOUT: return %.loc28_25.2 +// CHECK:STDOUT: %.loc32_14: = bound_method %.loc32_11, %SelfBase.ref +// CHECK:STDOUT: %.loc32_23.1: ref Base = class_element_access %.loc32_11, element0 +// CHECK:STDOUT: %.loc32_23.2: ref Base = converted %.loc32_11, %.loc32_23.1 +// CHECK:STDOUT: %.loc32_23.3: Base = bind_value %.loc32_23.2 +// CHECK:STDOUT: %SelfBase.call: init i32 = call %.loc32_14(%.loc32_23.3) +// CHECK:STDOUT: %.loc32_25.1: i32 = value_of_initializer %SelfBase.call +// CHECK:STDOUT: %.loc32_25.2: i32 = converted %SelfBase.call, %.loc32_25.1 +// CHECK:STDOUT: return %.loc32_25.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/self_type.carbon b/toolchain/check/testdata/class/self_type.carbon index 507ea360fc93..d1ca5371fbe1 100644 --- a/toolchain/check/testdata/class/self_type.carbon +++ b/toolchain/check/testdata/class/self_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/self_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/self_type.carbon class Class { fn F[self: Self]() -> i32; @@ -46,38 +50,38 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc17_12.1: Class = param self -// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc17_12.1 +// CHECK:STDOUT: %self.loc21_12.1: Class = param self +// CHECK:STDOUT: @F.%self: Class = bind_name self, %self.loc21_12.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_29.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc17_29.2: type = converted %int.make_type_32, %.loc17_29.1 [template = i32] +// CHECK:STDOUT: %.loc21_29.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_29.2: type = converted %int.make_type_32, %.loc21_29.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %Self.ref.loc8: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %self.loc8_8.1: Class = param self -// CHECK:STDOUT: %self.loc8_8.2: Class = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %Self.ref.loc12: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %self.loc12_8.1: Class = param self +// CHECK:STDOUT: %self.loc12_8.2: Class = bind_name self, %self.loc12_8.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_25.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_25.2: type = converted %int.make_type_32, %.loc8_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc8: ref i32 = var +// CHECK:STDOUT: %.loc12_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_25.2: type = converted %int.make_type_32, %.loc12_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc12: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make [template = constants.%struct.3] { -// CHECK:STDOUT: %Self.ref.loc9: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %return.var.loc9: ref Class = var +// CHECK:STDOUT: %Self.ref.loc13: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %return.var.loc13: ref Class = var // CHECK:STDOUT: } -// CHECK:STDOUT: %Self.ref.loc14: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %.loc14_14: type = ptr_type Class [template = constants.%.2] -// CHECK:STDOUT: %.loc14_8: = field_decl p, element0 [template] +// CHECK:STDOUT: %Self.ref.loc18: type = name_ref Self, constants.%Class [template = constants.%Class] +// CHECK:STDOUT: %.loc18_14: type = ptr_type Class [template = constants.%.2] +// CHECK:STDOUT: %.loc18_8: = field_decl p, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%Class // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: .Make = %Make.decl -// CHECK:STDOUT: .p = %.loc14_8 +// CHECK:STDOUT: .p = %.loc18_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -85,32 +89,32 @@ fn Class.F[self: Self]() -> i32 { // CHECK:STDOUT: fn @F[%self: Class]() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %self.ref: Class = name_ref self, %self -// CHECK:STDOUT: %p.ref: = name_ref p, @Class.%.loc14_8 [template = @Class.%.loc14_8] -// CHECK:STDOUT: %.loc18_16.1: ref Class* = class_element_access %self.ref, element0 -// CHECK:STDOUT: %.loc18_16.2: Class* = bind_value %.loc18_16.1 -// CHECK:STDOUT: %.loc18_11.1: ref Class = deref %.loc18_16.2 +// CHECK:STDOUT: %p.ref: = name_ref p, @Class.%.loc18_8 [template = @Class.%.loc18_8] +// CHECK:STDOUT: %.loc22_16.1: ref Class* = class_element_access %self.ref, element0 +// CHECK:STDOUT: %.loc22_16.2: Class* = bind_value %.loc22_16.1 +// CHECK:STDOUT: %.loc22_11.1: ref Class = deref %.loc22_16.2 // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc18_19: = bound_method %.loc18_11.1, %F.ref -// CHECK:STDOUT: %.loc18_11.2: Class = bind_value %.loc18_11.1 -// CHECK:STDOUT: %F.call: init i32 = call %.loc18_19(%.loc18_11.2) -// CHECK:STDOUT: %.loc18_23.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc18_23.2: i32 = converted %F.call, %.loc18_23.1 -// CHECK:STDOUT: return %.loc18_23.2 +// CHECK:STDOUT: %.loc22_19: = bound_method %.loc22_11.1, %F.ref +// CHECK:STDOUT: %.loc22_11.2: Class = bind_value %.loc22_11.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc22_19(%.loc22_11.2) +// CHECK:STDOUT: %.loc22_23.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc22_23.2: i32 = converted %F.call, %.loc22_23.1 +// CHECK:STDOUT: return %.loc22_23.2 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Make() -> @Class.%return.var.loc9: Class { +// CHECK:STDOUT: fn @Make() -> @Class.%return.var.loc13: Class { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%Class [template = constants.%Class] -// CHECK:STDOUT: %s: ref Class = bind_name s, @Class.%return.var.loc9 -// CHECK:STDOUT: %s.ref.loc11_5: ref Class = name_ref s, %s -// CHECK:STDOUT: %s.ref.loc11_16: ref Class = name_ref s, %s -// CHECK:STDOUT: %.loc11_15: Class* = addr_of %s.ref.loc11_16 -// CHECK:STDOUT: %.loc11_17.1: {.p: Class*} = struct_literal (%.loc11_15) -// CHECK:STDOUT: %.loc11_17.2: ref Class* = class_element_access %s.ref.loc11_5, element0 -// CHECK:STDOUT: %.loc11_17.3: init Class* = initialize_from %.loc11_15 to %.loc11_17.2 -// CHECK:STDOUT: %.loc11_17.4: init Class = class_init (%.loc11_17.3), %s.ref.loc11_5 -// CHECK:STDOUT: %.loc11_7: init Class = converted %.loc11_17.1, %.loc11_17.4 -// CHECK:STDOUT: assign %s.ref.loc11_5, %.loc11_7 -// CHECK:STDOUT: return %s to @Class.%return.var.loc9 +// CHECK:STDOUT: %s: ref Class = bind_name s, @Class.%return.var.loc13 +// CHECK:STDOUT: %s.ref.loc15_5: ref Class = name_ref s, %s +// CHECK:STDOUT: %s.ref.loc15_16: ref Class = name_ref s, %s +// CHECK:STDOUT: %.loc15_15: Class* = addr_of %s.ref.loc15_16 +// CHECK:STDOUT: %.loc15_17.1: {.p: Class*} = struct_literal (%.loc15_15) +// CHECK:STDOUT: %.loc15_17.2: ref Class* = class_element_access %s.ref.loc15_5, element0 +// CHECK:STDOUT: %.loc15_17.3: init Class* = initialize_from %.loc15_15 to %.loc15_17.2 +// CHECK:STDOUT: %.loc15_17.4: init Class = class_init (%.loc15_17.3), %s.ref.loc15_5 +// CHECK:STDOUT: %.loc15_7: init Class = converted %.loc15_17.1, %.loc15_17.4 +// CHECK:STDOUT: assign %s.ref.loc15_5, %.loc15_7 +// CHECK:STDOUT: return %s to @Class.%return.var.loc13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/class/static_method.carbon b/toolchain/check/testdata/class/static_method.carbon index 027878c5017f..132d9012267a 100644 --- a/toolchain/check/testdata/class/static_method.carbon +++ b/toolchain/check/testdata/class/static_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/static_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/static_method.carbon class Class { fn F() -> i32; @@ -40,8 +44,8 @@ fn Run() -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_13.2: type = converted %int.make_type_32, %.loc15_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -49,8 +53,8 @@ fn Run() -> i32 { // CHECK:STDOUT: class @Class { // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: @@ -71,8 +75,8 @@ fn Run() -> i32 { // CHECK:STDOUT: %c.ref: ref Class = name_ref c, %c // CHECK:STDOUT: %F.ref: F = name_ref F, @Class.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc13_15.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc13_15.2: i32 = converted %F.call, %.loc13_15.1 -// CHECK:STDOUT: return %.loc13_15.2 +// CHECK:STDOUT: %.loc17_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc17_15.2: i32 = converted %F.call, %.loc17_15.1 +// CHECK:STDOUT: return %.loc17_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/const/basic.carbon b/toolchain/check/testdata/const/basic.carbon index dc217edeb343..5fd570d7736c 100644 --- a/toolchain/check/testdata/const/basic.carbon +++ b/toolchain/check/testdata/const/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/const/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/const/basic.carbon fn A(p: const i32**) -> const i32** { return p; @@ -39,37 +43,37 @@ fn B(p: const (i32*)) -> const (i32*) { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_15 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_15, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_9.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_18: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_19: type = ptr_type const i32* [template = constants.%.4] -// CHECK:STDOUT: %p.loc7_6.1: const i32** = param p -// CHECK:STDOUT: @A.%p: const i32** = bind_name p, %p.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_31: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_31 [template = i32] -// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_31, %.loc7_25.1 [template = i32] -// CHECK:STDOUT: %.loc7_25.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_34: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_35: type = ptr_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc11_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_15 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_15, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_9.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_18: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_19: type = ptr_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %p.loc11_6.1: const i32** = param p +// CHECK:STDOUT: @A.%p: const i32** = bind_name p, %p.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_31: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: type = value_of_initializer %int.make_type_32.loc11_31 [template = i32] +// CHECK:STDOUT: %.loc11_25.2: type = converted %int.make_type_32.loc11_31, %.loc11_25.1 [template = i32] +// CHECK:STDOUT: %.loc11_25.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_34: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_35: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: @A.%return: ref const i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] -// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_16, %.loc11_19.1 [template = i32] -// CHECK:STDOUT: %.loc11_19.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_9: type = const_type i32* [template = constants.%.6] -// CHECK:STDOUT: %p.loc11_6.1: const (i32*) = param p -// CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %int.make_type_32.loc11_33: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_36.1: type = value_of_initializer %int.make_type_32.loc11_33 [template = i32] -// CHECK:STDOUT: %.loc11_36.2: type = converted %int.make_type_32.loc11_33, %.loc11_36.1 [template = i32] -// CHECK:STDOUT: %.loc11_36.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_26: type = const_type i32* [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc15_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_19.1: type = value_of_initializer %int.make_type_32.loc15_16 [template = i32] +// CHECK:STDOUT: %.loc15_19.2: type = converted %int.make_type_32.loc15_16, %.loc15_19.1 [template = i32] +// CHECK:STDOUT: %.loc15_19.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_9: type = const_type i32* [template = constants.%.6] +// CHECK:STDOUT: %p.loc15_6.1: const (i32*) = param p +// CHECK:STDOUT: @B.%p: const (i32*) = bind_name p, %p.loc15_6.1 +// CHECK:STDOUT: %int.make_type_32.loc15_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_36.1: type = value_of_initializer %int.make_type_32.loc15_33 [template = i32] +// CHECK:STDOUT: %.loc15_36.2: type = converted %int.make_type_32.loc15_33, %.loc15_36.1 [template = i32] +// CHECK:STDOUT: %.loc15_36.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_26: type = const_type i32* [template = constants.%.6] // CHECK:STDOUT: @B.%return: ref const (i32*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/const/collapse.carbon b/toolchain/check/testdata/const/collapse.carbon index 2ca06769cf0a..8c4268ce520f 100644 --- a/toolchain/check/testdata/const/collapse.carbon +++ b/toolchain/check/testdata/const/collapse.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/const/collapse.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/const/collapse.carbon // OK, `const (const i32)` is the same type as `const i32`. // CHECK:STDERR: collapse.carbon:[[@LINE+3]]:25: WARNING: `const` applied repeatedly to the same type has no additional effect. @@ -34,21 +38,21 @@ fn F(p: const i32**) -> const (const i32)** { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc11_15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_15 [template = i32] -// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_15, %.loc11_9.1 [template = i32] -// CHECK:STDOUT: %.loc11_9.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_18: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_19: type = ptr_type const i32* [template = constants.%.4] -// CHECK:STDOUT: %p.loc11_6.1: const i32** = param p -// CHECK:STDOUT: @F.%p: const i32** = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %int.make_type_32.loc11_38: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_38 [template = i32] -// CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_38, %.loc11_32.1 [template = i32] -// CHECK:STDOUT: %.loc11_32.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_25: type = const_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_43: type = ptr_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc15_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15_15 [template = i32] +// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15_15, %.loc15_9.1 [template = i32] +// CHECK:STDOUT: %.loc15_9.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_19: type = ptr_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %p.loc15_6.1: const i32** = param p +// CHECK:STDOUT: @F.%p: const i32** = bind_name p, %p.loc15_6.1 +// CHECK:STDOUT: %int.make_type_32.loc15_38: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %int.make_type_32.loc15_38 [template = i32] +// CHECK:STDOUT: %.loc15_32.2: type = converted %int.make_type_32.loc15_38, %.loc15_32.1 [template = i32] +// CHECK:STDOUT: %.loc15_32.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_25: type = const_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_42: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_43: type = ptr_type const i32* [template = constants.%.4] // CHECK:STDOUT: @F.%return: ref const i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/const/fail_collapse.carbon b/toolchain/check/testdata/const/fail_collapse.carbon index fb079d7034a3..eda928aacef6 100644 --- a/toolchain/check/testdata/const/fail_collapse.carbon +++ b/toolchain/check/testdata/const/fail_collapse.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/const/fail_collapse.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/const/fail_collapse.carbon // CHECK:STDERR: fail_collapse.carbon:[[@LINE+4]]:9: WARNING: `const` applied repeatedly to the same type has no additional effect. // CHECK:STDERR: fn G(p: const (const i32)**) -> i32** { @@ -39,20 +43,20 @@ fn G(p: const (const i32)**) -> i32** { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] -// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11_22, %.loc11_16.1 [template = i32] -// CHECK:STDOUT: %.loc11_16.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_9: type = const_type const i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_26: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27: type = ptr_type const i32* [template = constants.%.4] -// CHECK:STDOUT: %p.loc11_6.1: const i32** = param p -// CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc11_6.1 -// CHECK:STDOUT: %int.make_type_32.loc11_33: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_36.1: type = value_of_initializer %int.make_type_32.loc11_33 [template = i32] -// CHECK:STDOUT: %.loc11_36.2: type = converted %int.make_type_32.loc11_33, %.loc11_36.1 [template = i32] -// CHECK:STDOUT: %.loc11_36.3: type = ptr_type i32 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_37: type = ptr_type i32* [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc15_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_16.1: type = value_of_initializer %int.make_type_32.loc15_22 [template = i32] +// CHECK:STDOUT: %.loc15_16.2: type = converted %int.make_type_32.loc15_22, %.loc15_16.1 [template = i32] +// CHECK:STDOUT: %.loc15_16.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_9: type = const_type const i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_26: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_27: type = ptr_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %p.loc15_6.1: const i32** = param p +// CHECK:STDOUT: @G.%p: const i32** = bind_name p, %p.loc15_6.1 +// CHECK:STDOUT: %int.make_type_32.loc15_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_36.1: type = value_of_initializer %int.make_type_32.loc15_33 [template = i32] +// CHECK:STDOUT: %.loc15_36.2: type = converted %int.make_type_32.loc15_33, %.loc15_36.1 [template = i32] +// CHECK:STDOUT: %.loc15_36.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_37: type = ptr_type i32* [template = constants.%.6] // CHECK:STDOUT: @G.%return: ref i32** = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/const/import.carbon b/toolchain/check/testdata/const/import.carbon index 0193bb03efcc..4bc981f21a21 100644 --- a/toolchain/check/testdata/const/import.carbon +++ b/toolchain/check/testdata/const/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/const/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/const/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/eval/aggregate.carbon b/toolchain/check/testdata/eval/aggregate.carbon index 2fca16d6f4b2..a0589434f279 100644 --- a/toolchain/check/testdata/eval/aggregate.carbon +++ b/toolchain/check/testdata/eval/aggregate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/aggregate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/aggregate.carbon var tuple_copy: (i32, i32) = (1, 2) as (i32, i32); @@ -58,52 +62,52 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_18: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_26.1: (type, type) = tuple_literal (%int.make_type_32.loc7_18, %int.make_type_32.loc7_23) -// CHECK:STDOUT: %.loc7_26.2: type = value_of_initializer %int.make_type_32.loc7_18 [template = i32] -// CHECK:STDOUT: %.loc7_26.3: type = converted %int.make_type_32.loc7_18, %.loc7_26.2 [template = i32] -// CHECK:STDOUT: %.loc7_26.4: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] -// CHECK:STDOUT: %.loc7_26.5: type = converted %int.make_type_32.loc7_23, %.loc7_26.4 [template = i32] -// CHECK:STDOUT: %.loc7_26.6: type = converted %.loc7_26.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_26.1: (type, type) = tuple_literal (%int.make_type_32.loc11_18, %int.make_type_32.loc11_23) +// CHECK:STDOUT: %.loc11_26.2: type = value_of_initializer %int.make_type_32.loc11_18 [template = i32] +// CHECK:STDOUT: %.loc11_26.3: type = converted %int.make_type_32.loc11_18, %.loc11_26.2 [template = i32] +// CHECK:STDOUT: %.loc11_26.4: type = value_of_initializer %int.make_type_32.loc11_23 [template = i32] +// CHECK:STDOUT: %.loc11_26.5: type = converted %int.make_type_32.loc11_23, %.loc11_26.4 [template = i32] +// CHECK:STDOUT: %.loc11_26.6: type = converted %.loc11_26.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %tuple_copy.var: ref (i32, i32) = var tuple_copy // CHECK:STDOUT: %tuple_copy: ref (i32, i32) = bind_name tuple_copy, %tuple_copy.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc9_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_23.1: type = value_of_initializer %int.make_type_32.loc9_23 [template = i32] -// CHECK:STDOUT: %.loc9_23.2: type = converted %int.make_type_32.loc9_23, %.loc9_23.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_23.1: type = value_of_initializer %int.make_type_32.loc13_23 [template = i32] +// CHECK:STDOUT: %.loc13_23.2: type = converted %int.make_type_32.loc13_23, %.loc13_23.1 [template = i32] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc9_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_32.1: type = value_of_initializer %int.make_type_32.loc9_32 [template = i32] -// CHECK:STDOUT: %.loc9_32.2: type = converted %int.make_type_32.loc9_32, %.loc9_32.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_32.1: type = value_of_initializer %int.make_type_32.loc13_32 [template = i32] +// CHECK:STDOUT: %.loc13_32.2: type = converted %int.make_type_32.loc13_32, %.loc13_32.1 [template = i32] // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc9_41: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_41.1: type = value_of_initializer %int.make_type_32.loc9_41 [template = i32] -// CHECK:STDOUT: %.loc9_41.2: type = converted %int.make_type_32.loc9_41, %.loc9_41.1 [template = i32] -// CHECK:STDOUT: %.loc9_44: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.7] +// CHECK:STDOUT: %int.make_type_32.loc13_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_41.1: type = value_of_initializer %int.make_type_32.loc13_41 [template = i32] +// CHECK:STDOUT: %.loc13_41.2: type = converted %int.make_type_32.loc13_41, %.loc13_41.1 [template = i32] +// CHECK:STDOUT: %.loc13_44: type = struct_type {.a: i32, .b: i32, .c: i32} [template = constants.%.7] // CHECK:STDOUT: %struct_copy.var: ref {.a: i32, .b: i32, .c: i32} = var struct_copy // CHECK:STDOUT: %struct_copy: ref {.a: i32, .b: i32, .c: i32} = bind_name struct_copy, %struct_copy.var // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11, %.loc11_19.1 [template = i32] -// CHECK:STDOUT: %.loc11_25: type = array_type %.loc11_24, i32 [template = constants.%.13] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_24: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_19.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_19.2: type = converted %int.make_type_32.loc15, %.loc15_19.1 [template = i32] +// CHECK:STDOUT: %.loc15_25: type = array_type %.loc15_24, i32 [template = constants.%.13] // CHECK:STDOUT: %tuple_index.var: ref [i32; 1] = var tuple_index // CHECK:STDOUT: %tuple_index: ref [i32; 1] = bind_name tuple_index, %tuple_index.var // CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_26: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_21.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] -// CHECK:STDOUT: %.loc13_27: type = array_type %.loc13_26, i32 [template = constants.%.13] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_26: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] +// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.13] // CHECK:STDOUT: %struct_access.var: ref [i32; 1] = var struct_access // CHECK:STDOUT: %struct_access: ref [i32; 1] = bind_name struct_access, %struct_access.var // CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -113,93 +117,93 @@ var struct_access: [i32; 1] = (0,) as [i32; {.a = 3, .b = 1}.b]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_31: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_34: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_35.1: (i32, i32) = tuple_literal (%.loc7_31, %.loc7_34) -// CHECK:STDOUT: %int.make_type_32.loc7_41: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_46: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_49.1: (type, type) = tuple_literal (%int.make_type_32.loc7_41, %int.make_type_32.loc7_46) -// CHECK:STDOUT: %.loc7_49.2: type = value_of_initializer %int.make_type_32.loc7_41 [template = i32] -// CHECK:STDOUT: %.loc7_49.3: type = converted %int.make_type_32.loc7_41, %.loc7_49.2 [template = i32] -// CHECK:STDOUT: %.loc7_49.4: type = value_of_initializer %int.make_type_32.loc7_46 [template = i32] -// CHECK:STDOUT: %.loc7_49.5: type = converted %int.make_type_32.loc7_46, %.loc7_49.4 [template = i32] -// CHECK:STDOUT: %.loc7_49.6: type = converted %.loc7_49.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_35.2: ref i32 = tuple_access file.%tuple_copy.var, element0 -// CHECK:STDOUT: %.loc7_35.3: init i32 = initialize_from %.loc7_31 to %.loc7_35.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_35.4: ref i32 = tuple_access file.%tuple_copy.var, element1 -// CHECK:STDOUT: %.loc7_35.5: init i32 = initialize_from %.loc7_34 to %.loc7_35.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_35.6: init (i32, i32) = tuple_init (%.loc7_35.3, %.loc7_35.5) to file.%tuple_copy.var [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc7_50: init (i32, i32) = converted %.loc7_35.1, %.loc7_35.6 [template = constants.%tuple.1] -// CHECK:STDOUT: assign file.%tuple_copy.var, %.loc7_50 -// CHECK:STDOUT: %.loc9_54: i32 = int_literal 3 [template = constants.%.9] -// CHECK:STDOUT: %.loc9_62: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_70: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_71: {.c: i32, .b: i32, .a: i32} = struct_literal (%.loc9_54, %.loc9_62, %.loc9_70) -// CHECK:STDOUT: %int.make_type_32.loc9_81: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_81.1: type = value_of_initializer %int.make_type_32.loc9_81 [template = i32] -// CHECK:STDOUT: %.loc9_81.2: type = converted %int.make_type_32.loc9_81, %.loc9_81.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc9_90: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_90.1: type = value_of_initializer %int.make_type_32.loc9_90 [template = i32] -// CHECK:STDOUT: %.loc9_90.2: type = converted %int.make_type_32.loc9_90, %.loc9_90.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc9_99: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_99.1: type = value_of_initializer %int.make_type_32.loc9_99 [template = i32] -// CHECK:STDOUT: %.loc9_99.2: type = converted %int.make_type_32.loc9_99, %.loc9_99.1 [template = i32] -// CHECK:STDOUT: %.loc9_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.11] -// CHECK:STDOUT: %struct.loc9: {.b: i32, .a: i32, .c: i32} = struct_value (%.loc9_62, %.loc9_70, %.loc9_54) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_73.1: {.b: i32, .a: i32, .c: i32} = converted %.loc9_71, %struct.loc9 [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_73.2: i32 = struct_access %.loc9_73.1, element1 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_73.3: ref i32 = struct_access file.%struct_copy.var, element1 -// CHECK:STDOUT: %.loc9_73.4: init i32 = initialize_from %.loc9_73.2 to %.loc9_73.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_73.5: i32 = struct_access %.loc9_73.1, element0 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_73.6: ref i32 = struct_access file.%struct_copy.var, element0 -// CHECK:STDOUT: %.loc9_73.7: init i32 = initialize_from %.loc9_73.5 to %.loc9_73.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_73.8: i32 = struct_access %.loc9_73.1, element2 [template = constants.%.9] -// CHECK:STDOUT: %.loc9_73.9: ref i32 = struct_access file.%struct_copy.var, element2 -// CHECK:STDOUT: %.loc9_73.10: init i32 = initialize_from %.loc9_73.8 to %.loc9_73.9 [template = constants.%.9] -// CHECK:STDOUT: %.loc9_73.11: init {.a: i32, .b: i32, .c: i32} = struct_init (%.loc9_73.4, %.loc9_73.7, %.loc9_73.10) to file.%struct_copy.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc9_103: init {.a: i32, .b: i32, .c: i32} = converted %.loc9_73.1, %.loc9_73.11 [template = constants.%struct.3] -// CHECK:STDOUT: assign file.%struct_copy.var, %.loc9_103 -// CHECK:STDOUT: %.loc11_30: i32 = int_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %.loc11_32.1: (i32,) = tuple_literal (%.loc11_30) -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_44: i32 = int_literal 5 [template = constants.%.17] -// CHECK:STDOUT: %.loc11_47: i32 = int_literal 7 [template = constants.%.18] -// CHECK:STDOUT: %.loc11_50: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_53: i32 = int_literal 9 [template = constants.%.19] -// CHECK:STDOUT: %.loc11_54.1: (i32, i32, i32, i32) = tuple_literal (%.loc11_44, %.loc11_47, %.loc11_50, %.loc11_53) -// CHECK:STDOUT: %.loc11_56: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %tuple: (i32, i32, i32, i32) = tuple_value (%.loc11_44, %.loc11_47, %.loc11_50, %.loc11_53) [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc11_54.2: (i32, i32, i32, i32) = converted %.loc11_54.1, %tuple [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc11_57: i32 = tuple_index %.loc11_54.2, %.loc11_56 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_38.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_38.2: type = converted %int.make_type_32.loc11, %.loc11_38.1 [template = i32] -// CHECK:STDOUT: %.loc11_58: type = array_type %.loc11_57, i32 [template = constants.%.13] -// CHECK:STDOUT: %.loc11_5: ref [i32; 1] = splice_block file.%tuple_index.var {} -// CHECK:STDOUT: %.loc11_32.2: i32 = int_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %.loc11_32.3: ref i32 = array_index %.loc11_5, %.loc11_32.2 -// CHECK:STDOUT: %.loc11_32.4: init i32 = initialize_from %.loc11_30 to %.loc11_32.3 [template = constants.%.15] -// CHECK:STDOUT: %.loc11_32.5: init [i32; 1] = array_init (%.loc11_32.4) to %.loc11_5 [template = constants.%array] -// CHECK:STDOUT: %.loc11_34: init [i32; 1] = converted %.loc11_32.1, %.loc11_32.5 [template = constants.%array] -// CHECK:STDOUT: assign file.%tuple_index.var, %.loc11_34 -// CHECK:STDOUT: %.loc13_32: i32 = int_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %.loc13_34.1: (i32,) = tuple_literal (%.loc13_32) -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_51: i32 = int_literal 3 [template = constants.%.9] -// CHECK:STDOUT: %.loc13_59: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_60.1: {.a: i32, .b: i32} = struct_literal (%.loc13_51, %.loc13_59) -// CHECK:STDOUT: %struct.loc13: {.a: i32, .b: i32} = struct_value (%.loc13_51, %.loc13_59) [template = constants.%struct.4] -// CHECK:STDOUT: %.loc13_60.2: {.a: i32, .b: i32} = converted %.loc13_60.1, %struct.loc13 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc13_61: i32 = struct_access %.loc13_60.2, element1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_40.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_40.2: type = converted %int.make_type_32.loc13, %.loc13_40.1 [template = i32] -// CHECK:STDOUT: %.loc13_63: type = array_type %.loc13_61, i32 [template = constants.%.13] -// CHECK:STDOUT: %.loc13_5: ref [i32; 1] = splice_block file.%struct_access.var {} -// CHECK:STDOUT: %.loc13_34.2: i32 = int_literal 0 [template = constants.%.15] -// CHECK:STDOUT: %.loc13_34.3: ref i32 = array_index %.loc13_5, %.loc13_34.2 -// CHECK:STDOUT: %.loc13_34.4: init i32 = initialize_from %.loc13_32 to %.loc13_34.3 [template = constants.%.15] -// CHECK:STDOUT: %.loc13_34.5: init [i32; 1] = array_init (%.loc13_34.4) to %.loc13_5 [template = constants.%array] -// CHECK:STDOUT: %.loc13_36: init [i32; 1] = converted %.loc13_34.1, %.loc13_34.5 [template = constants.%array] -// CHECK:STDOUT: assign file.%struct_access.var, %.loc13_36 +// CHECK:STDOUT: %.loc11_31: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_34: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_35.1: (i32, i32) = tuple_literal (%.loc11_31, %.loc11_34) +// CHECK:STDOUT: %int.make_type_32.loc11_41: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_46: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_49.1: (type, type) = tuple_literal (%int.make_type_32.loc11_41, %int.make_type_32.loc11_46) +// CHECK:STDOUT: %.loc11_49.2: type = value_of_initializer %int.make_type_32.loc11_41 [template = i32] +// CHECK:STDOUT: %.loc11_49.3: type = converted %int.make_type_32.loc11_41, %.loc11_49.2 [template = i32] +// CHECK:STDOUT: %.loc11_49.4: type = value_of_initializer %int.make_type_32.loc11_46 [template = i32] +// CHECK:STDOUT: %.loc11_49.5: type = converted %int.make_type_32.loc11_46, %.loc11_49.4 [template = i32] +// CHECK:STDOUT: %.loc11_49.6: type = converted %.loc11_49.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_35.2: ref i32 = tuple_access file.%tuple_copy.var, element0 +// CHECK:STDOUT: %.loc11_35.3: init i32 = initialize_from %.loc11_31 to %.loc11_35.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_35.4: ref i32 = tuple_access file.%tuple_copy.var, element1 +// CHECK:STDOUT: %.loc11_35.5: init i32 = initialize_from %.loc11_34 to %.loc11_35.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_35.6: init (i32, i32) = tuple_init (%.loc11_35.3, %.loc11_35.5) to file.%tuple_copy.var [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_50: init (i32, i32) = converted %.loc11_35.1, %.loc11_35.6 [template = constants.%tuple.1] +// CHECK:STDOUT: assign file.%tuple_copy.var, %.loc11_50 +// CHECK:STDOUT: %.loc13_54: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_62: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_70: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_71: {.c: i32, .b: i32, .a: i32} = struct_literal (%.loc13_54, %.loc13_62, %.loc13_70) +// CHECK:STDOUT: %int.make_type_32.loc13_81: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_81.1: type = value_of_initializer %int.make_type_32.loc13_81 [template = i32] +// CHECK:STDOUT: %.loc13_81.2: type = converted %int.make_type_32.loc13_81, %.loc13_81.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_90: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_90.1: type = value_of_initializer %int.make_type_32.loc13_90 [template = i32] +// CHECK:STDOUT: %.loc13_90.2: type = converted %int.make_type_32.loc13_90, %.loc13_90.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_99: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_99.1: type = value_of_initializer %int.make_type_32.loc13_99 [template = i32] +// CHECK:STDOUT: %.loc13_99.2: type = converted %int.make_type_32.loc13_99, %.loc13_99.1 [template = i32] +// CHECK:STDOUT: %.loc13_102: type = struct_type {.b: i32, .a: i32, .c: i32} [template = constants.%.11] +// CHECK:STDOUT: %struct.loc13: {.b: i32, .a: i32, .c: i32} = struct_value (%.loc13_62, %.loc13_70, %.loc13_54) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_73.1: {.b: i32, .a: i32, .c: i32} = converted %.loc13_71, %struct.loc13 [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_73.2: i32 = struct_access %.loc13_73.1, element1 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_73.3: ref i32 = struct_access file.%struct_copy.var, element1 +// CHECK:STDOUT: %.loc13_73.4: init i32 = initialize_from %.loc13_73.2 to %.loc13_73.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_73.5: i32 = struct_access %.loc13_73.1, element0 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_73.6: ref i32 = struct_access file.%struct_copy.var, element0 +// CHECK:STDOUT: %.loc13_73.7: init i32 = initialize_from %.loc13_73.5 to %.loc13_73.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_73.8: i32 = struct_access %.loc13_73.1, element2 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_73.9: ref i32 = struct_access file.%struct_copy.var, element2 +// CHECK:STDOUT: %.loc13_73.10: init i32 = initialize_from %.loc13_73.8 to %.loc13_73.9 [template = constants.%.9] +// CHECK:STDOUT: %.loc13_73.11: init {.a: i32, .b: i32, .c: i32} = struct_init (%.loc13_73.4, %.loc13_73.7, %.loc13_73.10) to file.%struct_copy.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc13_103: init {.a: i32, .b: i32, .c: i32} = converted %.loc13_73.1, %.loc13_73.11 [template = constants.%struct.3] +// CHECK:STDOUT: assign file.%struct_copy.var, %.loc13_103 +// CHECK:STDOUT: %.loc15_30: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc15_32.1: (i32,) = tuple_literal (%.loc15_30) +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_44: i32 = int_literal 5 [template = constants.%.17] +// CHECK:STDOUT: %.loc15_47: i32 = int_literal 7 [template = constants.%.18] +// CHECK:STDOUT: %.loc15_50: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_53: i32 = int_literal 9 [template = constants.%.19] +// CHECK:STDOUT: %.loc15_54.1: (i32, i32, i32, i32) = tuple_literal (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) +// CHECK:STDOUT: %.loc15_56: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %tuple: (i32, i32, i32, i32) = tuple_value (%.loc15_44, %.loc15_47, %.loc15_50, %.loc15_53) [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc15_54.2: (i32, i32, i32, i32) = converted %.loc15_54.1, %tuple [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc15_57: i32 = tuple_index %.loc15_54.2, %.loc15_56 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_38.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_38.2: type = converted %int.make_type_32.loc15, %.loc15_38.1 [template = i32] +// CHECK:STDOUT: %.loc15_58: type = array_type %.loc15_57, i32 [template = constants.%.13] +// CHECK:STDOUT: %.loc15_5: ref [i32; 1] = splice_block file.%tuple_index.var {} +// CHECK:STDOUT: %.loc15_32.2: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc15_32.3: ref i32 = array_index %.loc15_5, %.loc15_32.2 +// CHECK:STDOUT: %.loc15_32.4: init i32 = initialize_from %.loc15_30 to %.loc15_32.3 [template = constants.%.15] +// CHECK:STDOUT: %.loc15_32.5: init [i32; 1] = array_init (%.loc15_32.4) to %.loc15_5 [template = constants.%array] +// CHECK:STDOUT: %.loc15_34: init [i32; 1] = converted %.loc15_32.1, %.loc15_32.5 [template = constants.%array] +// CHECK:STDOUT: assign file.%tuple_index.var, %.loc15_34 +// CHECK:STDOUT: %.loc17_32: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc17_34.1: (i32,) = tuple_literal (%.loc17_32) +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_51: i32 = int_literal 3 [template = constants.%.9] +// CHECK:STDOUT: %.loc17_59: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_60.1: {.a: i32, .b: i32} = struct_literal (%.loc17_51, %.loc17_59) +// CHECK:STDOUT: %struct.loc17: {.a: i32, .b: i32} = struct_value (%.loc17_51, %.loc17_59) [template = constants.%struct.4] +// CHECK:STDOUT: %.loc17_60.2: {.a: i32, .b: i32} = converted %.loc17_60.1, %struct.loc17 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc17_61: i32 = struct_access %.loc17_60.2, element1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_40.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_40.2: type = converted %int.make_type_32.loc17, %.loc17_40.1 [template = i32] +// CHECK:STDOUT: %.loc17_63: type = array_type %.loc17_61, i32 [template = constants.%.13] +// CHECK:STDOUT: %.loc17_5: ref [i32; 1] = splice_block file.%struct_access.var {} +// CHECK:STDOUT: %.loc17_34.2: i32 = int_literal 0 [template = constants.%.15] +// CHECK:STDOUT: %.loc17_34.3: ref i32 = array_index %.loc17_5, %.loc17_34.2 +// CHECK:STDOUT: %.loc17_34.4: init i32 = initialize_from %.loc17_32 to %.loc17_34.3 [template = constants.%.15] +// CHECK:STDOUT: %.loc17_34.5: init [i32; 1] = array_init (%.loc17_34.4) to %.loc17_5 [template = constants.%array] +// CHECK:STDOUT: %.loc17_36: init [i32; 1] = converted %.loc17_34.1, %.loc17_34.5 [template = constants.%array] +// CHECK:STDOUT: assign file.%struct_access.var, %.loc17_36 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/eval/fail_aggregate.carbon b/toolchain/check/testdata/eval/fail_aggregate.carbon index b47b3f185d1a..2a9ca2774d29 100644 --- a/toolchain/check/testdata/eval/fail_aggregate.carbon +++ b/toolchain/check/testdata/eval/fail_aggregate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/fail_aggregate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/fail_aggregate.carbon // TODO: This creates an array temporary, which we don't yet support evaluating. @@ -42,10 +46,10 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_24: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32, %.loc12_19.1 [template = i32] -// CHECK:STDOUT: %.loc12_25: type = array_type %.loc12_24, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc16_24: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32, %.loc16_19.1 [template = i32] +// CHECK:STDOUT: %.loc16_25: type = array_type %.loc16_24, i32 [template = constants.%.3] // CHECK:STDOUT: %array_index.var: ref [i32; 1] = var array_index // CHECK:STDOUT: %array_index: ref [i32; 1] = bind_name array_index, %array_index.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] @@ -56,38 +60,38 @@ var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_30: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_32: (i32,) = tuple_literal (%.loc12_30) -// CHECK:STDOUT: %int.make_type_32.loc12_38: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_45: i32 = int_literal 5 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_48: i32 = int_literal 7 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_51: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_54: i32 = int_literal 9 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_55.1: (i32, i32, i32, i32) = tuple_literal (%.loc12_45, %.loc12_48, %.loc12_51, %.loc12_54) -// CHECK:STDOUT: %int.make_type_32.loc12_61: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_66: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: %.loc12_61.1: type = value_of_initializer %int.make_type_32.loc12_61 [template = i32] -// CHECK:STDOUT: %.loc12_61.2: type = converted %int.make_type_32.loc12_61, %.loc12_61.1 [template = i32] -// CHECK:STDOUT: %.loc12_67: type = array_type %.loc12_66, i32 [template = constants.%.12] -// CHECK:STDOUT: %.loc12_55.2: ref [i32; 4] = temporary_storage -// CHECK:STDOUT: %.loc12_55.3: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_55.4: ref i32 = array_index %.loc12_55.2, %.loc12_55.3 -// CHECK:STDOUT: %.loc12_55.5: init i32 = initialize_from %.loc12_45 to %.loc12_55.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc12_55.6: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_55.7: ref i32 = array_index %.loc12_55.2, %.loc12_55.6 -// CHECK:STDOUT: %.loc12_55.8: init i32 = initialize_from %.loc12_48 to %.loc12_55.7 [template = constants.%.8] -// CHECK:STDOUT: %.loc12_55.9: i32 = int_literal 2 [template = constants.%.14] -// CHECK:STDOUT: %.loc12_55.10: ref i32 = array_index %.loc12_55.2, %.loc12_55.9 -// CHECK:STDOUT: %.loc12_55.11: init i32 = initialize_from %.loc12_51 to %.loc12_55.10 [template = constants.%.2] -// CHECK:STDOUT: %.loc12_55.12: i32 = int_literal 3 [template = constants.%.15] -// CHECK:STDOUT: %.loc12_55.13: ref i32 = array_index %.loc12_55.2, %.loc12_55.12 -// CHECK:STDOUT: %.loc12_55.14: init i32 = initialize_from %.loc12_54 to %.loc12_55.13 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_55.15: init [i32; 4] = array_init (%.loc12_55.5, %.loc12_55.8, %.loc12_55.11, %.loc12_55.14) to %.loc12_55.2 [template = constants.%array] -// CHECK:STDOUT: %.loc12_57.1: init [i32; 4] = converted %.loc12_55.1, %.loc12_55.15 [template = constants.%array] -// CHECK:STDOUT: %.loc12_70: i32 = int_literal 2 [template = constants.%.14] -// CHECK:STDOUT: %.loc12_57.2: ref [i32; 4] = temporary %.loc12_55.2, %.loc12_57.1 -// CHECK:STDOUT: %.loc12_71.1: ref i32 = array_index %.loc12_57.2, %.loc12_70 -// CHECK:STDOUT: %.loc12_71.2: i32 = bind_value %.loc12_71.1 +// CHECK:STDOUT: %.loc16_30: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_32: (i32,) = tuple_literal (%.loc16_30) +// CHECK:STDOUT: %int.make_type_32.loc16_38: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_45: i32 = int_literal 5 [template = constants.%.7] +// CHECK:STDOUT: %.loc16_48: i32 = int_literal 7 [template = constants.%.8] +// CHECK:STDOUT: %.loc16_51: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_54: i32 = int_literal 9 [template = constants.%.9] +// CHECK:STDOUT: %.loc16_55.1: (i32, i32, i32, i32) = tuple_literal (%.loc16_45, %.loc16_48, %.loc16_51, %.loc16_54) +// CHECK:STDOUT: %int.make_type_32.loc16_61: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_66: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: %.loc16_61.1: type = value_of_initializer %int.make_type_32.loc16_61 [template = i32] +// CHECK:STDOUT: %.loc16_61.2: type = converted %int.make_type_32.loc16_61, %.loc16_61.1 [template = i32] +// CHECK:STDOUT: %.loc16_67: type = array_type %.loc16_66, i32 [template = constants.%.12] +// CHECK:STDOUT: %.loc16_55.2: ref [i32; 4] = temporary_storage +// CHECK:STDOUT: %.loc16_55.3: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_55.4: ref i32 = array_index %.loc16_55.2, %.loc16_55.3 +// CHECK:STDOUT: %.loc16_55.5: init i32 = initialize_from %.loc16_45 to %.loc16_55.4 [template = constants.%.7] +// CHECK:STDOUT: %.loc16_55.6: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_55.7: ref i32 = array_index %.loc16_55.2, %.loc16_55.6 +// CHECK:STDOUT: %.loc16_55.8: init i32 = initialize_from %.loc16_48 to %.loc16_55.7 [template = constants.%.8] +// CHECK:STDOUT: %.loc16_55.9: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc16_55.10: ref i32 = array_index %.loc16_55.2, %.loc16_55.9 +// CHECK:STDOUT: %.loc16_55.11: init i32 = initialize_from %.loc16_51 to %.loc16_55.10 [template = constants.%.2] +// CHECK:STDOUT: %.loc16_55.12: i32 = int_literal 3 [template = constants.%.15] +// CHECK:STDOUT: %.loc16_55.13: ref i32 = array_index %.loc16_55.2, %.loc16_55.12 +// CHECK:STDOUT: %.loc16_55.14: init i32 = initialize_from %.loc16_54 to %.loc16_55.13 [template = constants.%.9] +// CHECK:STDOUT: %.loc16_55.15: init [i32; 4] = array_init (%.loc16_55.5, %.loc16_55.8, %.loc16_55.11, %.loc16_55.14) to %.loc16_55.2 [template = constants.%array] +// CHECK:STDOUT: %.loc16_57.1: init [i32; 4] = converted %.loc16_55.1, %.loc16_55.15 [template = constants.%array] +// CHECK:STDOUT: %.loc16_70: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc16_57.2: ref [i32; 4] = temporary %.loc16_55.2, %.loc16_57.1 +// CHECK:STDOUT: %.loc16_71.1: ref i32 = array_index %.loc16_57.2, %.loc16_70 +// CHECK:STDOUT: %.loc16_71.2: i32 = bind_value %.loc16_71.1 // CHECK:STDOUT: assign file.%array_index.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/eval/fail_symbolic.carbon b/toolchain/check/testdata/eval/fail_symbolic.carbon index 3fe12630c50b..79b54b0879ec 100644 --- a/toolchain/check/testdata/eval/fail_symbolic.carbon +++ b/toolchain/check/testdata/eval/fail_symbolic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/fail_symbolic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/fail_symbolic.carbon // TODO: This should work. fn G(N:! i32) { @@ -32,10 +36,10 @@ fn G(N:! i32) { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %N.loc8_6.1: i32 = param N -// CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N 0, %N.loc8_6.1 [symbolic = constants.%N] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %N.loc12_6.1: i32 = param N +// CHECK:STDOUT: @G.%N: i32 = bind_symbolic_name N 0, %N.loc12_6.1 [symbolic = constants.%N] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } @@ -46,9 +50,9 @@ fn G(N:! i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %N.ref: i32 = name_ref N, %N [symbolic = constants.%N] -// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32, %.loc12_11.1 [template = i32] -// CHECK:STDOUT: %.loc12_17: type = array_type %N.ref, i32 [template = ] +// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_11.2: type = converted %int.make_type_32, %.loc16_11.1 [template = i32] +// CHECK:STDOUT: %.loc16_17: type = array_type %N.ref, i32 [template = ] // CHECK:STDOUT: %k.var: ref = var k // CHECK:STDOUT: %k: ref = bind_name k, %k.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/eval/symbolic.carbon b/toolchain/check/testdata/eval/symbolic.carbon index b81195911b1a..de23cf8e7739 100644 --- a/toolchain/check/testdata/eval/symbolic.carbon +++ b/toolchain/check/testdata/eval/symbolic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/symbolic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/symbolic.carbon // Check that we propagate the `symbolic` tag through evaluations. fn F(T:! type) { @@ -37,28 +41,28 @@ fn F(T:! type) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %T.loc8_6.1: type = param T -// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc8_6.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc12_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc12_6.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc9_11: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9_12: type = ptr_type T [symbolic = constants.%.2] -// CHECK:STDOUT: %T.ref.loc9_21: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9_15: type = const_type T [symbolic = constants.%.3] -// CHECK:STDOUT: %.loc9_22.1: (type, type) = tuple_literal (%.loc9_12, %.loc9_15) -// CHECK:STDOUT: %.loc9_22.2: type = converted %.loc9_22.1, constants.%.5 [symbolic = constants.%.5] +// CHECK:STDOUT: %T.ref.loc13_11: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc13_12: type = ptr_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %T.ref.loc13_21: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc13_15: type = const_type T [symbolic = constants.%.3] +// CHECK:STDOUT: %.loc13_22.1: (type, type) = tuple_literal (%.loc13_12, %.loc13_15) +// CHECK:STDOUT: %.loc13_22.2: type = converted %.loc13_22.1, constants.%.5 [symbolic = constants.%.5] // CHECK:STDOUT: %u.var: ref (T*, const T) = var u // CHECK:STDOUT: %u: ref (T*, const T) = bind_name u, %u.var -// CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc10: type = struct_type {.a: T} [symbolic = constants.%.8] +// CHECK:STDOUT: %T.ref.loc14: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc14: type = struct_type {.a: T} [symbolic = constants.%.8] // CHECK:STDOUT: %v.var: ref {.a: T} = var v // CHECK:STDOUT: %v: ref {.a: T} = bind_name v, %v.var -// CHECK:STDOUT: %T.ref.loc11: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 5 [template = constants.%.9] -// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, T [symbolic = constants.%.10] +// CHECK:STDOUT: %T.ref.loc15: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc15_14: i32 = int_literal 5 [template = constants.%.9] +// CHECK:STDOUT: %.loc15_15: type = array_type %.loc15_14, T [symbolic = constants.%.10] // CHECK:STDOUT: %w.var: ref [T; 5] = var w // CHECK:STDOUT: %w: ref [T; 5] = bind_name w, %w.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon index b7bbdf94aa49..f693311023f2 100644 --- a/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +++ b/toolchain/check/testdata/expr_category/in_place_tuple_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/expr_category/in_place_tuple_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/expr_category/in_place_tuple_init.carbon fn F() -> (i32, i32); @@ -45,36 +49,36 @@ fn H() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_20.1: (type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17) -// CHECK:STDOUT: %.loc7_20.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_20.3: type = converted %int.make_type_32.loc7_12, %.loc7_20.2 [template = i32] -// CHECK:STDOUT: %.loc7_20.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_20.5: type = converted %int.make_type_32.loc7_17, %.loc7_20.4 [template = i32] -// CHECK:STDOUT: %.loc7_20.6: type = converted %.loc7_20.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_20.1: (type, type) = tuple_literal (%int.make_type_32.loc11_12, %int.make_type_32.loc11_17) +// CHECK:STDOUT: %.loc11_20.2: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_20.3: type = converted %int.make_type_32.loc11_12, %.loc11_20.2 [template = i32] +// CHECK:STDOUT: %.loc11_20.4: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_20.5: type = converted %int.make_type_32.loc11_17, %.loc11_20.4 [template = i32] +// CHECK:STDOUT: %.loc11_20.6: type = converted %.loc11_20.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc9_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_20.1: (type, type) = tuple_literal (%int.make_type_32.loc9_12, %int.make_type_32.loc9_17) -// CHECK:STDOUT: %.loc9_20.2: type = value_of_initializer %int.make_type_32.loc9_12 [template = i32] -// CHECK:STDOUT: %.loc9_20.3: type = converted %int.make_type_32.loc9_12, %.loc9_20.2 [template = i32] -// CHECK:STDOUT: %.loc9_20.4: type = value_of_initializer %int.make_type_32.loc9_17 [template = i32] -// CHECK:STDOUT: %.loc9_20.5: type = converted %int.make_type_32.loc9_17, %.loc9_20.4 [template = i32] -// CHECK:STDOUT: %.loc9_20.6: type = converted %.loc9_20.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc13_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_20.1: (type, type) = tuple_literal (%int.make_type_32.loc13_12, %int.make_type_32.loc13_17) +// CHECK:STDOUT: %.loc13_20.2: type = value_of_initializer %int.make_type_32.loc13_12 [template = i32] +// CHECK:STDOUT: %.loc13_20.3: type = converted %int.make_type_32.loc13_12, %.loc13_20.2 [template = i32] +// CHECK:STDOUT: %.loc13_20.4: type = value_of_initializer %int.make_type_32.loc13_17 [template = i32] +// CHECK:STDOUT: %.loc13_20.5: type = converted %int.make_type_32.loc13_17, %.loc13_20.4 [template = i32] +// CHECK:STDOUT: %.loc13_20.6: type = converted %.loc13_20.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @G.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32.loc19, %.loc19_11.1 [template = i32] // CHECK:STDOUT: @H.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -85,40 +89,40 @@ fn H() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_19.1: (type, type) = tuple_literal (%int.make_type_32.loc10_11, %int.make_type_32.loc10_16) -// CHECK:STDOUT: %.loc10_19.2: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] -// CHECK:STDOUT: %.loc10_19.3: type = converted %int.make_type_32.loc10_11, %.loc10_19.2 [template = i32] -// CHECK:STDOUT: %.loc10_19.4: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] -// CHECK:STDOUT: %.loc10_19.5: type = converted %int.make_type_32.loc10_16, %.loc10_19.4 [template = i32] -// CHECK:STDOUT: %.loc10_19.6: type = converted %.loc10_19.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (%int.make_type_32.loc14_11, %int.make_type_32.loc14_16) +// CHECK:STDOUT: %.loc14_19.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_19.3: type = converted %int.make_type_32.loc14_11, %.loc14_19.2 [template = i32] +// CHECK:STDOUT: %.loc14_19.4: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_19.5: type = converted %int.make_type_32.loc14_16, %.loc14_19.4 [template = i32] +// CHECK:STDOUT: %.loc14_19.6: type = converted %.loc14_19.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref (i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_7: ref (i32, i32) = splice_block %v.var {} -// CHECK:STDOUT: %F.call.loc10: init (i32, i32) = call %F.ref.loc10() to %.loc10_7 -// CHECK:STDOUT: assign %v.var, %F.call.loc10 +// CHECK:STDOUT: %F.ref.loc14: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_7: ref (i32, i32) = splice_block %v.var {} +// CHECK:STDOUT: %F.call.loc14: init (i32, i32) = call %F.ref.loc14() to %.loc14_7 +// CHECK:STDOUT: assign %v.var, %F.call.loc14 // CHECK:STDOUT: %v.ref: ref (i32, i32) = name_ref v, %v -// CHECK:STDOUT: %F.ref.loc11: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11: ref (i32, i32) = splice_block %v.ref {} -// CHECK:STDOUT: %F.call.loc11: init (i32, i32) = call %F.ref.loc11() to %.loc11 -// CHECK:STDOUT: assign %v.ref, %F.call.loc11 -// CHECK:STDOUT: %F.ref.loc12: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9: ref (i32, i32) = splice_block %return {} -// CHECK:STDOUT: %F.call.loc12: init (i32, i32) = call %F.ref.loc12() to %.loc9 -// CHECK:STDOUT: return %F.call.loc12 to %return +// CHECK:STDOUT: %F.ref.loc15: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15: ref (i32, i32) = splice_block %v.ref {} +// CHECK:STDOUT: %F.call.loc15: init (i32, i32) = call %F.ref.loc15() to %.loc15 +// CHECK:STDOUT: assign %v.ref, %F.call.loc15 +// CHECK:STDOUT: %F.ref.loc16: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13: ref (i32, i32) = splice_block %return {} +// CHECK:STDOUT: %F.call.loc16: init (i32, i32) = call %F.ref.loc16() to %.loc13 +// CHECK:STDOUT: return %F.call.loc16 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc16_11.1: ref (i32, i32) = temporary_storage -// CHECK:STDOUT: %G.call: init (i32, i32) = call %G.ref() to %.loc16_11.1 -// CHECK:STDOUT: %.loc16_14: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc16_11.2: ref (i32, i32) = temporary %.loc16_11.1, %G.call -// CHECK:STDOUT: %.loc16_15.1: ref i32 = tuple_index %.loc16_11.2, %.loc16_14 -// CHECK:STDOUT: %.loc16_15.2: i32 = bind_value %.loc16_15.1 -// CHECK:STDOUT: return %.loc16_15.2 +// CHECK:STDOUT: %.loc20_11.1: ref (i32, i32) = temporary_storage +// CHECK:STDOUT: %G.call: init (i32, i32) = call %G.ref() to %.loc20_11.1 +// CHECK:STDOUT: %.loc20_14: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc20_11.2: ref (i32, i32) = temporary %.loc20_11.1, %G.call +// CHECK:STDOUT: %.loc20_15.1: ref i32 = tuple_index %.loc20_11.2, %.loc20_14 +// CHECK:STDOUT: %.loc20_15.2: i32 = bind_value %.loc20_15.1 +// CHECK:STDOUT: return %.loc20_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/call.carbon b/toolchain/check/testdata/function/builtin/call.carbon index 0e0c9346eb5c..8a93e55b3929 100644 --- a/toolchain/check/testdata/function/builtin/call.carbon +++ b/toolchain/check/testdata/function/builtin/call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/call.carbon fn Add(a: i32, b: i32) -> i32 = "int.sadd"; @@ -34,30 +38,30 @@ var arr: [i32; Add(1, 2)]; // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %int.make_type_32.loc7_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %int.make_type_32.loc7_27 [template = i32] -// CHECK:STDOUT: %.loc7_27.2: type = converted %int.make_type_32.loc7_27, %.loc7_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc11_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_27.1: type = value_of_initializer %int.make_type_32.loc11_27 [template = i32] +// CHECK:STDOUT: %.loc11_27.2: type = converted %int.make_type_32.loc11_27, %.loc11_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.4] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32.loc9, %.loc9_11.1 [template = i32] -// CHECK:STDOUT: %.loc9_25: type = array_type %int.sadd, i32 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_23: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc13_20, %.loc13_23) [template = constants.%.4] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] +// CHECK:STDOUT: %.loc13_25: type = array_type %int.sadd, i32 [template = constants.%.5] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/definition.carbon b/toolchain/check/testdata/function/builtin/definition.carbon index b745bdf3ac1f..dc0b72b9af6a 100644 --- a/toolchain/check/testdata/function/builtin/definition.carbon +++ b/toolchain/check/testdata/function/builtin/definition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/definition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/definition.carbon fn Add(a: i32, b: i32) -> i32 = "int.sadd"; @@ -26,19 +30,19 @@ fn Add(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1 -// CHECK:STDOUT: %int.make_type_32.loc7_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %int.make_type_32.loc7_27 [template = i32] -// CHECK:STDOUT: %.loc7_27.2: type = converted %int.make_type_32.loc7_27, %.loc7_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc11_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_27.1: type = value_of_initializer %int.make_type_32.loc11_27 [template = i32] +// CHECK:STDOUT: %.loc11_27.2: type = converted %int.make_type_32.loc11_27, %.loc11_27.1 [template = i32] // CHECK:STDOUT: @Add.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/builtin/fail_redefined.carbon b/toolchain/check/testdata/function/builtin/fail_redefined.carbon index 9854caca52ac..2859339ac2d6 100644 --- a/toolchain/check/testdata/function/builtin/fail_redefined.carbon +++ b/toolchain/check/testdata/function/builtin/fail_redefined.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/fail_redefined.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_redefined.carbon fn A(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDERR: fail_redefined.carbon:[[@LINE+7]]:1: ERROR: Redefinition of `fn A`. @@ -50,123 +54,123 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.decl.loc7 -// CHECK:STDOUT: .B = %B.decl.loc17 -// CHECK:STDOUT: .C = %C.decl.loc27 +// CHECK:STDOUT: .A = %A.decl.loc11 +// CHECK:STDOUT: .B = %B.decl.loc21 +// CHECK:STDOUT: .C = %C.decl.loc31 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %n.loc7_6.1: i32 = param n -// CHECK:STDOUT: %n.loc7_6.2: i32 = bind_name n, %n.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] -// CHECK:STDOUT: %m.loc7_14.1: i32 = param m -// CHECK:STDOUT: %m.loc7_14.2: i32 = bind_name m, %m.loc7_14.1 -// CHECK:STDOUT: %int.make_type_32.loc7_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_25 [template = i32] -// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_25, %.loc7_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc7: ref i32 = var +// CHECK:STDOUT: %A.decl.loc11: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_9, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %n.loc11_6.1: i32 = param n +// CHECK:STDOUT: %n.loc11_6.2: i32 = bind_name n, %n.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_17.2: type = converted %int.make_type_32.loc11_17, %.loc11_17.1 [template = i32] +// CHECK:STDOUT: %m.loc11_14.1: i32 = param m +// CHECK:STDOUT: %m.loc11_14.2: i32 = bind_name m, %m.loc11_14.1 +// CHECK:STDOUT: %int.make_type_32.loc11_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: type = value_of_initializer %int.make_type_32.loc11_25 [template = i32] +// CHECK:STDOUT: %.loc11_25.2: type = converted %int.make_type_32.loc11_25, %.loc11_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc11: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc15_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15_9 [template = i32] -// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15_9, %.loc15_9.1 [template = i32] -// CHECK:STDOUT: %n.loc15_6.1: i32 = param n -// CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc15_6.1 -// CHECK:STDOUT: %int.make_type_32.loc15_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_17.1: type = value_of_initializer %int.make_type_32.loc15_17 [template = i32] -// CHECK:STDOUT: %.loc15_17.2: type = converted %int.make_type_32.loc15_17, %.loc15_17.1 [template = i32] -// CHECK:STDOUT: %m.loc15_14.1: i32 = param m -// CHECK:STDOUT: @A.%m: i32 = bind_name m, %m.loc15_14.1 -// CHECK:STDOUT: %int.make_type_32.loc15_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_25.1: type = value_of_initializer %int.make_type_32.loc15_25 [template = i32] -// CHECK:STDOUT: %.loc15_25.2: type = converted %int.make_type_32.loc15_25, %.loc15_25.1 [template = i32] +// CHECK:STDOUT: %A.decl.loc19: A = fn_decl @A [template = constants.%struct.2] { +// CHECK:STDOUT: %int.make_type_32.loc19_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_9.1: type = value_of_initializer %int.make_type_32.loc19_9 [template = i32] +// CHECK:STDOUT: %.loc19_9.2: type = converted %int.make_type_32.loc19_9, %.loc19_9.1 [template = i32] +// CHECK:STDOUT: %n.loc19_6.1: i32 = param n +// CHECK:STDOUT: @A.%n: i32 = bind_name n, %n.loc19_6.1 +// CHECK:STDOUT: %int.make_type_32.loc19_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_17.1: type = value_of_initializer %int.make_type_32.loc19_17 [template = i32] +// CHECK:STDOUT: %.loc19_17.2: type = converted %int.make_type_32.loc19_17, %.loc19_17.1 [template = i32] +// CHECK:STDOUT: %m.loc19_14.1: i32 = param m +// CHECK:STDOUT: @A.%m: i32 = bind_name m, %m.loc19_14.1 +// CHECK:STDOUT: %int.make_type_32.loc19_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_25.1: type = value_of_initializer %int.make_type_32.loc19_25 [template = i32] +// CHECK:STDOUT: %.loc19_25.2: type = converted %int.make_type_32.loc19_25, %.loc19_25.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc17_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_9.1: type = value_of_initializer %int.make_type_32.loc17_9 [template = i32] -// CHECK:STDOUT: %.loc17_9.2: type = converted %int.make_type_32.loc17_9, %.loc17_9.1 [template = i32] -// CHECK:STDOUT: %n.loc17_6.1: i32 = param n -// CHECK:STDOUT: %n.loc17_6.2: i32 = bind_name n, %n.loc17_6.1 -// CHECK:STDOUT: %int.make_type_32.loc17_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_17.1: type = value_of_initializer %int.make_type_32.loc17_17 [template = i32] -// CHECK:STDOUT: %.loc17_17.2: type = converted %int.make_type_32.loc17_17, %.loc17_17.1 [template = i32] -// CHECK:STDOUT: %m.loc17_14.1: i32 = param m -// CHECK:STDOUT: %m.loc17_14.2: i32 = bind_name m, %m.loc17_14.1 -// CHECK:STDOUT: %int.make_type_32.loc17_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_25.1: type = value_of_initializer %int.make_type_32.loc17_25 [template = i32] -// CHECK:STDOUT: %.loc17_25.2: type = converted %int.make_type_32.loc17_25, %.loc17_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc17: ref i32 = var +// CHECK:STDOUT: %B.decl.loc21: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc21_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_9.1: type = value_of_initializer %int.make_type_32.loc21_9 [template = i32] +// CHECK:STDOUT: %.loc21_9.2: type = converted %int.make_type_32.loc21_9, %.loc21_9.1 [template = i32] +// CHECK:STDOUT: %n.loc21_6.1: i32 = param n +// CHECK:STDOUT: %n.loc21_6.2: i32 = bind_name n, %n.loc21_6.1 +// CHECK:STDOUT: %int.make_type_32.loc21_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_17.1: type = value_of_initializer %int.make_type_32.loc21_17 [template = i32] +// CHECK:STDOUT: %.loc21_17.2: type = converted %int.make_type_32.loc21_17, %.loc21_17.1 [template = i32] +// CHECK:STDOUT: %m.loc21_14.1: i32 = param m +// CHECK:STDOUT: %m.loc21_14.2: i32 = bind_name m, %m.loc21_14.1 +// CHECK:STDOUT: %int.make_type_32.loc21_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_25.1: type = value_of_initializer %int.make_type_32.loc21_25 [template = i32] +// CHECK:STDOUT: %.loc21_25.2: type = converted %int.make_type_32.loc21_25, %.loc21_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc21: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.12: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc25_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_9.1: type = value_of_initializer %int.make_type_32.loc25_9 [template = i32] -// CHECK:STDOUT: %.loc25_9.2: type = converted %int.make_type_32.loc25_9, %.loc25_9.1 [template = i32] -// CHECK:STDOUT: %n.loc25_6.1: i32 = param n -// CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc25_6.1 -// CHECK:STDOUT: %int.make_type_32.loc25_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_17.1: type = value_of_initializer %int.make_type_32.loc25_17 [template = i32] -// CHECK:STDOUT: %.loc25_17.2: type = converted %int.make_type_32.loc25_17, %.loc25_17.1 [template = i32] -// CHECK:STDOUT: %m.loc25_14.1: i32 = param m -// CHECK:STDOUT: @B.%m: i32 = bind_name m, %m.loc25_14.1 -// CHECK:STDOUT: %int.make_type_32.loc25_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_25.1: type = value_of_initializer %int.make_type_32.loc25_25 [template = i32] -// CHECK:STDOUT: %.loc25_25.2: type = converted %int.make_type_32.loc25_25, %.loc25_25.1 [template = i32] +// CHECK:STDOUT: %B.decl.loc29: B = fn_decl @B [template = constants.%struct.3] { +// CHECK:STDOUT: %int.make_type_32.loc29_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_9.1: type = value_of_initializer %int.make_type_32.loc29_9 [template = i32] +// CHECK:STDOUT: %.loc29_9.2: type = converted %int.make_type_32.loc29_9, %.loc29_9.1 [template = i32] +// CHECK:STDOUT: %n.loc29_6.1: i32 = param n +// CHECK:STDOUT: @B.%n: i32 = bind_name n, %n.loc29_6.1 +// CHECK:STDOUT: %int.make_type_32.loc29_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_17.1: type = value_of_initializer %int.make_type_32.loc29_17 [template = i32] +// CHECK:STDOUT: %.loc29_17.2: type = converted %int.make_type_32.loc29_17, %.loc29_17.1 [template = i32] +// CHECK:STDOUT: %m.loc29_14.1: i32 = param m +// CHECK:STDOUT: @B.%m: i32 = bind_name m, %m.loc29_14.1 +// CHECK:STDOUT: %int.make_type_32.loc29_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_25.1: type = value_of_initializer %int.make_type_32.loc29_25 [template = i32] +// CHECK:STDOUT: %.loc29_25.2: type = converted %int.make_type_32.loc29_25, %.loc29_25.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.13: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.14: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.15: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %C.decl.loc27: C = fn_decl @C [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc27_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc27_9.1: type = value_of_initializer %int.make_type_32.loc27_9 [template = i32] -// CHECK:STDOUT: %.loc27_9.2: type = converted %int.make_type_32.loc27_9, %.loc27_9.1 [template = i32] -// CHECK:STDOUT: %n.loc27_6.1: i32 = param n -// CHECK:STDOUT: %n.loc27_6.2: i32 = bind_name n, %n.loc27_6.1 -// CHECK:STDOUT: %int.make_type_32.loc27_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc27_17.1: type = value_of_initializer %int.make_type_32.loc27_17 [template = i32] -// CHECK:STDOUT: %.loc27_17.2: type = converted %int.make_type_32.loc27_17, %.loc27_17.1 [template = i32] -// CHECK:STDOUT: %m.loc27_14.1: i32 = param m -// CHECK:STDOUT: %m.loc27_14.2: i32 = bind_name m, %m.loc27_14.1 -// CHECK:STDOUT: %int.make_type_32.loc27_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc27_25.1: type = value_of_initializer %int.make_type_32.loc27_25 [template = i32] -// CHECK:STDOUT: %.loc27_25.2: type = converted %int.make_type_32.loc27_25, %.loc27_25.1 [template = i32] -// CHECK:STDOUT: %return.var.loc27: ref i32 = var +// CHECK:STDOUT: %C.decl.loc31: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc31_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc31_9.1: type = value_of_initializer %int.make_type_32.loc31_9 [template = i32] +// CHECK:STDOUT: %.loc31_9.2: type = converted %int.make_type_32.loc31_9, %.loc31_9.1 [template = i32] +// CHECK:STDOUT: %n.loc31_6.1: i32 = param n +// CHECK:STDOUT: %n.loc31_6.2: i32 = bind_name n, %n.loc31_6.1 +// CHECK:STDOUT: %int.make_type_32.loc31_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc31_17.1: type = value_of_initializer %int.make_type_32.loc31_17 [template = i32] +// CHECK:STDOUT: %.loc31_17.2: type = converted %int.make_type_32.loc31_17, %.loc31_17.1 [template = i32] +// CHECK:STDOUT: %m.loc31_14.1: i32 = param m +// CHECK:STDOUT: %m.loc31_14.2: i32 = bind_name m, %m.loc31_14.1 +// CHECK:STDOUT: %int.make_type_32.loc31_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc31_25.1: type = value_of_initializer %int.make_type_32.loc31_25 [template = i32] +// CHECK:STDOUT: %.loc31_25.2: type = converted %int.make_type_32.loc31_25, %.loc31_25.1 [template = i32] +// CHECK:STDOUT: %return.var.loc31: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.16: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.17: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.18: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %C.decl.loc34: C = fn_decl @C [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc34_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc34_9.1: type = value_of_initializer %int.make_type_32.loc34_9 [template = i32] -// CHECK:STDOUT: %.loc34_9.2: type = converted %int.make_type_32.loc34_9, %.loc34_9.1 [template = i32] -// CHECK:STDOUT: %n.loc34_6.1: i32 = param n -// CHECK:STDOUT: @C.%n: i32 = bind_name n, %n.loc34_6.1 -// CHECK:STDOUT: %int.make_type_32.loc34_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc34_17.1: type = value_of_initializer %int.make_type_32.loc34_17 [template = i32] -// CHECK:STDOUT: %.loc34_17.2: type = converted %int.make_type_32.loc34_17, %.loc34_17.1 [template = i32] -// CHECK:STDOUT: %m.loc34_14.1: i32 = param m -// CHECK:STDOUT: @C.%m: i32 = bind_name m, %m.loc34_14.1 -// CHECK:STDOUT: %int.make_type_32.loc34_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc34_25.1: type = value_of_initializer %int.make_type_32.loc34_25 [template = i32] -// CHECK:STDOUT: %.loc34_25.2: type = converted %int.make_type_32.loc34_25, %.loc34_25.1 [template = i32] +// CHECK:STDOUT: %C.decl.loc38: C = fn_decl @C [template = constants.%struct.4] { +// CHECK:STDOUT: %int.make_type_32.loc38_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc38_9.1: type = value_of_initializer %int.make_type_32.loc38_9 [template = i32] +// CHECK:STDOUT: %.loc38_9.2: type = converted %int.make_type_32.loc38_9, %.loc38_9.1 [template = i32] +// CHECK:STDOUT: %n.loc38_6.1: i32 = param n +// CHECK:STDOUT: @C.%n: i32 = bind_name n, %n.loc38_6.1 +// CHECK:STDOUT: %int.make_type_32.loc38_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc38_17.1: type = value_of_initializer %int.make_type_32.loc38_17 [template = i32] +// CHECK:STDOUT: %.loc38_17.2: type = converted %int.make_type_32.loc38_17, %.loc38_17.1 [template = i32] +// CHECK:STDOUT: %m.loc38_14.1: i32 = param m +// CHECK:STDOUT: @C.%m: i32 = bind_name m, %m.loc38_14.1 +// CHECK:STDOUT: %int.make_type_32.loc38_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc38_25.1: type = value_of_initializer %int.make_type_32.loc38_25 [template = i32] +// CHECK:STDOUT: %.loc38_25.2: type = converted %int.make_type_32.loc38_25, %.loc38_25.1 [template = i32] // CHECK:STDOUT: @C.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -181,7 +185,7 @@ fn C(n: i32, m: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @B(%n: i32, %m: i32) -> i32 = "int.sadd" { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref: i32 = name_ref n, file.%n.loc17_6.2 +// CHECK:STDOUT: %n.ref: i32 = name_ref n, file.%n.loc21_6.2 // CHECK:STDOUT: return %n.ref // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/fail_unknown.carbon b/toolchain/check/testdata/function/builtin/fail_unknown.carbon index d0c677f24e9b..0b5e230caec7 100644 --- a/toolchain/check/testdata/function/builtin/fail_unknown.carbon +++ b/toolchain/check/testdata/function/builtin/fail_unknown.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/fail_unknown.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/fail_unknown.carbon // CHECK:STDERR: fail_unknown.carbon:[[@LINE+3]]:23: ERROR: Unknown builtin function name "unknown.builtin.name". // CHECK:STDERR: fn UnknownBuiltin() = "unknown.builtin.name"; diff --git a/toolchain/check/testdata/function/builtin/method.carbon b/toolchain/check/testdata/function/builtin/method.carbon index 5c251e8f9383..6be07260426c 100644 --- a/toolchain/check/testdata/function/builtin/method.carbon +++ b/toolchain/check/testdata/function/builtin/method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/method.carbon interface I { fn F[self: Self](other: Self) -> Self; @@ -47,26 +51,26 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_6.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_6.2: type = converted %int.make_type_32.loc11, %.loc11_6.1 [template = i32] -// CHECK:STDOUT: %I.ref.loc11: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32.loc15, %.loc15_6.1 [template = i32] +// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_16: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8_40 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_16: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %I.ref.loc19: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc12_40 [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_17: = bound_method %.loc15_16, %.1 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_24: i32 = int_literal 2 [template = constants.%.8] -// CHECK:STDOUT: %int.sadd: init i32 = call %.loc15_17(%.loc15_16, %.loc15_24) [template = constants.%.9] -// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] -// CHECK:STDOUT: %.loc15_26: type = array_type %int.sadd, i32 [template = constants.%.10] +// CHECK:STDOUT: %.loc19_17: = bound_method %.loc19_16, %.1 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_24: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %int.sadd: init i32 = call %.loc19_17(%.loc19_16, %.loc19_24) [template = constants.%.9] +// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32.loc19, %.loc19_11.1 [template = i32] +// CHECK:STDOUT: %.loc19_26: type = array_type %int.sadd, i32 [template = constants.%.10] // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var // CHECK:STDOUT: } @@ -74,44 +78,44 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Self.ref.loc8_14: I = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %self.loc8_8.1: Self = param self -// CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %Self.ref.loc8_27: I = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_27.1: type = facet_type_access %Self.ref.loc8_27 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_27.2: type = converted %Self.ref.loc8_27, %.loc8_27.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %other.loc8_20.1: Self = param other -// CHECK:STDOUT: %other.loc8_20.2: Self = bind_name other, %other.loc8_20.1 -// CHECK:STDOUT: %Self.ref.loc8_36: I = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_36.1: type = facet_type_access %Self.ref.loc8_36 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_36.2: type = converted %Self.ref.loc8_36, %.loc8_36.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self.ref.loc12_14: I = name_ref Self, %Self [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_14.1: type = facet_type_access %Self.ref.loc12_14 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref.loc12_14, %.loc12_14.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %self.loc12_8.1: Self = param self +// CHECK:STDOUT: %self.loc12_8.2: Self = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %Self.ref.loc12_27: I = name_ref Self, %Self [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_27.1: type = facet_type_access %Self.ref.loc12_27 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_27.2: type = converted %Self.ref.loc12_27, %.loc12_27.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %other.loc12_20.1: Self = param other +// CHECK:STDOUT: %other.loc12_20.2: Self = bind_name other, %other.loc12_20.1 +// CHECK:STDOUT: %Self.ref.loc12_36: I = name_ref Self, %Self [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_36.1: type = facet_type_access %Self.ref.loc12_36 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_36.2: type = converted %Self.ref.loc12_36, %.loc12_36.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_40: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12_40: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8_40 +// CHECK:STDOUT: .F = %.loc12_40 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as I { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc12_14: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc12_14.1: type = value_of_initializer %int.make_type_32.loc12_14 [template = i32] -// CHECK:STDOUT: %.loc12_14.2: type = converted %int.make_type_32.loc12_14, %.loc12_14.1 [template = i32] -// CHECK:STDOUT: %self.loc12_8.1: i32 = param self -// CHECK:STDOUT: %self.loc12_8.2: i32 = bind_name self, %self.loc12_8.1 -// CHECK:STDOUT: %int.make_type_32.loc12_26: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc12_26.1: type = value_of_initializer %int.make_type_32.loc12_26 [template = i32] -// CHECK:STDOUT: %.loc12_26.2: type = converted %int.make_type_32.loc12_26, %.loc12_26.1 [template = i32] -// CHECK:STDOUT: %other.loc12_19.1: i32 = param other -// CHECK:STDOUT: %other.loc12_19.2: i32 = bind_name other, %other.loc12_19.1 -// CHECK:STDOUT: %int.make_type_32.loc12_34: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc12_34.1: type = value_of_initializer %int.make_type_32.loc12_34 [template = i32] -// CHECK:STDOUT: %.loc12_34.2: type = converted %int.make_type_32.loc12_34, %.loc12_34.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc16_14: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc16_14.1: type = value_of_initializer %int.make_type_32.loc16_14 [template = i32] +// CHECK:STDOUT: %.loc16_14.2: type = converted %int.make_type_32.loc16_14, %.loc16_14.1 [template = i32] +// CHECK:STDOUT: %self.loc16_8.1: i32 = param self +// CHECK:STDOUT: %self.loc16_8.2: i32 = bind_name self, %self.loc16_8.1 +// CHECK:STDOUT: %int.make_type_32.loc16_26: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc16_26.1: type = value_of_initializer %int.make_type_32.loc16_26 [template = i32] +// CHECK:STDOUT: %.loc16_26.2: type = converted %int.make_type_32.loc16_26, %.loc16_26.1 [template = i32] +// CHECK:STDOUT: %other.loc16_19.1: i32 = param other +// CHECK:STDOUT: %other.loc16_19.2: i32 = bind_name other, %other.loc16_19.1 +// CHECK:STDOUT: %int.make_type_32.loc16_34: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc16_34.1: type = value_of_initializer %int.make_type_32.loc16_34 [template = i32] +// CHECK:STDOUT: %.loc16_34.2: type = converted %int.make_type_32.loc16_34, %.loc16_34.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] @@ -121,9 +125,9 @@ var arr: [i32; 1.(I.F)(2)]; // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[@I.%self.loc8_8.2: Self](@I.%other.loc8_20.2: Self) -> Self; +// CHECK:STDOUT: fn @F.1[@I.%self.loc12_8.2: Self](@I.%other.loc12_20.2: Self) -> Self; // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@impl.%self.loc12_8.2: i32](@impl.%other.loc12_19.2: i32) -> i32 = "int.sadd"; +// CHECK:STDOUT: fn @F.2[@impl.%self.loc16_8.2: i32](@impl.%other.loc16_19.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon index c17d3676f90d..8fc5b756956b 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/no_prelude/call_from_operator.carbon // --- core.carbon diff --git a/toolchain/check/testdata/function/builtin/no_prelude/import.carbon b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon index f4d2ff1eb628..7e9904752801 100644 --- a/toolchain/check/testdata/function/builtin/no_prelude/import.carbon +++ b/toolchain/check/testdata/function/builtin/no_prelude/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/builtin/no_prelude/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/builtin/no_prelude/import.carbon // --- core.carbon diff --git a/toolchain/check/testdata/function/call/fail_not_callable.carbon b/toolchain/check/testdata/function/call/fail_not_callable.carbon index 9a638edcc4f9..8d401ba4cd65 100644 --- a/toolchain/check/testdata/function/call/fail_not_callable.carbon +++ b/toolchain/check/testdata/function/call/fail_not_callable.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/fail_not_callable.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_not_callable.carbon fn Run() { // CHECK:STDERR: fail_not_callable.carbon:[[@LINE+3]]:16: ERROR: Value of type `String` is not callable. @@ -36,11 +40,11 @@ fn Run() { // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_16: String = string_literal "hello" [template = constants.%.3] +// CHECK:STDOUT: %.loc15_16: String = string_literal "hello" [template = constants.%.3] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_param_count.carbon b/toolchain/check/testdata/function/call/fail_param_count.carbon index 9b6c2d7d8caa..bb3ec2e0cee0 100644 --- a/toolchain/check/testdata/function/call/fail_param_count.carbon +++ b/toolchain/check/testdata/function/call/fail_param_count.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/fail_param_count.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_param_count.carbon fn Run0() {} fn Run1(a: i32) {} @@ -90,25 +94,25 @@ fn Main() { // CHECK:STDOUT: %Run0.decl: Run0 = fn_decl @Run0 [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %Run1.decl: Run1 = fn_decl @Run1 [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_12.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_12.2: type = converted %int.make_type_32.loc8, %.loc8_12.1 [template = i32] -// CHECK:STDOUT: %a.loc8_9.1: i32 = param a -// CHECK:STDOUT: @Run1.%a: i32 = bind_name a, %a.loc8_9.1 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_12.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_12.2: type = converted %int.make_type_32.loc12, %.loc12_12.1 [template = i32] +// CHECK:STDOUT: %a.loc12_9.1: i32 = param a +// CHECK:STDOUT: @Run1.%a: i32 = bind_name a, %a.loc12_9.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %Run2.decl: Run2 = fn_decl @Run2 [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc9_12: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32.loc9_12 [template = i32] -// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32.loc9_12, %.loc9_12.1 [template = i32] -// CHECK:STDOUT: %a.loc9_9.1: i32 = param a -// CHECK:STDOUT: @Run2.%a: i32 = bind_name a, %a.loc9_9.1 -// CHECK:STDOUT: %int.make_type_32.loc9_20: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_20.1: type = value_of_initializer %int.make_type_32.loc9_20 [template = i32] -// CHECK:STDOUT: %.loc9_20.2: type = converted %int.make_type_32.loc9_20, %.loc9_20.1 [template = i32] -// CHECK:STDOUT: %b.loc9_17.1: i32 = param b -// CHECK:STDOUT: @Run2.%b: i32 = bind_name b, %b.loc9_17.1 +// CHECK:STDOUT: %int.make_type_32.loc13_12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_12.1: type = value_of_initializer %int.make_type_32.loc13_12 [template = i32] +// CHECK:STDOUT: %.loc13_12.2: type = converted %int.make_type_32.loc13_12, %.loc13_12.1 [template = i32] +// CHECK:STDOUT: %a.loc13_9.1: i32 = param a +// CHECK:STDOUT: @Run2.%a: i32 = bind_name a, %a.loc13_9.1 +// CHECK:STDOUT: %int.make_type_32.loc13_20: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_20.1: type = value_of_initializer %int.make_type_32.loc13_20 [template = i32] +// CHECK:STDOUT: %.loc13_20.2: type = converted %int.make_type_32.loc13_20, %.loc13_20.1 [template = i32] +// CHECK:STDOUT: %b.loc13_17.1: i32 = param b +// CHECK:STDOUT: @Run2.%b: i32 = bind_name b, %b.loc13_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.5] {} // CHECK:STDOUT: } @@ -132,24 +136,24 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Run0.ref.loc19: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Run0.call.loc19: init () = call %Run0.ref.loc19() [template = ] -// CHECK:STDOUT: %Run0.ref.loc27: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc27_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc27_11: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Run0.call.loc27: init () = call %Run0.ref.loc27() [template = ] -// CHECK:STDOUT: %Run1.ref.loc36: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] -// CHECK:STDOUT: %Run1.call.loc36: init () = call %Run1.ref.loc36() [template = ] -// CHECK:STDOUT: %Run1.ref.loc44: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] -// CHECK:STDOUT: %.loc44_8: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc44_11: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Run1.call.loc44: init () = call %Run1.ref.loc44() [template = ] -// CHECK:STDOUT: %Run2.ref.loc53: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] -// CHECK:STDOUT: %Run2.call.loc53: init () = call %Run2.ref.loc53() [template = ] -// CHECK:STDOUT: %Run2.ref.loc60: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] -// CHECK:STDOUT: %.loc60: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %Run2.call.loc60: init () = call %Run2.ref.loc60() [template = ] +// CHECK:STDOUT: %Run0.ref.loc23: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc23: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Run0.call.loc23: init () = call %Run0.ref.loc23() [template = ] +// CHECK:STDOUT: %Run0.ref.loc31: Run0 = name_ref Run0, file.%Run0.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc31_8: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc31_11: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Run0.call.loc31: init () = call %Run0.ref.loc31() [template = ] +// CHECK:STDOUT: %Run1.ref.loc40: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] +// CHECK:STDOUT: %Run1.call.loc40: init () = call %Run1.ref.loc40() [template = ] +// CHECK:STDOUT: %Run1.ref.loc48: Run1 = name_ref Run1, file.%Run1.decl [template = constants.%struct.3] +// CHECK:STDOUT: %.loc48_8: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc48_11: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Run1.call.loc48: init () = call %Run1.ref.loc48() [template = ] +// CHECK:STDOUT: %Run2.ref.loc57: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] +// CHECK:STDOUT: %Run2.call.loc57: init () = call %Run2.ref.loc57() [template = ] +// CHECK:STDOUT: %Run2.ref.loc64: Run2 = name_ref Run2, file.%Run2.decl [template = constants.%struct.4] +// CHECK:STDOUT: %.loc64: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %Run2.call.loc64: init () = call %Run2.ref.loc64() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/fail_param_type.carbon b/toolchain/check/testdata/function/call/fail_param_type.carbon index d7a35f4362ca..653f94055bee 100644 --- a/toolchain/check/testdata/function/call/fail_param_type.carbon +++ b/toolchain/check/testdata/function/call/fail_param_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/fail_param_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_param_type.carbon fn G(a: i32) {} @@ -39,10 +43,10 @@ fn F() { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %a.loc7_6.1: i32 = param a -// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %a.loc11_6.1: i32 = param a +// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc11_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} // CHECK:STDOUT: } @@ -57,7 +61,7 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc16: f64 = float_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc20: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: %G.call: init () = call %G.ref() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon index 53e0ffe32b5e..6c773a046cae 100644 --- a/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +++ b/toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/fail_return_type_mismatch.carbon fn Foo() -> f64 { return 1.0; } @@ -38,10 +42,10 @@ fn Run() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] +// CHECK:STDOUT: %.loc11_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc11_13.1) [template = f64] +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc11_13.3: type = converted %float.make_type, %.loc11_13.2 [template = f64] // CHECK:STDOUT: @Foo.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] {} @@ -52,15 +56,15 @@ fn Run() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() -> f64 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: f64 = float_literal 1 [template = constants.%.3] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: f64 = float_literal 1 [template = constants.%.3] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.4() [template = i32] -// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] // CHECK:STDOUT: %x.var: ref i32 = var x // CHECK:STDOUT: %x: ref i32 = bind_name x, %x.var // CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] diff --git a/toolchain/check/testdata/function/call/i32.carbon b/toolchain/check/testdata/function/call/i32.carbon index aff76a612a44..7cc38b5f2c2d 100644 --- a/toolchain/check/testdata/function/call/i32.carbon +++ b/toolchain/check/testdata/function/call/i32.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/i32.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/i32.carbon fn Echo(a: i32) -> i32 { return a; @@ -35,14 +39,14 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7_12, %.loc7_12.1 [template = i32] -// CHECK:STDOUT: %a.loc7_9.1: i32 = param a -// CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1 -// CHECK:STDOUT: %int.make_type_32.loc7_20: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %int.make_type_32.loc7_20 [template = i32] -// CHECK:STDOUT: %.loc7_20.2: type = converted %int.make_type_32.loc7_20, %.loc7_20.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11_12, %.loc11_12.1 [template = i32] +// CHECK:STDOUT: %a.loc11_9.1: i32 = param a +// CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc11_9.1 +// CHECK:STDOUT: %int.make_type_32.loc11_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_20.1: type = value_of_initializer %int.make_type_32.loc11_20 [template = i32] +// CHECK:STDOUT: %.loc11_20.2: type = converted %int.make_type_32.loc11_20, %.loc11_20.1 [template = i32] // CHECK:STDOUT: @Echo.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} @@ -60,13 +64,13 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc16_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_10.2: type = converted %int.make_type_32, %.loc16_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_21: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12_21) +// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc16_21) // CHECK:STDOUT: assign %b.var, %Echo.call // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/call/more_param_ir.carbon b/toolchain/check/testdata/function/call/more_param_ir.carbon index 79ce4549f5ec..b18bcbeeaf90 100644 --- a/toolchain/check/testdata/function/call/more_param_ir.carbon +++ b/toolchain/check/testdata/function/call/more_param_ir.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/more_param_ir.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/more_param_ir.carbon fn Foo(a: i32, b: i32) {} @@ -40,16 +44,16 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc11_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -65,24 +69,24 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_15.1: (type,) = tuple_literal (%int.make_type_32) -// CHECK:STDOUT: %.loc10_15.2: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_15.3: type = converted %int.make_type_32, %.loc10_15.2 [template = i32] -// CHECK:STDOUT: %.loc10_15.4: type = converted %.loc10_15.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_15.1: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc14_15.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_15.3: type = converted %int.make_type_32, %.loc14_15.2 [template = i32] +// CHECK:STDOUT: %.loc14_15.4: type = converted %.loc14_15.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var -// CHECK:STDOUT: %.loc10_20: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_22.1: (i32,) = tuple_literal (%.loc10_20) -// CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_23: init (i32,) = converted %.loc10_22.1, %.loc10_22.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var, %.loc10_23 +// CHECK:STDOUT: %.loc14_20: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_22.1: (i32,) = tuple_literal (%.loc14_20) +// CHECK:STDOUT: %.loc14_22.2: init (i32,) = tuple_init (%.loc14_20) to %x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_23: init (i32,) = converted %.loc14_22.1, %.loc14_22.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var, %.loc14_23 // CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x -// CHECK:STDOUT: %.loc12_9: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9 -// CHECK:STDOUT: %.loc12_13: i32 = int_literal 6 [template = constants.%.6] -// CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1 -// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13) +// CHECK:STDOUT: %.loc16_9: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc16_10.1: ref i32 = tuple_index %x.ref, %.loc16_9 +// CHECK:STDOUT: %.loc16_13: i32 = int_literal 6 [template = constants.%.6] +// CHECK:STDOUT: %.loc16_10.2: i32 = bind_value %.loc16_10.1 +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc16_10.2, %.loc16_13) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/no_prelude/alias.carbon b/toolchain/check/testdata/function/call/no_prelude/alias.carbon index 3f7936ca23dd..153f801a6d5b 100644 --- a/toolchain/check/testdata/function/call/no_prelude/alias.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/no_prelude/alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/no_prelude/alias.carbon fn A() -> () { return (); } @@ -30,8 +34,8 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @A.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.1] @@ -41,16 +45,16 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> () { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_24: () = tuple_literal () +// CHECK:STDOUT: %.loc11_24: () = tuple_literal () // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_25: () = converted %.loc7_24, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc7_25 +// CHECK:STDOUT: %.loc11_25: () = converted %.loc11_24, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc11_25 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc16_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc16_11.2: type = converted %.loc16_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var // CHECK:STDOUT: %B.ref: A = name_ref B, file.%B [template = constants.%struct.1] diff --git a/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon b/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon index dc04726a1ad0..93de2ec3cf10 100644 --- a/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/no_prelude/empty_struct.carbon fn Echo(a: {}) -> {} { return a; @@ -30,12 +34,12 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %a.loc7_9.1: {} = param a -// CHECK:STDOUT: @Echo.%a: {} = bind_name a, %a.loc7_9.1 -// CHECK:STDOUT: %.loc7_20.1: {} = struct_literal () -// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc11_13.2: type = converted %.loc11_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %a.loc11_9.1: {} = param a +// CHECK:STDOUT: @Echo.%a: {} = bind_name a, %a.loc11_9.1 +// CHECK:STDOUT: %.loc11_20.1: {} = struct_literal () +// CHECK:STDOUT: %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @Echo.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} @@ -50,10 +54,10 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc12_9: {} = struct_literal () +// CHECK:STDOUT: %.loc16_9: {} = struct_literal () // CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct.3] -// CHECK:STDOUT: %.loc12_7: {} = converted %.loc12_9, %struct [template = constants.%struct.3] -// CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc12_7) +// CHECK:STDOUT: %.loc16_7: {} = converted %.loc16_9, %struct [template = constants.%struct.3] +// CHECK:STDOUT: %Echo.call: init {} = call %Echo.ref(%.loc16_7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon b/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon index 0cc49d298b44..5922b3a1f51e 100644 --- a/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/no_prelude/empty_tuple.carbon fn Echo(a: ()) -> () { return a; @@ -29,12 +33,12 @@ fn Main() { // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] { -// CHECK:STDOUT: %.loc7_13.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %a.loc7_9.1: () = param a -// CHECK:STDOUT: @Echo.%a: () = bind_name a, %a.loc7_9.1 -// CHECK:STDOUT: %.loc7_20.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_20.2: type = converted %.loc7_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_13.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_13.2: type = converted %.loc11_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %a.loc11_9.1: () = param a +// CHECK:STDOUT: @Echo.%a: () = bind_name a, %a.loc11_9.1 +// CHECK:STDOUT: %.loc11_20.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_20.2: type = converted %.loc11_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @Echo.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} @@ -49,10 +53,10 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc12_9: () = tuple_literal () +// CHECK:STDOUT: %.loc16_9: () = tuple_literal () // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc12_7: () = converted %.loc12_9, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %Echo.call: init () = call %Echo.ref(%.loc12_7) +// CHECK:STDOUT: %.loc16_7: () = converted %.loc16_9, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %Echo.call: init () = call %Echo.ref(%.loc16_7) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon b/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon index e2de634e2924..b46d62b4497b 100644 --- a/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/params_zero.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/no_prelude/params_zero.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/no_prelude/params_zero.carbon fn Foo() {} diff --git a/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon b/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon index 5dba99d46b98..72b53dbd977e 100644 --- a/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon +++ b/toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/no_prelude/return_implicit.carbon fn MakeImplicitEmptyTuple() { } @@ -37,8 +41,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_11.2: type = converted %.loc15_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var // CHECK:STDOUT: %MakeImplicitEmptyTuple.ref: MakeImplicitEmptyTuple = name_ref MakeImplicitEmptyTuple, file.%MakeImplicitEmptyTuple.decl [template = constants.%struct.1] diff --git a/toolchain/check/testdata/function/call/params_one.carbon b/toolchain/check/testdata/function/call/params_one.carbon index b8312447e93f..b91347535aa5 100644 --- a/toolchain/check/testdata/function/call/params_one.carbon +++ b/toolchain/check/testdata/function/call/params_one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/params_one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/params_one.carbon fn Foo(a: i32) {} @@ -33,10 +37,10 @@ fn Main() { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } @@ -51,8 +55,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10) +// CHECK:STDOUT: %.loc14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc14) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_one_comma.carbon b/toolchain/check/testdata/function/call/params_one_comma.carbon index 2d793f2477c0..8f47e3431610 100644 --- a/toolchain/check/testdata/function/call/params_one_comma.carbon +++ b/toolchain/check/testdata/function/call/params_one_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/params_one_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/params_one_comma.carbon fn Foo(a: i32,) {} @@ -34,10 +38,10 @@ fn Main() { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } @@ -51,12 +55,12 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10) -// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11) +// CHECK:STDOUT: %Foo.ref.loc14: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Foo.call.loc14: init () = call %Foo.ref.loc14(%.loc14) +// CHECK:STDOUT: %Foo.ref.loc15: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %Foo.call.loc15: init () = call %Foo.ref.loc15(%.loc15) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two.carbon b/toolchain/check/testdata/function/call/params_two.carbon index c87192ddeb1a..3cafa0719dea 100644 --- a/toolchain/check/testdata/function/call/params_two.carbon +++ b/toolchain/check/testdata/function/call/params_two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/params_two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/params_two.carbon fn Foo(a: i32, b: i32) {} @@ -34,16 +38,16 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc11_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } @@ -58,9 +62,9 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10_7, %.loc10_10) +// CHECK:STDOUT: %.loc14_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc14_7, %.loc14_10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/call/params_two_comma.carbon b/toolchain/check/testdata/function/call/params_two_comma.carbon index c89c01582c2c..0dcd50e37e85 100644 --- a/toolchain/check/testdata/function/call/params_two_comma.carbon +++ b/toolchain/check/testdata/function/call/params_two_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/params_two_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/params_two_comma.carbon fn Foo(a: i32, b: i32,) {} @@ -35,16 +39,16 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc11_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} // CHECK:STDOUT: } @@ -58,14 +62,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Foo.ref.loc10: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %Foo.call.loc10: init () = call %Foo.ref.loc10(%.loc10_7, %.loc10_10) -// CHECK:STDOUT: %Foo.ref.loc11: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11_7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %Foo.call.loc11: init () = call %Foo.ref.loc11(%.loc11_7, %.loc11_10) +// CHECK:STDOUT: %Foo.ref.loc14: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_10: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %Foo.call.loc14: init () = call %Foo.ref.loc14(%.loc14_7, %.loc14_10) +// CHECK:STDOUT: %Foo.ref.loc15: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_7: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %Foo.call.loc15: init () = call %Foo.ref.loc15(%.loc15_7, %.loc15_10) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon index 77d7dd01ece9..7277e440c9f3 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/fail_param_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_in_type.carbon // CHECK:STDERR: fail_param_in_type.carbon:[[@LINE+3]]:23: ERROR: Array bound is not a constant. // CHECK:STDERR: fn F(n: i32, a: [i32; n]*); @@ -28,16 +32,16 @@ fn F(n: i32, a: [i32; n]*); // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] -// CHECK:STDOUT: %.loc10_9.2: type = converted %int.make_type_32.loc10_9, %.loc10_9.1 [template = i32] -// CHECK:STDOUT: %n.loc10_6.1: i32 = param n -// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc10_6.1 -// CHECK:STDOUT: %int.make_type_32.loc10_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32.loc14_9 [template = i32] +// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14_9, %.loc14_9.1 [template = i32] +// CHECK:STDOUT: %n.loc14_6.1: i32 = param n +// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc14_6.1 +// CHECK:STDOUT: %int.make_type_32.loc14_18: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %n.ref: i32 = name_ref n, @F.%n -// CHECK:STDOUT: %.loc10_25: type = ptr_type [template = ] -// CHECK:STDOUT: %a.loc10_14.1: = param a -// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc10_14.1 +// CHECK:STDOUT: %.loc14_25: type = ptr_type [template = ] +// CHECK:STDOUT: %a.loc14_14.1: = param a +// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc14_14.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon index a890cc774665..9735a394507e 100644 --- a/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/fail_param_redecl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/fail_param_redecl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/fail_param_redecl.carbon // CHECK:STDERR: fail_param_redecl.carbon:[[@LINE+6]]:14: ERROR: Duplicate name being declared in the same scope. // CHECK:STDERR: fn F(n: i32, n: i32); @@ -31,20 +35,20 @@ fn F(n: i32, n: i32); // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc13_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_32.loc13_9 [template = i32] -// CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_32.loc13_9, %.loc13_9.1 [template = i32] -// CHECK:STDOUT: %n.loc13_6.1: i32 = param n -// CHECK:STDOUT: @F.%n.loc13_6: i32 = bind_name n, %n.loc13_6.1 -// CHECK:STDOUT: %int.make_type_32.loc13_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_17.1: type = value_of_initializer %int.make_type_32.loc13_17 [template = i32] -// CHECK:STDOUT: %.loc13_17.2: type = converted %int.make_type_32.loc13_17, %.loc13_17.1 [template = i32] -// CHECK:STDOUT: %n.loc13_14.1: i32 = param n -// CHECK:STDOUT: @F.%n.loc13_14: i32 = bind_name n, %n.loc13_14.1 +// CHECK:STDOUT: %int.make_type_32.loc17_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_9.1: type = value_of_initializer %int.make_type_32.loc17_9 [template = i32] +// CHECK:STDOUT: %.loc17_9.2: type = converted %int.make_type_32.loc17_9, %.loc17_9.1 [template = i32] +// CHECK:STDOUT: %n.loc17_6.1: i32 = param n +// CHECK:STDOUT: @F.%n.loc17_6: i32 = bind_name n, %n.loc17_6.1 +// CHECK:STDOUT: %int.make_type_32.loc17_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_17.1: type = value_of_initializer %int.make_type_32.loc17_17 [template = i32] +// CHECK:STDOUT: %.loc17_17.2: type = converted %int.make_type_32.loc17_17, %.loc17_17.1 [template = i32] +// CHECK:STDOUT: %n.loc17_14.1: i32 = param n +// CHECK:STDOUT: @F.%n.loc17_14: i32 = bind_name n, %n.loc17_14.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%n.loc13_6: i32, %n.loc13_14: i32); +// CHECK:STDOUT: fn @F(%n.loc17_6: i32, %n.loc17_14: i32); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/import.carbon b/toolchain/check/testdata/function/declaration/import.carbon index ad9ebf71c475..1f5f3fa40b5a 100644 --- a/toolchain/check/testdata/function/declaration/import.carbon +++ b/toolchain/check/testdata/function/declaration/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/import.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon b/toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon index 596498264f71..39ce24e39b89 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon b/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon index 900486fd62b6..85bf33daeba6 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/extern.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/extern.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/extern.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon index 8d269cbd2ceb..50d02c3c09d5 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_import_incomplete_return.carbon // --- fail_incomplete_return.carbon diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon index 9140b534562c..6da805db1d8f 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+11]]:1: ERROR: `default` not allowed on `fn` declaration outside of an interface. // CHECK:STDERR: default protected fn WrongOrder(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon index 5fba7a3060a1..7c84fb468ac6 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_redecl.carbon fn A(); // CHECK:STDERR: fail_redecl.carbon:[[@LINE+7]]:1: ERROR: Redeclaration of `fn A` is redundant. @@ -73,37 +77,37 @@ fn E() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A.decl.loc7 -// CHECK:STDOUT: .B = %B.decl.loc17 +// CHECK:STDOUT: .A = %A.decl.loc11 +// CHECK:STDOUT: .B = %B.decl.loc21 // CHECK:STDOUT: .C = %C.decl -// CHECK:STDOUT: .D = %D.decl.loc37 -// CHECK:STDOUT: .E = %E.decl.loc47 +// CHECK:STDOUT: .D = %D.decl.loc41 +// CHECK:STDOUT: .E = %E.decl.loc51 // CHECK:STDOUT: } -// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %A.decl.loc15: A = fn_decl @A [template = constants.%struct.1] {} -// CHECK:STDOUT: %B.decl.loc17: B = fn_decl @B [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc17_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc17_6.1: () = param x -// CHECK:STDOUT: @B.%x: () = bind_name x, %x.loc17_6.1 +// CHECK:STDOUT: %A.decl.loc11: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %A.decl.loc19: A = fn_decl @A [template = constants.%struct.1] {} +// CHECK:STDOUT: %B.decl.loc21: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc21_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc21_10.2: type = converted %.loc21_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc21_6.1: () = param x +// CHECK:STDOUT: @B.%x: () = bind_name x, %x.loc21_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %B.decl.loc25: B = fn_decl @B [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc25_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc25_10.2: type = converted %.loc25_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc25_6.1: () = param x -// CHECK:STDOUT: %x.loc25_6.2: () = bind_name x, %x.loc25_6.1 +// CHECK:STDOUT: %B.decl.loc29: B = fn_decl @B [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc29_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc29_10.2: type = converted %.loc29_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc29_6.1: () = param x +// CHECK:STDOUT: %x.loc29_6.2: () = bind_name x, %x.loc29_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.3] {} // CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.4] { -// CHECK:STDOUT: %.loc35_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc35_10.2: type = converted %.loc35_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc35_6.1: () = param x -// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc35_6.1 +// CHECK:STDOUT: %.loc39_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc39_10.2: type = converted %.loc39_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc39_6.1: () = param x +// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc39_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %D.decl.loc37: D = fn_decl @D [template = constants.%struct.5] {} -// CHECK:STDOUT: %D.decl.loc45: D = fn_decl @D [template = constants.%struct.5] {} -// CHECK:STDOUT: %E.decl.loc47: E = fn_decl @E [template = constants.%struct.6] {} -// CHECK:STDOUT: %E.decl.loc54: E = fn_decl @E [template = constants.%struct.6] {} +// CHECK:STDOUT: %D.decl.loc41: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %D.decl.loc49: D = fn_decl @D [template = constants.%struct.5] {} +// CHECK:STDOUT: %E.decl.loc51: E = fn_decl @E [template = constants.%struct.6] {} +// CHECK:STDOUT: %E.decl.loc58: E = fn_decl @E [template = constants.%struct.6] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @A(); @@ -123,7 +127,7 @@ fn E() {} // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: -// CHECK:STDOUT: !.loc54: +// CHECK:STDOUT: !.loc58: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon index 05e8857eca68..ec54aadfe4c9 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_todo_modifiers.carbon // CHECK:STDERR: fail_todo_modifiers.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `access modifier`. // CHECK:STDERR: private fn F(); diff --git a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon index a6d563935831..2319b4e0c4a7 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/fail_todo_no_params.carbon // --- fail_no_body.carbon diff --git a/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon b/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon index 7e3666ce73e8..49a620f42920 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/implicit_import.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon b/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon index 16b16d24d7ab..cfbfa09d4983 100644 --- a/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon +++ b/toolchain/check/testdata/function/declaration/no_prelude/simple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/no_prelude/simple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/no_prelude/simple.carbon fn F(); diff --git a/toolchain/check/testdata/function/declaration/param_same_name.carbon b/toolchain/check/testdata/function/declaration/param_same_name.carbon index 63cace84bc24..167039bcaeff 100644 --- a/toolchain/check/testdata/function/declaration/param_same_name.carbon +++ b/toolchain/check/testdata/function/declaration/param_same_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/declaration/param_same_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/param_same_name.carbon fn F(a: i32); @@ -29,19 +33,19 @@ fn G(a: i32); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %a.loc7_6.1: i32 = param a -// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %a.loc11_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc11_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_9.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_9.2: type = converted %int.make_type_32.loc9, %.loc9_9.1 [template = i32] -// CHECK:STDOUT: %a.loc9_6.1: i32 = param a -// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc9_6.1 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_9.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_9.2: type = converted %int.make_type_32.loc13, %.loc13_9.1 [template = i32] +// CHECK:STDOUT: %a.loc13_6.1: i32 = param a +// CHECK:STDOUT: @G.%a: i32 = bind_name a, %a.loc13_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/import.carbon b/toolchain/check/testdata/function/definition/import.carbon index e1f231cd024b..eb01e7618a63 100644 --- a/toolchain/check/testdata/function/definition/import.carbon +++ b/toolchain/check/testdata/function/definition/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/import.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/function/definition/no_prelude/extern.carbon b/toolchain/check/testdata/function/definition/no_prelude/extern.carbon index b269cbf6769c..835ddbba412d 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/extern.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/extern.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/extern.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/extern.carbon // --- fail_extern_def.carbon diff --git a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon index 9a8377f37afa..8a92eef71d2d 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_decl_param_mismatch.carbon fn F(); // CHECK:STDERR: fail_decl_param_mismatch.carbon:[[@LINE+7]]:1: ERROR: Redeclaration differs because of parameter count of 1. @@ -103,49 +107,49 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: .K = %K.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.decl.loc15: = fn_decl @.1 [template = constants.%struct.2] { -// CHECK:STDOUT: %.loc15_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_10.2: type = converted %.loc15_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc15_6.1: () = param x -// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc15_6.1 +// CHECK:STDOUT: %.decl.loc19: = fn_decl @.1 [template = constants.%struct.2] { +// CHECK:STDOUT: %.loc19_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_10.2: type = converted %.loc19_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc19_6.1: () = param x +// CHECK:STDOUT: @.1.%x: () = bind_name x, %x.loc19_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %.loc17_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc17_10.2: type = converted %.loc17_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc17_6.1: () = param x -// CHECK:STDOUT: @G.%x: () = bind_name x, %x.loc17_6.1 +// CHECK:STDOUT: %.loc21_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc21_10.2: type = converted %.loc21_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc21_6.1: () = param x +// CHECK:STDOUT: @G.%x: () = bind_name x, %x.loc21_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc25: = fn_decl @.2 [template = constants.%struct.4] {} +// CHECK:STDOUT: %.decl.loc29: = fn_decl @.2 [template = constants.%struct.4] {} // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.5] { -// CHECK:STDOUT: %.loc27_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc27_10.2: type = converted %.loc27_10.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.loc27_6.1: () = param x -// CHECK:STDOUT: @H.%x: () = bind_name x, %x.loc27_6.1 +// CHECK:STDOUT: %.loc31_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc31_10.2: type = converted %.loc31_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.loc31_6.1: () = param x +// CHECK:STDOUT: @H.%x: () = bind_name x, %x.loc31_6.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc32: = fn_decl @.3 [template = constants.%struct.6] { -// CHECK:STDOUT: %x.loc32_6.1: = param x -// CHECK:STDOUT: @.3.%x: = bind_name x, %x.loc32_6.1 +// CHECK:STDOUT: %.decl.loc36: = fn_decl @.3 [template = constants.%struct.6] { +// CHECK:STDOUT: %x.loc36_6.1: = param x +// CHECK:STDOUT: @.3.%x: = bind_name x, %x.loc36_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: I = fn_decl @I [template = constants.%struct.7] {} -// CHECK:STDOUT: %.decl.loc42: = fn_decl @.4 [template = constants.%struct.8] { -// CHECK:STDOUT: %.loc42_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc42_12.2: type = converted %.loc42_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.decl.loc46: = fn_decl @.4 [template = constants.%struct.8] { +// CHECK:STDOUT: %.loc46_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc46_12.2: type = converted %.loc46_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @.4.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: %J.decl: J = fn_decl @J [template = constants.%struct.9] { -// CHECK:STDOUT: %.loc44_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc44_12.2: type = converted %.loc44_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc48_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc48_12.2: type = converted %.loc48_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @J.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc52: = fn_decl @.5 [template = constants.%struct.10] {} +// CHECK:STDOUT: %.decl.loc56: = fn_decl @.5 [template = constants.%struct.10] {} // CHECK:STDOUT: %K.decl: K = fn_decl @K [template = constants.%struct.11] { -// CHECK:STDOUT: %.loc54_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc54_12.2: type = converted %.loc54_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc58_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc58_12.2: type = converted %.loc58_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @K.%return: ref () = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.decl.loc61: = fn_decl @.6 [template = constants.%struct.12] { -// CHECK:STDOUT: %.loc61_12.1: {} = struct_literal () -// CHECK:STDOUT: %.loc61_12.2: type = converted %.loc61_12.1, constants.%.7 [template = constants.%.7] +// CHECK:STDOUT: %.decl.loc65: = fn_decl @.6 [template = constants.%struct.12] { +// CHECK:STDOUT: %.loc65_12.1: {} = struct_literal () +// CHECK:STDOUT: %.loc65_12.2: type = converted %.loc65_12.1, constants.%.7 [template = constants.%.7] // CHECK:STDOUT: @.6.%return: ref {} = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -175,10 +179,10 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.4() -> () { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc42_24: () = tuple_literal () +// CHECK:STDOUT: %.loc46_24: () = tuple_literal () // CHECK:STDOUT: %tuple: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc42_25: () = converted %.loc42_24, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc42_25 +// CHECK:STDOUT: %.loc46_25: () = converted %.loc46_24, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc46_25 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @J() -> (); @@ -192,9 +196,9 @@ fn K() -> {} { return {}; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.6() -> {} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc61_24: {} = struct_literal () +// CHECK:STDOUT: %.loc65_24: {} = struct_literal () // CHECK:STDOUT: %struct: {} = struct_value () [template = constants.%struct.13] -// CHECK:STDOUT: %.loc61_25: {} = converted %.loc61_24, %struct [template = constants.%struct.13] -// CHECK:STDOUT: return %.loc61_25 +// CHECK:STDOUT: %.loc65_25: {} = converted %.loc65_24, %struct [template = constants.%struct.13] +// CHECK:STDOUT: return %.loc65_25 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon b/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon index 39de5a2d53ce..d6263aac1f4c 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/fail_redef.carbon fn F() {} // CHECK:STDERR: fail_redef.carbon:[[@LINE+6]]:1: ERROR: Redefinition of `fn F`. @@ -23,17 +27,17 @@ fn F() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .F = %F.decl.loc7 +// CHECK:STDOUT: .F = %F.decl.loc11 // CHECK:STDOUT: } -// CHECK:STDOUT: %F.decl.loc7: F = fn_decl @F [template = constants.%struct] {} -// CHECK:STDOUT: %F.decl.loc14: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc11: F = fn_decl @F [template = constants.%struct] {} +// CHECK:STDOUT: %F.decl.loc18: F = fn_decl @F [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: -// CHECK:STDOUT: !.loc14: +// CHECK:STDOUT: !.loc18: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon b/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon index ae45b1ede011..37436a8c2e9b 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/forward_decl.carbon fn Foo(); @@ -18,10 +22,10 @@ fn Foo() {} // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Foo = %Foo.decl.loc7 +// CHECK:STDOUT: .Foo = %Foo.decl.loc11 // CHECK:STDOUT: } -// CHECK:STDOUT: %Foo.decl.loc7: Foo = fn_decl @Foo [template = constants.%struct] {} -// CHECK:STDOUT: %Foo.decl.loc9: Foo = fn_decl @Foo [template = constants.%struct] {} +// CHECK:STDOUT: %Foo.decl.loc11: Foo = fn_decl @Foo [template = constants.%struct] {} +// CHECK:STDOUT: %Foo.decl.loc13: Foo = fn_decl @Foo [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo() { diff --git a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon index 42074c3c7f94..cb7455ab2a0a 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/implicit_import.carbon // --- basic.carbon diff --git a/toolchain/check/testdata/function/definition/no_prelude/order.carbon b/toolchain/check/testdata/function/definition/no_prelude/order.carbon index 16b0ec0111e7..d3d205544777 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/order.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/order.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/order.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/order.carbon fn Foo() {} fn Bar() {} diff --git a/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon b/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon index 3ce337761bf2..9fb4faff17e4 100644 --- a/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon +++ b/toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/params_zero.carbon fn Foo() {} diff --git a/toolchain/check/testdata/function/definition/params_one.carbon b/toolchain/check/testdata/function/definition/params_one.carbon index c9594cf129dd..a08342021c80 100644 --- a/toolchain/check/testdata/function/definition/params_one.carbon +++ b/toolchain/check/testdata/function/definition/params_one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/params_one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_one.carbon fn Foo(a: i32) {} @@ -25,10 +29,10 @@ fn Foo(a: i32) {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/params_one_comma.carbon b/toolchain/check/testdata/function/definition/params_one_comma.carbon index 14d61c381277..4991fddb416b 100644 --- a/toolchain/check/testdata/function/definition/params_one_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_one_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/params_one_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_one_comma.carbon fn Foo(a: i32,) {} @@ -25,10 +29,10 @@ fn Foo(a: i32,) {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/params_two.carbon b/toolchain/check/testdata/function/definition/params_two.carbon index 547c738366da..558c77203d9d 100644 --- a/toolchain/check/testdata/function/definition/params_two.carbon +++ b/toolchain/check/testdata/function/definition/params_two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/params_two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_two.carbon fn Foo(a: i32, b: i32) {} @@ -25,16 +29,16 @@ fn Foo(a: i32, b: i32) {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc11_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/definition/params_two_comma.carbon b/toolchain/check/testdata/function/definition/params_two_comma.carbon index 7322d103e799..37067319de06 100644 --- a/toolchain/check/testdata/function/definition/params_two_comma.carbon +++ b/toolchain/check/testdata/function/definition/params_two_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/definition/params_two_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/params_two_comma.carbon fn Foo(a: i32, b: i32,) {} @@ -25,16 +29,16 @@ fn Foo(a: i32, b: i32,) {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7_11, %.loc7_11.1 [template = i32] -// CHECK:STDOUT: %a.loc7_8.1: i32 = param a -// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7_19 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7_19, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %b.loc7_16.1: i32 = param b -// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1 +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32] +// CHECK:STDOUT: %a.loc11_8.1: i32 = param a +// CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %b.loc11_16.1: i32 = param b +// CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc11_16.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon index 3f8778bd42be..751e69c1d440 100644 --- a/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon +++ b/toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/fail_todo_param_in_type.carbon // CHECK:STDERR: fail_todo_param_in_type.carbon:[[@LINE+3]]:24: ERROR: Semantics TODO: `symbolic array bound`. // CHECK:STDERR: fn F(N:! i32, a: [i32; N]*); @@ -29,19 +33,19 @@ fn F(N:! i32, a: [i32; N]*); // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc10_10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32.loc10_10, %.loc10_10.1 [template = i32] -// CHECK:STDOUT: %N.loc10_6.1: i32 = param N -// CHECK:STDOUT: @F.%N: i32 = bind_symbolic_name N 0, %N.loc10_6.1 [symbolic = constants.%N] -// CHECK:STDOUT: %int.make_type_32.loc10_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_10: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32.loc14_10 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32.loc14_10, %.loc14_10.1 [template = i32] +// CHECK:STDOUT: %N.loc14_6.1: i32 = param N +// CHECK:STDOUT: @F.%N: i32 = bind_symbolic_name N 0, %N.loc14_6.1 [symbolic = constants.%N] +// CHECK:STDOUT: %int.make_type_32.loc14_19: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %N.ref: i32 = name_ref N, @F.%N [symbolic = constants.%N] -// CHECK:STDOUT: %.loc10_19.1: type = value_of_initializer %int.make_type_32.loc10_19 [template = i32] -// CHECK:STDOUT: %.loc10_19.2: type = converted %int.make_type_32.loc10_19, %.loc10_19.1 [template = i32] -// CHECK:STDOUT: %.loc10_25: type = array_type %N.ref, i32 [template = ] -// CHECK:STDOUT: %.loc10_26: type = ptr_type [template = ] -// CHECK:STDOUT: %a.loc10_15.1: = param a -// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc10_15.1 +// CHECK:STDOUT: %.loc14_19.1: type = value_of_initializer %int.make_type_32.loc14_19 [template = i32] +// CHECK:STDOUT: %.loc14_19.2: type = converted %int.make_type_32.loc14_19, %.loc14_19.1 [template = i32] +// CHECK:STDOUT: %.loc14_25: type = array_type %N.ref, i32 [template = ] +// CHECK:STDOUT: %.loc14_26: type = ptr_type [template = ] +// CHECK:STDOUT: %a.loc14_15.1: = param a +// CHECK:STDOUT: @F.%a: = bind_name a, %a.loc14_15.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon b/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon index e77870ddbedd..da7e1f3b6124 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/no_prelude/fail_type_param_mismatch.carbon fn F(T:! type, U:! type) { var p: T*; @@ -28,23 +32,23 @@ fn F(T:! type, U:! type) { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %T.loc7_6.1: type = param T -// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] -// CHECK:STDOUT: %U.loc7_16.1: type = param U -// CHECK:STDOUT: @F.%U: type = bind_symbolic_name U 1, %U.loc7_16.1 [symbolic = constants.%U] +// CHECK:STDOUT: %T.loc11_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc11_6.1 [symbolic = constants.%T] +// CHECK:STDOUT: %U.loc11_16.1: type = param U +// CHECK:STDOUT: @F.%U: type = bind_symbolic_name U 1, %U.loc11_16.1 [symbolic = constants.%U] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type, %U: type) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc12: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var // CHECK:STDOUT: %U.ref: type = name_ref U, %U [symbolic = constants.%U] // CHECK:STDOUT: %p.ref: ref T* = name_ref p, %p -// CHECK:STDOUT: %.loc12_15: T* = bind_value %p.ref -// CHECK:STDOUT: %.loc12_14: ref T = deref %.loc12_15 +// CHECK:STDOUT: %.loc16_15: T* = bind_value %p.ref +// CHECK:STDOUT: %.loc16_14: ref T = deref %.loc16_15 // CHECK:STDOUT: %n: U = bind_name n, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon b/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon index 815fa224bb04..0546e0f8e006 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/type_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/no_prelude/type_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/no_prelude/type_param.carbon fn F(T:! type) { var p: T*; @@ -24,23 +28,23 @@ fn F(T:! type) { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %T.loc7_6.1: type = param T -// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc11_6.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%T: type) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %T.ref.loc8: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc8: type = ptr_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %T.ref.loc12: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc12: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var -// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %p.ref: ref T* = name_ref p, %p -// CHECK:STDOUT: %.loc9_15: T* = bind_value %p.ref -// CHECK:STDOUT: %.loc9_14.1: ref T = deref %.loc9_15 -// CHECK:STDOUT: %.loc9_14.2: T = bind_value %.loc9_14.1 -// CHECK:STDOUT: %n: T = bind_name n, %.loc9_14.2 +// CHECK:STDOUT: %.loc13_15: T* = bind_value %p.ref +// CHECK:STDOUT: %.loc13_14.1: ref T = deref %.loc13_15 +// CHECK:STDOUT: %.loc13_14.2: T = bind_value %.loc13_14.1 +// CHECK:STDOUT: %n: T = bind_name n, %.loc13_14.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon b/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon index 6f6bb4605635..22cfd706eba8 100644 --- a/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon +++ b/toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/no_prelude/type_param_scope.carbon fn F(T:! type, n: T) -> T { let m: T = n; @@ -23,12 +27,12 @@ fn F(T:! type, n: T) -> T { // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %T.loc7_6.1: type = param T -// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc7_6.1 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref.loc7_19: type = name_ref T, @F.%T [symbolic = constants.%T] -// CHECK:STDOUT: %n.loc7_16.1: T = param n -// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc7_16.1 -// CHECK:STDOUT: %T.ref.loc7_25: type = name_ref T, @F.%T [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc11_6.1: type = param T +// CHECK:STDOUT: @F.%T: type = bind_symbolic_name T 0, %T.loc11_6.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc11_19: type = name_ref T, @F.%T [symbolic = constants.%T] +// CHECK:STDOUT: %n.loc11_16.1: T = param n +// CHECK:STDOUT: @F.%n: T = bind_name n, %n.loc11_16.1 +// CHECK:STDOUT: %T.ref.loc11_25: type = name_ref T, @F.%T [symbolic = constants.%T] // CHECK:STDOUT: @F.%return: ref T = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/function/generic/redeclare.carbon b/toolchain/check/testdata/function/generic/redeclare.carbon index 3980770f69fe..776b8c745ac2 100644 --- a/toolchain/check/testdata/function/generic/redeclare.carbon +++ b/toolchain/check/testdata/function/generic/redeclare.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/generic/redeclare.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/redeclare.carbon // --- redeclare.carbon diff --git a/toolchain/check/testdata/global/class_obj.carbon b/toolchain/check/testdata/global/class_obj.carbon index 75f1e1c895e6..550d2ace12d4 100644 --- a/toolchain/check/testdata/global/class_obj.carbon +++ b/toolchain/check/testdata/global/class_obj.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/global/class_obj.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/global/class_obj.carbon class A {} var a: A = {}; @@ -37,10 +41,10 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc8_13.2: init A = class_init (), file.%a.var [template = constants.%struct] -// CHECK:STDOUT: %.loc8_14: init A = converted %.loc8_13.1, %.loc8_13.2 [template = constants.%struct] -// CHECK:STDOUT: assign file.%a.var, %.loc8_14 +// CHECK:STDOUT: %.loc12_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc12_13.2: init A = class_init (), file.%a.var [template = constants.%struct] +// CHECK:STDOUT: %.loc12_14: init A = converted %.loc12_13.1, %.loc12_13.2 [template = constants.%struct] +// CHECK:STDOUT: assign file.%a.var, %.loc12_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/class_with_fun.carbon b/toolchain/check/testdata/global/class_with_fun.carbon index 914c9ceaa41c..9be200154163 100644 --- a/toolchain/check/testdata/global/class_with_fun.carbon +++ b/toolchain/check/testdata/global/class_with_fun.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/global/class_with_fun.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/global/class_with_fun.carbon class A {} fn ret_a() -> A { @@ -33,10 +37,10 @@ var a: A = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {} // CHECK:STDOUT: %ret_a.decl: ret_a = fn_decl @ret_a [template = constants.%struct.1] { -// CHECK:STDOUT: %A.ref.loc8: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: @ret_a.%return: ref A = var // CHECK:STDOUT: } -// CHECK:STDOUT: %A.ref.loc12: type = name_ref A, %A.decl [template = constants.%A] +// CHECK:STDOUT: %A.ref.loc16: type = name_ref A, %A.decl [template = constants.%A] // CHECK:STDOUT: %a.var: ref A = var a // CHECK:STDOUT: %a: ref A = bind_name a, %a.var // CHECK:STDOUT: } @@ -48,18 +52,18 @@ var a: A = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @ret_a() -> %return: A { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_11.1: {} = struct_literal () -// CHECK:STDOUT: %.loc9_11.2: init A = class_init (), %return [template = constants.%struct.2] -// CHECK:STDOUT: %.loc9_12: init A = converted %.loc9_11.1, %.loc9_11.2 [template = constants.%struct.2] -// CHECK:STDOUT: return %.loc9_12 to %return +// CHECK:STDOUT: %.loc13_11.1: {} = struct_literal () +// CHECK:STDOUT: %.loc13_11.2: init A = class_init (), %return [template = constants.%struct.2] +// CHECK:STDOUT: %.loc13_12: init A = converted %.loc13_11.1, %.loc13_11.2 [template = constants.%struct.2] +// CHECK:STDOUT: return %.loc13_12 to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_13.2: init A = class_init (), file.%a.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc12_14: init A = converted %.loc12_13.1, %.loc12_13.2 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%a.var, %.loc12_14 +// CHECK:STDOUT: %.loc16_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc16_13.2: init A = class_init (), file.%a.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc16_14: init A = converted %.loc16_13.1, %.loc16_13.2 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%a.var, %.loc16_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/decl.carbon b/toolchain/check/testdata/global/decl.carbon index e4d29ca63d18..a7e935ced597 100644 --- a/toolchain/check/testdata/global/decl.carbon +++ b/toolchain/check/testdata/global/decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/global/decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/global/decl.carbon var a: i32; // CHECK:STDOUT: --- decl.carbon @@ -21,8 +25,8 @@ var a: i32; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32, %.loc10_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/global/simple_init.carbon b/toolchain/check/testdata/global/simple_init.carbon index aa0985340f72..763ed9b026f2 100644 --- a/toolchain/check/testdata/global/simple_init.carbon +++ b/toolchain/check/testdata/global/simple_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/global/simple_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/global/simple_init.carbon var a: i32 = 0; // CHECK:STDOUT: --- simple_init.carbon @@ -22,8 +26,8 @@ var a: i32 = 0; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc6_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc6_8.2: type = converted %int.make_type_32, %.loc6_8.1 [template = i32] +// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32, %.loc10_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } @@ -32,8 +36,8 @@ var a: i32 = 0; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc6: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign file.%a.var, %.loc6 +// CHECK:STDOUT: %.loc10: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign file.%a.var, %.loc10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/global/simple_with_fun.carbon b/toolchain/check/testdata/global/simple_with_fun.carbon index fe2d3508dc86..d31296a494df 100644 --- a/toolchain/check/testdata/global/simple_with_fun.carbon +++ b/toolchain/check/testdata/global/simple_with_fun.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/global/simple_with_fun.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/global/simple_with_fun.carbon fn test_a() -> i32 { return 0; @@ -30,15 +34,15 @@ var a: i32 = test_a(); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %test_a.decl: test_a = fn_decl @test_a [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7, %.loc7_16.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11, %.loc11_16.1 [template = i32] // CHECK:STDOUT: @test_a.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: } @@ -47,8 +51,8 @@ var a: i32 = test_a(); // CHECK:STDOUT: // CHECK:STDOUT: fn @test_a() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { diff --git a/toolchain/check/testdata/if/else.carbon b/toolchain/check/testdata/if/else.carbon index fbe11e274269..e0db48ca0d60 100644 --- a/toolchain/check/testdata/if/else.carbon +++ b/toolchain/check/testdata/if/else.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if/else.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/else.carbon fn F() {} fn G() {} @@ -48,10 +52,10 @@ fn If(b: bool) { // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] // CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.5] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.4() [template = bool] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc11_10.2: type = converted %bool.make_type, %.loc11_10.1 [template = bool] -// CHECK:STDOUT: %b.loc11_7.1: bool = param b -// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc11_7.1 +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc15_10.2: type = converted %bool.make_type, %.loc15_10.1 [template = bool] +// CHECK:STDOUT: %b.loc15_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc15_7.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon index 6b88f42058f1..500681fb46ce 100644 --- a/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/fail_reachable_fallthrough.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if/fail_reachable_fallthrough.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/fail_reachable_fallthrough.carbon fn If1(b: bool) -> i32 { if (b) { @@ -64,40 +68,40 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %If1.decl: If1 = fn_decl @If1 [template = constants.%struct.3] { -// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] -// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] -// CHECK:STDOUT: %b.loc7_8.1: bool = param b -// CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_20.2: type = converted %int.make_type_32.loc7, %.loc7_20.1 [template = i32] +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] +// CHECK:STDOUT: %b.loc11_8.1: bool = param b +// CHECK:STDOUT: @If1.%b: bool = bind_name b, %b.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_20.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_20.2: type = converted %int.make_type_32.loc11, %.loc11_20.1 [template = i32] // CHECK:STDOUT: @If1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %If2.decl: If2 = fn_decl @If2 [template = constants.%struct.4] { -// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] -// CHECK:STDOUT: %.loc18_11.2: type = converted %bool.make_type.loc18, %.loc18_11.1 [template = bool] -// CHECK:STDOUT: %b.loc18_8.1: bool = param b -// CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc18_8.1 -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_32.loc18, %.loc18_20.1 [template = i32] +// CHECK:STDOUT: %bool.make_type.loc22: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_11.1: type = value_of_initializer %bool.make_type.loc22 [template = bool] +// CHECK:STDOUT: %.loc22_11.2: type = converted %bool.make_type.loc22, %.loc22_11.1 [template = bool] +// CHECK:STDOUT: %b.loc22_8.1: bool = param b +// CHECK:STDOUT: @If2.%b: bool = bind_name b, %b.loc22_8.1 +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc22_20.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_20.2: type = converted %int.make_type_32.loc22, %.loc22_20.1 [template = i32] // CHECK:STDOUT: @If2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %If3.decl: If3 = fn_decl @If3 [template = constants.%struct.5] { -// CHECK:STDOUT: %bool.make_type.loc29: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc29_11.1: type = value_of_initializer %bool.make_type.loc29 [template = bool] -// CHECK:STDOUT: %.loc29_11.2: type = converted %bool.make_type.loc29, %.loc29_11.1 [template = bool] -// CHECK:STDOUT: %b.loc29_8.1: bool = param b -// CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc29_8.1 -// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc29_20.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] -// CHECK:STDOUT: %.loc29_20.2: type = converted %int.make_type_32.loc29, %.loc29_20.1 [template = i32] +// CHECK:STDOUT: %bool.make_type.loc33: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc33_11.1: type = value_of_initializer %bool.make_type.loc33 [template = bool] +// CHECK:STDOUT: %.loc33_11.2: type = converted %bool.make_type.loc33, %.loc33_11.1 [template = bool] +// CHECK:STDOUT: %b.loc33_8.1: bool = param b +// CHECK:STDOUT: @If3.%b: bool = bind_name b, %b.loc33_8.1 +// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc33_20.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] +// CHECK:STDOUT: %.loc33_20.2: type = converted %int.make_type_32.loc33, %.loc33_20.1 [template = i32] // CHECK:STDOUT: @If3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -112,8 +116,8 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: return %.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: br !if.done @@ -130,8 +134,8 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: br !if.done // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc21: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: return %.loc21 +// CHECK:STDOUT: %.loc25: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: return %.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.done: // CHECK:STDOUT: } @@ -142,8 +146,8 @@ fn If3(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc31: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc31 +// CHECK:STDOUT: %.loc35: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: return %.loc35 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/if/fail_scope.carbon b/toolchain/check/testdata/if/fail_scope.carbon index 82d40843c13e..6167cffce381 100644 --- a/toolchain/check/testdata/if/fail_scope.carbon +++ b/toolchain/check/testdata/if/fail_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if/fail_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/fail_scope.carbon fn VarScope(b: bool) -> i32 { if (b) { @@ -38,13 +42,13 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %VarScope.decl: VarScope = fn_decl @VarScope [template = constants.%struct.3] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_16.2: type = converted %bool.make_type, %.loc7_16.1 [template = bool] -// CHECK:STDOUT: %b.loc7_13.1: bool = param b -// CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc7_13.1 +// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_16.2: type = converted %bool.make_type, %.loc11_16.1 [template = bool] +// CHECK:STDOUT: %b.loc11_13.1: bool = param b +// CHECK:STDOUT: @VarScope.%b: bool = bind_name b, %b.loc11_13.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32, %.loc7_25.1 [template = i32] +// CHECK:STDOUT: %.loc11_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_25.2: type = converted %int.make_type_32, %.loc11_25.1 [template = i32] // CHECK:STDOUT: @VarScope.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] @@ -61,18 +65,18 @@ fn VarScope(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_12.2: type = converted %int.make_type_32, %.loc9_12.1 [template = i32] +// CHECK:STDOUT: %.loc13_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_12.2: type = converted %int.make_type_32, %.loc13_12.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc9_18: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc9_18 -// CHECK:STDOUT: %n.ref.loc10: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc10: i32 = bind_value %n.ref.loc10 -// CHECK:STDOUT: return %.loc10 +// CHECK:STDOUT: %.loc13_18: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc13_18 +// CHECK:STDOUT: %n.ref.loc14: ref i32 = name_ref n, %n +// CHECK:STDOUT: %.loc14: i32 = bind_value %n.ref.loc14 +// CHECK:STDOUT: return %.loc14 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %n.ref.loc15: = name_ref n, [template = ] +// CHECK:STDOUT: %n.ref.loc19: = name_ref n, [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/no_else.carbon b/toolchain/check/testdata/if/no_else.carbon index 07e18020abca..b4f4e8b69ca7 100644 --- a/toolchain/check/testdata/if/no_else.carbon +++ b/toolchain/check/testdata/if/no_else.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if/no_else.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/no_else.carbon fn F() {} fn G() {} @@ -41,10 +45,10 @@ fn If(b: bool) { // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.4] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc10_10.2: type = converted %bool.make_type, %.loc10_10.1 [template = bool] -// CHECK:STDOUT: %b.loc10_7.1: bool = param b -// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc10_7.1 +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc14_10.2: type = converted %bool.make_type, %.loc14_10.1 [template = bool] +// CHECK:STDOUT: %b.loc14_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc14_7.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if/unreachable_fallthrough.carbon b/toolchain/check/testdata/if/unreachable_fallthrough.carbon index 715eb15b7a13..765ea770630e 100644 --- a/toolchain/check/testdata/if/unreachable_fallthrough.carbon +++ b/toolchain/check/testdata/if/unreachable_fallthrough.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if/unreachable_fallthrough.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if/unreachable_fallthrough.carbon fn If(b: bool) -> i32 { if (b) { @@ -37,13 +41,13 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %If.decl: If = fn_decl @If [template = constants.%struct.3] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_10.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_10.2: type = converted %bool.make_type, %.loc7_10.1 [template = bool] -// CHECK:STDOUT: %b.loc7_7.1: bool = param b -// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc7_7.1 +// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_10.2: type = converted %bool.make_type, %.loc11_10.1 [template = bool] +// CHECK:STDOUT: %b.loc11_7.1: bool = param b +// CHECK:STDOUT: @If.%b: bool = bind_name b, %b.loc11_7.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32, %.loc11_19.1 [template = i32] // CHECK:STDOUT: @If.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -58,11 +62,11 @@ fn If(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc9: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc9 +// CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: return %.loc13 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc11: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: return %.loc11 +// CHECK:STDOUT: %.loc15: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: return %.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/basic.carbon b/toolchain/check/testdata/if_expr/basic.carbon index 629621d35dcc..7b44b798d26d 100644 --- a/toolchain/check/testdata/if_expr/basic.carbon +++ b/toolchain/check/testdata/if_expr/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/basic.carbon fn F(b: bool, n: i32, m: i32) -> i32 { var x: [i32; 1] = (0,); @@ -39,23 +43,23 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type, %.loc7_9.1 [template = bool] -// CHECK:STDOUT: %b.loc7_6.1: bool = param b -// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_18: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32.loc7_18 [template = i32] -// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32.loc7_18, %.loc7_18.1 [template = i32] -// CHECK:STDOUT: %n.loc7_15.1: i32 = param n -// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc7_15.1 -// CHECK:STDOUT: %int.make_type_32.loc7_26: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_26.1: type = value_of_initializer %int.make_type_32.loc7_26 [template = i32] -// CHECK:STDOUT: %.loc7_26.2: type = converted %int.make_type_32.loc7_26, %.loc7_26.1 [template = i32] -// CHECK:STDOUT: %m.loc7_23.1: i32 = param m -// CHECK:STDOUT: @F.%m: i32 = bind_name m, %m.loc7_23.1 -// CHECK:STDOUT: %int.make_type_32.loc7_34: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %int.make_type_32.loc7_34 [template = i32] -// CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_32.loc7_34, %.loc7_34.1 [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_9.2: type = converted %bool.make_type, %.loc11_9.1 [template = bool] +// CHECK:STDOUT: %b.loc11_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_18: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32.loc11_18 [template = i32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32.loc11_18, %.loc11_18.1 [template = i32] +// CHECK:STDOUT: %n.loc11_15.1: i32 = param n +// CHECK:STDOUT: @F.%n: i32 = bind_name n, %n.loc11_15.1 +// CHECK:STDOUT: %int.make_type_32.loc11_26: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_26.1: type = value_of_initializer %int.make_type_32.loc11_26 [template = i32] +// CHECK:STDOUT: %.loc11_26.2: type = converted %int.make_type_32.loc11_26, %.loc11_26.1 [template = i32] +// CHECK:STDOUT: %m.loc11_23.1: i32 = param m +// CHECK:STDOUT: @F.%m: i32 = bind_name m, %m.loc11_23.1 +// CHECK:STDOUT: %int.make_type_32.loc11_34: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_34.1: type = value_of_initializer %int.make_type_32.loc11_34 [template = i32] +// CHECK:STDOUT: %.loc11_34.2: type = converted %int.make_type_32.loc11_34, %.loc11_34.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] @@ -68,39 +72,39 @@ fn F(b: bool, n: i32, m: i32) -> i32 { // CHECK:STDOUT: fn @F(%b: bool, %n: i32, %m: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32, %.loc8_11.1 [template = i32] -// CHECK:STDOUT: %.loc8_17: type = array_type %.loc8_16, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32, %.loc12_11.1 [template = i32] +// CHECK:STDOUT: %.loc12_17: type = array_type %.loc12_16, i32 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref [i32; 1] = var x // CHECK:STDOUT: %x: ref [i32; 1] = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_22: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_24.1: (i32,) = tuple_literal (%.loc8_22) -// CHECK:STDOUT: %.loc8_24.2: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_24.3: ref i32 = array_index %x.var, %.loc8_24.2 -// CHECK:STDOUT: %.loc8_24.4: init i32 = initialize_from %.loc8_22 to %.loc8_24.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_24.5: init [i32; 1] = array_init (%.loc8_24.4) to %x.var [template = constants.%array] -// CHECK:STDOUT: %.loc8_25: init [i32; 1] = converted %.loc8_24.1, %.loc8_24.5 [template = constants.%array] -// CHECK:STDOUT: assign %x.var, %.loc8_25 +// CHECK:STDOUT: %.loc12_22: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.1: (i32,) = tuple_literal (%.loc12_22) +// CHECK:STDOUT: %.loc12_24.2: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.3: ref i32 = array_index %x.var, %.loc12_24.2 +// CHECK:STDOUT: %.loc12_24.4: init i32 = initialize_from %.loc12_22 to %.loc12_24.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_24.5: init [i32; 1] = array_init (%.loc12_24.4) to %x.var [template = constants.%array] +// CHECK:STDOUT: %.loc12_25: init [i32; 1] = converted %.loc12_24.1, %.loc12_24.5 [template = constants.%array] +// CHECK:STDOUT: assign %x.var, %.loc12_25 // CHECK:STDOUT: %b.ref: bool = name_ref b, %b // CHECK:STDOUT: if %b.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %x.ref.loc9_20: ref [i32; 1] = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc13_20: ref [i32; 1] = name_ref x, %x // CHECK:STDOUT: %m.ref: i32 = name_ref m, %m -// CHECK:STDOUT: %.loc9_23.1: ref i32 = array_index %x.ref.loc9_20, %m.ref -// CHECK:STDOUT: %.loc9_23.2: i32 = bind_value %.loc9_23.1 -// CHECK:STDOUT: br !if.expr.result(%.loc9_23.2) +// CHECK:STDOUT: %.loc13_23.1: ref i32 = array_index %x.ref.loc13_20, %m.ref +// CHECK:STDOUT: %.loc13_23.2: i32 = bind_value %.loc13_23.1 +// CHECK:STDOUT: br !if.expr.result(%.loc13_23.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %x.ref.loc9_30: ref [i32; 1] = name_ref x, %x +// CHECK:STDOUT: %x.ref.loc13_30: ref [i32; 1] = name_ref x, %x // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc9_33.1: ref i32 = array_index %x.ref.loc9_30, %n.ref -// CHECK:STDOUT: %.loc9_33.2: i32 = bind_value %.loc9_33.1 -// CHECK:STDOUT: br !if.expr.result(%.loc9_33.2) +// CHECK:STDOUT: %.loc13_33.1: ref i32 = array_index %x.ref.loc13_30, %n.ref +// CHECK:STDOUT: %.loc13_33.2: i32 = bind_value %.loc13_33.1 +// CHECK:STDOUT: br !if.expr.result(%.loc13_33.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc9_10: i32 = block_arg !if.expr.result -// CHECK:STDOUT: return %.loc9_10 +// CHECK:STDOUT: %.loc13_10: i32 = block_arg !if.expr.result +// CHECK:STDOUT: return %.loc13_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/constant_condition.carbon b/toolchain/check/testdata/if_expr/constant_condition.carbon index 4771f85292bc..325460ce4222 100644 --- a/toolchain/check/testdata/if_expr/constant_condition.carbon +++ b/toolchain/check/testdata/if_expr/constant_condition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/constant_condition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/constant_condition.carbon fn A() -> i32 { return 1; } fn B() -> i32 { return 2; } @@ -65,37 +69,37 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8, %.loc8_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12, %.loc12_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10, %.loc10_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14, %.loc14_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.5] { -// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] -// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14, %.loc14_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] +// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32.loc18, %.loc18_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.6] { -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_18.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_18.2: type = converted %int.make_type_32.loc18, %.loc18_18.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc22_18.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_18.2: type = converted %int.make_type_32.loc22, %.loc22_18.1 [template = i32] // CHECK:STDOUT: @Constant.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -104,11 +108,11 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %PartiallyConstant.decl: PartiallyConstant = fn_decl @PartiallyConstant [template = constants.%struct.7] { -// CHECK:STDOUT: %t.loc24_22.1: type = param t -// CHECK:STDOUT: @PartiallyConstant.%t: type = bind_name t, %t.loc24_22.1 -// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc24_34.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] -// CHECK:STDOUT: %.loc24_34.2: type = converted %int.make_type_32.loc24, %.loc24_34.1 [template = i32] +// CHECK:STDOUT: %t.loc28_22.1: type = param t +// CHECK:STDOUT: @PartiallyConstant.%t: type = bind_name t, %t.loc28_22.1 +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc28_34.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_34.2: type = converted %int.make_type_32.loc28, %.loc28_34.1 [template = i32] // CHECK:STDOUT: @PartiallyConstant.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -119,164 +123,164 @@ fn PartiallyConstant(t: type) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_13: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: if %.loc11_13 br !if.expr.then else br !if.expr.else -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] -// CHECK:STDOUT: %A.call: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %A.call -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %A.call, %.loc11_24.1 -// CHECK:STDOUT: br !if.expr.result(%.loc11_24.2) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] -// CHECK:STDOUT: %B.call: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc11_27.1: i32 = value_of_initializer %B.call -// CHECK:STDOUT: %.loc11_27.2: i32 = converted %B.call, %.loc11_27.1 -// CHECK:STDOUT: br !if.expr.result(%.loc11_27.2) -// CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc11_10: i32 = block_arg !if.expr.result -// CHECK:STDOUT: return %.loc11_10 -// CHECK:STDOUT: } -// CHECK:STDOUT: -// CHECK:STDOUT: fn @G() -> i32 { -// CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal false [template = constants.%.5] +// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.4] // CHECK:STDOUT: if %.loc15_13 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc15_25.1: i32 = value_of_initializer %A.call -// CHECK:STDOUT: %.loc15_25.2: i32 = converted %A.call, %.loc15_25.1 -// CHECK:STDOUT: br !if.expr.result(%.loc15_25.2) +// CHECK:STDOUT: %.loc15_24.1: i32 = value_of_initializer %A.call +// CHECK:STDOUT: %.loc15_24.2: i32 = converted %A.call, %.loc15_24.1 +// CHECK:STDOUT: br !if.expr.result(%.loc15_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc15_28.1: i32 = value_of_initializer %B.call -// CHECK:STDOUT: %.loc15_28.2: i32 = converted %B.call, %.loc15_28.1 -// CHECK:STDOUT: br !if.expr.result(%.loc15_28.2) +// CHECK:STDOUT: %.loc15_27.1: i32 = value_of_initializer %B.call +// CHECK:STDOUT: %.loc15_27.2: i32 = converted %B.call, %.loc15_27.1 +// CHECK:STDOUT: br !if.expr.result(%.loc15_27.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: // CHECK:STDOUT: %.loc15_10: i32 = block_arg !if.expr.result // CHECK:STDOUT: return %.loc15_10 // CHECK:STDOUT: } // CHECK:STDOUT: +// CHECK:STDOUT: fn @G() -> i32 { +// CHECK:STDOUT: !entry: +// CHECK:STDOUT: %.loc19_13: bool = bool_literal false [template = constants.%.5] +// CHECK:STDOUT: if %.loc19_13 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.then: +// CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] +// CHECK:STDOUT: %A.call: init i32 = call %A.ref() +// CHECK:STDOUT: %.loc19_25.1: i32 = value_of_initializer %A.call +// CHECK:STDOUT: %.loc19_25.2: i32 = converted %A.call, %.loc19_25.1 +// CHECK:STDOUT: br !if.expr.result(%.loc19_25.2) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.else: +// CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] +// CHECK:STDOUT: %B.call: init i32 = call %B.ref() +// CHECK:STDOUT: %.loc19_28.1: i32 = value_of_initializer %B.call +// CHECK:STDOUT: %.loc19_28.2: i32 = converted %B.call, %.loc19_28.1 +// CHECK:STDOUT: br !if.expr.result(%.loc19_28.2) +// CHECK:STDOUT: +// CHECK:STDOUT: !if.expr.result: +// CHECK:STDOUT: %.loc19_10: i32 = block_arg !if.expr.result +// CHECK:STDOUT: return %.loc19_10 +// CHECK:STDOUT: } +// CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19_13: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: if %.loc19_13 br !if.expr.then.loc19 else br !if.expr.else.loc19 +// CHECK:STDOUT: %.loc23_13: bool = bool_literal true [template = constants.%.4] +// CHECK:STDOUT: if %.loc23_13 br !if.expr.then.loc23 else br !if.expr.else.loc23 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc19: -// CHECK:STDOUT: %int.make_type_32.loc19_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_23.1: type = value_of_initializer %int.make_type_32.loc19_23 [template = i32] -// CHECK:STDOUT: %.loc19_23.2: type = converted %int.make_type_32.loc19_23, %.loc19_23.1 [template = i32] -// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_23.2) +// CHECK:STDOUT: !if.expr.then.loc23: +// CHECK:STDOUT: %int.make_type_32.loc23_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_23.1: type = value_of_initializer %int.make_type_32.loc23_23 [template = i32] +// CHECK:STDOUT: %.loc23_23.2: type = converted %int.make_type_32.loc23_23, %.loc23_23.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc23(%.loc23_23.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc19: -// CHECK:STDOUT: %int.make_type_32.loc19_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_35.1: type = value_of_initializer %int.make_type_32.loc19_32 [template = i32] -// CHECK:STDOUT: %.loc19_35.2: type = converted %int.make_type_32.loc19_32, %.loc19_35.1 [template = i32] -// CHECK:STDOUT: %.loc19_35.3: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_35.3) +// CHECK:STDOUT: !if.expr.else.loc23: +// CHECK:STDOUT: %int.make_type_32.loc23_32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_35.1: type = value_of_initializer %int.make_type_32.loc23_32 [template = i32] +// CHECK:STDOUT: %.loc23_35.2: type = converted %int.make_type_32.loc23_32, %.loc23_35.1 [template = i32] +// CHECK:STDOUT: %.loc23_35.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc23(%.loc23_35.3) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc19: -// CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = i32] +// CHECK:STDOUT: !if.expr.result.loc23: +// CHECK:STDOUT: %.loc23_10: type = block_arg !if.expr.result.loc23 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_39: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc19_39 -// CHECK:STDOUT: %.loc20_13: bool = bool_literal false [template = constants.%.5] -// CHECK:STDOUT: if %.loc20_13 br !if.expr.then.loc20 else br !if.expr.else.loc20 +// CHECK:STDOUT: %.loc23_39: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: assign %v.var, %.loc23_39 +// CHECK:STDOUT: %.loc24_13: bool = bool_literal false [template = constants.%.5] +// CHECK:STDOUT: if %.loc24_13 br !if.expr.then.loc24 else br !if.expr.else.loc24 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc20: -// CHECK:STDOUT: %int.make_type_32.loc20_24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc20_24.1: type = value_of_initializer %int.make_type_32.loc20_24 [template = i32] -// CHECK:STDOUT: %.loc20_24.2: type = converted %int.make_type_32.loc20_24, %.loc20_24.1 [template = i32] -// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_24.2) +// CHECK:STDOUT: !if.expr.then.loc24: +// CHECK:STDOUT: %int.make_type_32.loc24_24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_24.1: type = value_of_initializer %int.make_type_32.loc24_24 [template = i32] +// CHECK:STDOUT: %.loc24_24.2: type = converted %int.make_type_32.loc24_24, %.loc24_24.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc24(%.loc24_24.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc20: -// CHECK:STDOUT: %int.make_type_32.loc20_33: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc20_36.1: type = value_of_initializer %int.make_type_32.loc20_33 [template = i32] -// CHECK:STDOUT: %.loc20_36.2: type = converted %int.make_type_32.loc20_33, %.loc20_36.1 [template = i32] -// CHECK:STDOUT: %.loc20_36.3: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_36.3) +// CHECK:STDOUT: !if.expr.else.loc24: +// CHECK:STDOUT: %int.make_type_32.loc24_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc24_36.1: type = value_of_initializer %int.make_type_32.loc24_33 [template = i32] +// CHECK:STDOUT: %.loc24_36.2: type = converted %int.make_type_32.loc24_33, %.loc24_36.1 [template = i32] +// CHECK:STDOUT: %.loc24_36.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc24(%.loc24_36.3) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc20: -// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = constants.%.6] +// CHECK:STDOUT: !if.expr.result.loc24: +// CHECK:STDOUT: %.loc24_10: type = block_arg !if.expr.result.loc24 [template = constants.%.6] // CHECK:STDOUT: %w.var: ref i32* = var w // CHECK:STDOUT: %w: ref i32* = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v -// CHECK:STDOUT: %.loc20_40: i32* = addr_of %v.ref -// CHECK:STDOUT: assign %w.var, %.loc20_40 +// CHECK:STDOUT: %.loc24_40: i32* = addr_of %v.ref +// CHECK:STDOUT: assign %w.var, %.loc24_40 // CHECK:STDOUT: %w.ref: ref i32* = name_ref w, %w -// CHECK:STDOUT: %.loc21_11: i32* = bind_value %w.ref -// CHECK:STDOUT: %.loc21_10.1: ref i32 = deref %.loc21_11 -// CHECK:STDOUT: %.loc21_10.2: i32 = bind_value %.loc21_10.1 -// CHECK:STDOUT: return %.loc21_10.2 +// CHECK:STDOUT: %.loc25_11: i32* = bind_value %w.ref +// CHECK:STDOUT: %.loc25_10.1: ref i32 = deref %.loc25_11 +// CHECK:STDOUT: %.loc25_10.2: i32 = bind_value %.loc25_10.1 +// CHECK:STDOUT: return %.loc25_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @PartiallyConstant(%t: type) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc25_13: bool = bool_literal true [template = constants.%.4] -// CHECK:STDOUT: if %.loc25_13 br !if.expr.then.loc25 else br !if.expr.else.loc25 +// CHECK:STDOUT: %.loc29_13: bool = bool_literal true [template = constants.%.4] +// CHECK:STDOUT: if %.loc29_13 br !if.expr.then.loc29 else br !if.expr.else.loc29 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc25: -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_23.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_23.2: type = converted %int.make_type_32.loc25, %.loc25_23.1 [template = i32] -// CHECK:STDOUT: br !if.expr.result.loc25(%.loc25_23.2) +// CHECK:STDOUT: !if.expr.then.loc29: +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_23.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_23.2: type = converted %int.make_type_32.loc29, %.loc29_23.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result.loc29(%.loc29_23.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc25: -// CHECK:STDOUT: %t.ref.loc25: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc25(%t.ref.loc25) +// CHECK:STDOUT: !if.expr.else.loc29: +// CHECK:STDOUT: %t.ref.loc29: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc29(%t.ref.loc29) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc25: -// CHECK:STDOUT: %.loc25_10: type = block_arg !if.expr.result.loc25 [template = i32] +// CHECK:STDOUT: !if.expr.result.loc29: +// CHECK:STDOUT: %.loc29_10: type = block_arg !if.expr.result.loc29 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc25_36: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc25_36 -// CHECK:STDOUT: %.loc26_13: bool = bool_literal false [template = constants.%.5] -// CHECK:STDOUT: if %.loc26_13 br !if.expr.then.loc26 else br !if.expr.else.loc26 +// CHECK:STDOUT: %.loc29_36: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: assign %v.var, %.loc29_36 +// CHECK:STDOUT: %.loc30_13: bool = bool_literal false [template = constants.%.5] +// CHECK:STDOUT: if %.loc30_13 br !if.expr.then.loc30 else br !if.expr.else.loc30 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc26: -// CHECK:STDOUT: %t.ref.loc26: type = name_ref t, %t -// CHECK:STDOUT: br !if.expr.result.loc26(%t.ref.loc26) +// CHECK:STDOUT: !if.expr.then.loc30: +// CHECK:STDOUT: %t.ref.loc30: type = name_ref t, %t +// CHECK:STDOUT: br !if.expr.result.loc30(%t.ref.loc30) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc26: -// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc26_34.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] -// CHECK:STDOUT: %.loc26_34.2: type = converted %int.make_type_32.loc26, %.loc26_34.1 [template = i32] -// CHECK:STDOUT: %.loc26_34.3: type = ptr_type i32 [template = constants.%.6] -// CHECK:STDOUT: br !if.expr.result.loc26(%.loc26_34.3) +// CHECK:STDOUT: !if.expr.else.loc30: +// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc30_34.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] +// CHECK:STDOUT: %.loc30_34.2: type = converted %int.make_type_32.loc30, %.loc30_34.1 [template = i32] +// CHECK:STDOUT: %.loc30_34.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: br !if.expr.result.loc30(%.loc30_34.3) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc26: -// CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result.loc26 [template = constants.%.6] +// CHECK:STDOUT: !if.expr.result.loc30: +// CHECK:STDOUT: %.loc30_10: type = block_arg !if.expr.result.loc30 [template = constants.%.6] // CHECK:STDOUT: %w.var: ref i32* = var w // CHECK:STDOUT: %w: ref i32* = bind_name w, %w.var // CHECK:STDOUT: %v.ref: ref i32 = name_ref v, %v -// CHECK:STDOUT: %.loc26_38: i32* = addr_of %v.ref -// CHECK:STDOUT: assign %w.var, %.loc26_38 +// CHECK:STDOUT: %.loc30_38: i32* = addr_of %v.ref +// CHECK:STDOUT: assign %w.var, %.loc30_38 // CHECK:STDOUT: %w.ref: ref i32* = name_ref w, %w -// CHECK:STDOUT: %.loc27_11: i32* = bind_value %w.ref -// CHECK:STDOUT: %.loc27_10.1: ref i32 = deref %.loc27_11 -// CHECK:STDOUT: %.loc27_10.2: i32 = bind_value %.loc27_10.1 -// CHECK:STDOUT: return %.loc27_10.2 +// CHECK:STDOUT: %.loc31_11: i32* = bind_value %w.ref +// CHECK:STDOUT: %.loc31_10.1: ref i32 = deref %.loc31_11 +// CHECK:STDOUT: %.loc31_10.2: i32 = bind_value %.loc31_10.1 +// CHECK:STDOUT: return %.loc31_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/control_flow.carbon b/toolchain/check/testdata/if_expr/control_flow.carbon index 418df3e03683..6e7aa714a3ea 100644 --- a/toolchain/check/testdata/if_expr/control_flow.carbon +++ b/toolchain/check/testdata/if_expr/control_flow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/control_flow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/control_flow.carbon fn A() -> i32 { return 1; } fn B() -> i32 { return 2; } @@ -39,29 +43,29 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_11.2: type = converted %int.make_type_32.loc8, %.loc8_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_11.2: type = converted %int.make_type_32.loc12, %.loc12_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.4] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.4() [template = bool] -// CHECK:STDOUT: %.loc10_9.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc10_9.2: type = converted %bool.make_type, %.loc10_9.1 [template = bool] -// CHECK:STDOUT: %b.loc10_6.1: bool = param b -// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc10_6.1 -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_18.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_18.2: type = converted %int.make_type_32.loc10, %.loc10_18.1 [template = i32] +// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc14_9.2: type = converted %bool.make_type, %.loc14_9.1 [template = bool] +// CHECK:STDOUT: %b.loc14_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc14_6.1 +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_18.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_18.2: type = converted %int.make_type_32.loc14, %.loc14_18.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -70,14 +74,14 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; @@ -90,19 +94,19 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc11_21.1: i32 = value_of_initializer %A.call -// CHECK:STDOUT: %.loc11_21.2: i32 = converted %A.call, %.loc11_21.1 -// CHECK:STDOUT: br !if.expr.result(%.loc11_21.2) +// CHECK:STDOUT: %.loc15_21.1: i32 = value_of_initializer %A.call +// CHECK:STDOUT: %.loc15_21.2: i32 = converted %A.call, %.loc15_21.1 +// CHECK:STDOUT: br !if.expr.result(%.loc15_21.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: // CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init i32 = call %B.ref() -// CHECK:STDOUT: %.loc11_24.1: i32 = value_of_initializer %B.call -// CHECK:STDOUT: %.loc11_24.2: i32 = converted %B.call, %.loc11_24.1 -// CHECK:STDOUT: br !if.expr.result(%.loc11_24.2) +// CHECK:STDOUT: %.loc15_24.1: i32 = value_of_initializer %B.call +// CHECK:STDOUT: %.loc15_24.2: i32 = converted %B.call, %.loc15_24.1 +// CHECK:STDOUT: br !if.expr.result(%.loc15_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc11_10: i32 = block_arg !if.expr.result -// CHECK:STDOUT: return %.loc11_10 +// CHECK:STDOUT: %.loc15_10: i32 = block_arg !if.expr.result +// CHECK:STDOUT: return %.loc15_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon index e629f97ab756..b6e45d62a99e 100644 --- a/toolchain/check/testdata/if_expr/fail_not_in_function.carbon +++ b/toolchain/check/testdata/if_expr/fail_not_in_function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/fail_not_in_function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/fail_not_in_function.carbon // CHECK:STDERR: fail_not_in_function.carbon:[[@LINE+12]]:14: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: let x: i32 = if true then 1 else 0; @@ -51,16 +55,16 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc19: i32 = block_arg [template = constants.%.3] -// CHECK:STDOUT: %x: i32 = bind_name x, %.loc19 +// CHECK:STDOUT: %.loc23: i32 = block_arg [template = constants.%.3] +// CHECK:STDOUT: %x: i32 = bind_name x, %.loc23 // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.2] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc33: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc33 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %.loc37: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc37 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C diff --git a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon index cf96549b4859..d20fd2e715dc 100644 --- a/toolchain/check/testdata/if_expr/fail_partial_constant.carbon +++ b/toolchain/check/testdata/if_expr/fail_partial_constant.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/fail_partial_constant.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/fail_partial_constant.carbon // --- fail_non_constant_condition.carbon diff --git a/toolchain/check/testdata/if_expr/nested.carbon b/toolchain/check/testdata/if_expr/nested.carbon index da5d4a03c7e0..3a271daa3a2c 100644 --- a/toolchain/check/testdata/if_expr/nested.carbon +++ b/toolchain/check/testdata/if_expr/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/nested.carbon fn F(a: bool, b: bool, c: bool) -> i32 { return if a then if b then 1 else 2 else if c then 3 else 4; @@ -35,24 +39,24 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { -// CHECK:STDOUT: %bool.make_type.loc7_9: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type.loc7_9 [template = bool] -// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type.loc7_9, %.loc7_9.1 [template = bool] -// CHECK:STDOUT: %a.loc7_6.1: bool = param a -// CHECK:STDOUT: @F.%a: bool = bind_name a, %a.loc7_6.1 -// CHECK:STDOUT: %bool.make_type.loc7_18: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %bool.make_type.loc7_18 [template = bool] -// CHECK:STDOUT: %.loc7_18.2: type = converted %bool.make_type.loc7_18, %.loc7_18.1 [template = bool] -// CHECK:STDOUT: %b.loc7_15.1: bool = param b -// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_15.1 -// CHECK:STDOUT: %bool.make_type.loc7_27: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_27.1: type = value_of_initializer %bool.make_type.loc7_27 [template = bool] -// CHECK:STDOUT: %.loc7_27.2: type = converted %bool.make_type.loc7_27, %.loc7_27.1 [template = bool] -// CHECK:STDOUT: %c.loc7_24.1: bool = param c -// CHECK:STDOUT: @F.%c: bool = bind_name c, %c.loc7_24.1 +// CHECK:STDOUT: %bool.make_type.loc11_9: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %bool.make_type.loc11_9 [template = bool] +// CHECK:STDOUT: %.loc11_9.2: type = converted %bool.make_type.loc11_9, %.loc11_9.1 [template = bool] +// CHECK:STDOUT: %a.loc11_6.1: bool = param a +// CHECK:STDOUT: @F.%a: bool = bind_name a, %a.loc11_6.1 +// CHECK:STDOUT: %bool.make_type.loc11_18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %bool.make_type.loc11_18 [template = bool] +// CHECK:STDOUT: %.loc11_18.2: type = converted %bool.make_type.loc11_18, %.loc11_18.1 [template = bool] +// CHECK:STDOUT: %b.loc11_15.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc11_15.1 +// CHECK:STDOUT: %bool.make_type.loc11_27: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_27.1: type = value_of_initializer %bool.make_type.loc11_27 [template = bool] +// CHECK:STDOUT: %.loc11_27.2: type = converted %bool.make_type.loc11_27, %.loc11_27.1 [template = bool] +// CHECK:STDOUT: %c.loc11_24.1: bool = param c +// CHECK:STDOUT: @F.%c: bool = bind_name c, %c.loc11_24.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_36.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_36.2: type = converted %int.make_type_32, %.loc7_36.1 [template = i32] +// CHECK:STDOUT: %.loc11_36.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_36.2: type = converted %int.make_type_32, %.loc11_36.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -64,42 +68,42 @@ fn F(a: bool, b: bool, c: bool) -> i32 { // CHECK:STDOUT: fn @F(%a: bool, %b: bool, %c: bool) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: bool = name_ref a, %a -// CHECK:STDOUT: if %a.ref br !if.expr.then.loc8_10 else br !if.expr.else.loc8_10 +// CHECK:STDOUT: if %a.ref br !if.expr.then.loc12_10 else br !if.expr.else.loc12_10 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8_10: +// CHECK:STDOUT: !if.expr.then.loc12_10: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b -// CHECK:STDOUT: if %b.ref br !if.expr.then.loc8_20 else br !if.expr.else.loc8_20 +// CHECK:STDOUT: if %b.ref br !if.expr.then.loc12_20 else br !if.expr.else.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8_20: -// CHECK:STDOUT: %.loc8_30: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_30) +// CHECK:STDOUT: !if.expr.then.loc12_20: +// CHECK:STDOUT: %.loc12_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_30) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8_20: -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: br !if.expr.result.loc8_20(%.loc8_37) +// CHECK:STDOUT: !if.expr.else.loc12_20: +// CHECK:STDOUT: %.loc12_37: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: br !if.expr.result.loc12_20(%.loc12_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8_20: -// CHECK:STDOUT: %.loc8_20: i32 = block_arg !if.expr.result.loc8_20 -// CHECK:STDOUT: br !if.expr.result.loc8_10(%.loc8_20) +// CHECK:STDOUT: !if.expr.result.loc12_20: +// CHECK:STDOUT: %.loc12_20: i32 = block_arg !if.expr.result.loc12_20 +// CHECK:STDOUT: br !if.expr.result.loc12_10(%.loc12_20) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8_10: +// CHECK:STDOUT: !if.expr.else.loc12_10: // CHECK:STDOUT: %c.ref: bool = name_ref c, %c -// CHECK:STDOUT: if %c.ref br !if.expr.then.loc8_44 else br !if.expr.else.loc8_44 +// CHECK:STDOUT: if %c.ref br !if.expr.then.loc12_44 else br !if.expr.else.loc12_44 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc8_44: -// CHECK:STDOUT: %.loc8_54: i32 = int_literal 3 [template = constants.%.4] -// CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_54) +// CHECK:STDOUT: !if.expr.then.loc12_44: +// CHECK:STDOUT: %.loc12_54: i32 = int_literal 3 [template = constants.%.4] +// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_54) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc8_44: -// CHECK:STDOUT: %.loc8_61: i32 = int_literal 4 [template = constants.%.5] -// CHECK:STDOUT: br !if.expr.result.loc8_44(%.loc8_61) +// CHECK:STDOUT: !if.expr.else.loc12_44: +// CHECK:STDOUT: %.loc12_61: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: br !if.expr.result.loc12_44(%.loc12_61) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8_44: -// CHECK:STDOUT: %.loc8_44: i32 = block_arg !if.expr.result.loc8_44 -// CHECK:STDOUT: br !if.expr.result.loc8_10(%.loc8_44) +// CHECK:STDOUT: !if.expr.result.loc12_44: +// CHECK:STDOUT: %.loc12_44: i32 = block_arg !if.expr.result.loc12_44 +// CHECK:STDOUT: br !if.expr.result.loc12_10(%.loc12_44) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc8_10: -// CHECK:STDOUT: %.loc8_10: i32 = block_arg !if.expr.result.loc8_10 -// CHECK:STDOUT: return %.loc8_10 +// CHECK:STDOUT: !if.expr.result.loc12_10: +// CHECK:STDOUT: %.loc12_10: i32 = block_arg !if.expr.result.loc12_10 +// CHECK:STDOUT: return %.loc12_10 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/if_expr/struct.carbon b/toolchain/check/testdata/if_expr/struct.carbon index 9a861b0ffabe..06035a1170df 100644 --- a/toolchain/check/testdata/if_expr/struct.carbon +++ b/toolchain/check/testdata/if_expr/struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/if_expr/struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/if_expr/struct.carbon fn G(s: {.a: i32, .b: i32}); @@ -40,23 +44,23 @@ fn F(cond: bool) { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32.loc7_14, %.loc7_14.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_23.1: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] -// CHECK:STDOUT: %.loc7_23.2: type = converted %int.make_type_32.loc7_23, %.loc7_23.1 [template = i32] -// CHECK:STDOUT: %.loc7_26: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] -// CHECK:STDOUT: %s.loc7_6.1: {.a: i32, .b: i32} = param s -// CHECK:STDOUT: @G.%s: {.a: i32, .b: i32} = bind_name s, %s.loc7_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11_14, %.loc11_14.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_23.1: type = value_of_initializer %int.make_type_32.loc11_23 [template = i32] +// CHECK:STDOUT: %.loc11_23.2: type = converted %int.make_type_32.loc11_23, %.loc11_23.1 [template = i32] +// CHECK:STDOUT: %.loc11_26: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %s.loc11_6.1: {.a: i32, .b: i32} = param s +// CHECK:STDOUT: @G.%s: {.a: i32, .b: i32} = bind_name s, %s.loc11_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.3] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.4] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc9_12.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc9_12.2: type = converted %bool.make_type, %.loc9_12.1 [template = bool] -// CHECK:STDOUT: %cond.loc9_6.1: bool = param cond -// CHECK:STDOUT: @F.%cond: bool = bind_name cond, %cond.loc9_6.1 +// CHECK:STDOUT: %.loc13_12.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc13_12.2: type = converted %bool.make_type, %.loc13_12.1 [template = bool] +// CHECK:STDOUT: %cond.loc13_6.1: bool = param cond +// CHECK:STDOUT: @F.%cond: bool = bind_name cond, %cond.loc13_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -70,52 +74,52 @@ fn F(cond: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%cond: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10_15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] -// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_32.loc10_15, %.loc10_15.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_24.1: type = value_of_initializer %int.make_type_32.loc10_24 [template = i32] -// CHECK:STDOUT: %.loc10_24.2: type = converted %int.make_type_32.loc10_24, %.loc10_24.1 [template = i32] -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc14_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32.loc14_15 [template = i32] +// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32.loc14_15, %.loc14_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_24: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_24.1: type = value_of_initializer %int.make_type_32.loc14_24 [template = i32] +// CHECK:STDOUT: %.loc14_24.2: type = converted %int.make_type_32.loc14_24, %.loc14_24.1 [template = i32] +// CHECK:STDOUT: %.loc14_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %a.var: ref {.a: i32, .b: i32} = var a // CHECK:STDOUT: %a: ref {.a: i32, .b: i32} = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_45: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_46.1: {.a: i32, .b: i32} = struct_literal (%.loc10_37, %.loc10_45) -// CHECK:STDOUT: %.loc10_46.2: ref i32 = struct_access %a.var, element0 -// CHECK:STDOUT: %.loc10_46.3: init i32 = initialize_from %.loc10_37 to %.loc10_46.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_46.4: ref i32 = struct_access %a.var, element1 -// CHECK:STDOUT: %.loc10_46.5: init i32 = initialize_from %.loc10_45 to %.loc10_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_46.6: init {.a: i32, .b: i32} = struct_init (%.loc10_46.3, %.loc10_46.5) to %a.var [template = constants.%struct.5] -// CHECK:STDOUT: %.loc10_47: init {.a: i32, .b: i32} = converted %.loc10_46.1, %.loc10_46.6 [template = constants.%struct.5] -// CHECK:STDOUT: assign %a.var, %.loc10_47 +// CHECK:STDOUT: %.loc14_37: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_45: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_46.1: {.a: i32, .b: i32} = struct_literal (%.loc14_37, %.loc14_45) +// CHECK:STDOUT: %.loc14_46.2: ref i32 = struct_access %a.var, element0 +// CHECK:STDOUT: %.loc14_46.3: init i32 = initialize_from %.loc14_37 to %.loc14_46.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_46.4: ref i32 = struct_access %a.var, element1 +// CHECK:STDOUT: %.loc14_46.5: init i32 = initialize_from %.loc14_45 to %.loc14_46.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_46.6: init {.a: i32, .b: i32} = struct_init (%.loc14_46.3, %.loc14_46.5) to %a.var [template = constants.%struct.5] +// CHECK:STDOUT: %.loc14_47: init {.a: i32, .b: i32} = converted %.loc14_46.1, %.loc14_46.6 [template = constants.%struct.5] +// CHECK:STDOUT: assign %a.var, %.loc14_47 // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %cond.ref: bool = name_ref cond, %cond // CHECK:STDOUT: if %cond.ref br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %a.ref.loc11_18: ref {.a: i32, .b: i32} = name_ref a, %a -// CHECK:STDOUT: %.loc11_18.1: ref i32 = struct_access %a.ref.loc11_18, element0 -// CHECK:STDOUT: %.loc11_18.2: i32 = bind_value %.loc11_18.1 -// CHECK:STDOUT: %.loc11_18.3: ref i32 = struct_access %a.ref.loc11_18, element1 -// CHECK:STDOUT: %.loc11_18.4: i32 = bind_value %.loc11_18.3 -// CHECK:STDOUT: %struct.loc11_18: {.a: i32, .b: i32} = struct_value (%.loc11_18.2, %.loc11_18.4) -// CHECK:STDOUT: %.loc11_18.5: {.a: i32, .b: i32} = converted %a.ref.loc11_18, %struct.loc11_18 -// CHECK:STDOUT: br !if.expr.result(%.loc11_18.5) +// CHECK:STDOUT: %a.ref.loc15_18: ref {.a: i32, .b: i32} = name_ref a, %a +// CHECK:STDOUT: %.loc15_18.1: ref i32 = struct_access %a.ref.loc15_18, element0 +// CHECK:STDOUT: %.loc15_18.2: i32 = bind_value %.loc15_18.1 +// CHECK:STDOUT: %.loc15_18.3: ref i32 = struct_access %a.ref.loc15_18, element1 +// CHECK:STDOUT: %.loc15_18.4: i32 = bind_value %.loc15_18.3 +// CHECK:STDOUT: %struct.loc15_18: {.a: i32, .b: i32} = struct_value (%.loc15_18.2, %.loc15_18.4) +// CHECK:STDOUT: %.loc15_18.5: {.a: i32, .b: i32} = converted %a.ref.loc15_18, %struct.loc15_18 +// CHECK:STDOUT: br !if.expr.result(%.loc15_18.5) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %a.ref.loc11_25: ref {.a: i32, .b: i32} = name_ref a, %a -// CHECK:STDOUT: %.loc11_25.1: ref i32 = struct_access %a.ref.loc11_25, element0 -// CHECK:STDOUT: %.loc11_25.2: i32 = bind_value %.loc11_25.1 -// CHECK:STDOUT: %.loc11_25.3: ref i32 = struct_access %a.ref.loc11_25, element1 -// CHECK:STDOUT: %.loc11_25.4: i32 = bind_value %.loc11_25.3 -// CHECK:STDOUT: %struct.loc11_25: {.a: i32, .b: i32} = struct_value (%.loc11_25.2, %.loc11_25.4) -// CHECK:STDOUT: %.loc11_20: {.a: i32, .b: i32} = converted %a.ref.loc11_25, %struct.loc11_25 -// CHECK:STDOUT: br !if.expr.result(%.loc11_20) +// CHECK:STDOUT: %a.ref.loc15_25: ref {.a: i32, .b: i32} = name_ref a, %a +// CHECK:STDOUT: %.loc15_25.1: ref i32 = struct_access %a.ref.loc15_25, element0 +// CHECK:STDOUT: %.loc15_25.2: i32 = bind_value %.loc15_25.1 +// CHECK:STDOUT: %.loc15_25.3: ref i32 = struct_access %a.ref.loc15_25, element1 +// CHECK:STDOUT: %.loc15_25.4: i32 = bind_value %.loc15_25.3 +// CHECK:STDOUT: %struct.loc15_25: {.a: i32, .b: i32} = struct_value (%.loc15_25.2, %.loc15_25.4) +// CHECK:STDOUT: %.loc15_20: {.a: i32, .b: i32} = converted %a.ref.loc15_25, %struct.loc15_25 +// CHECK:STDOUT: br !if.expr.result(%.loc15_20) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc11_5: {.a: i32, .b: i32} = block_arg !if.expr.result -// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc11_5) +// CHECK:STDOUT: %.loc15_5: {.a: i32, .b: i32} = block_arg !if.expr.result +// CHECK:STDOUT: %G.call: init () = call %G.ref(%.loc15_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/compound.carbon b/toolchain/check/testdata/impl/compound.carbon index dd898a8494cf..d7e789a0fd1d 100644 --- a/toolchain/check/testdata/impl/compound.carbon +++ b/toolchain/check/testdata/impl/compound.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/compound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/compound.carbon interface Simple { fn F(); @@ -75,65 +79,65 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_6.2: type = converted %int.make_type_32.loc12, %.loc12_6.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc16_6.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_6.2: type = converted %int.make_type_32.loc16, %.loc16_6.1 [template = i32] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %NonInstanceCall.decl: NonInstanceCall = fn_decl @NonInstanceCall [template = constants.%struct.6] { -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc17_23.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_23.2: type = converted %int.make_type_32.loc17, %.loc17_23.1 [template = i32] -// CHECK:STDOUT: %n.loc17_20.1: i32 = param n -// CHECK:STDOUT: @NonInstanceCall.%n: i32 = bind_name n, %n.loc17_20.1 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_23.2: type = converted %int.make_type_32.loc21, %.loc21_23.1 [template = i32] +// CHECK:STDOUT: %n.loc21_20.1: i32 = param n +// CHECK:STDOUT: @NonInstanceCall.%n: i32 = bind_name n, %n.loc21_20.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.7] { -// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc21_20.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] -// CHECK:STDOUT: %.loc21_20.2: type = converted %int.make_type_32.loc21, %.loc21_20.1 [template = i32] -// CHECK:STDOUT: %n.loc21_17.1: i32 = param n -// CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc21_17.1 +// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc25_20.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] +// CHECK:STDOUT: %.loc25_20.2: type = converted %int.make_type_32.loc25, %.loc25_20.1 [template = i32] +// CHECK:STDOUT: %n.loc25_17.1: i32 = param n +// CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc25_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %NonInstanceCallIndirect.decl: NonInstanceCallIndirect = fn_decl @NonInstanceCallIndirect [template = constants.%struct.8] { -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc25_34.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_34.2: type = converted %int.make_type_32.loc25, %.loc25_34.1 [template = i32] -// CHECK:STDOUT: %.loc25_34.3: type = ptr_type i32 [template = constants.%.8] -// CHECK:STDOUT: %p.loc25_28.1: i32* = param p -// CHECK:STDOUT: @NonInstanceCallIndirect.%p: i32* = bind_name p, %p.loc25_28.1 +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc29_34.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_34.2: type = converted %int.make_type_32.loc29, %.loc29_34.1 [template = i32] +// CHECK:STDOUT: %.loc29_34.3: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %p.loc29_28.1: i32* = param p +// CHECK:STDOUT: @NonInstanceCallIndirect.%p: i32* = bind_name p, %p.loc29_28.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %InstanceCallIndirect.decl: InstanceCallIndirect = fn_decl @InstanceCallIndirect [template = constants.%struct.9] { -// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc29_31.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] -// CHECK:STDOUT: %.loc29_31.2: type = converted %int.make_type_32.loc29, %.loc29_31.1 [template = i32] -// CHECK:STDOUT: %.loc29_31.3: type = ptr_type i32 [template = constants.%.8] -// CHECK:STDOUT: %p.loc29_25.1: i32* = param p -// CHECK:STDOUT: @InstanceCallIndirect.%p: i32* = bind_name p, %p.loc29_25.1 +// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct.3() [template = i32] +// CHECK:STDOUT: %.loc33_31.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] +// CHECK:STDOUT: %.loc33_31.2: type = converted %int.make_type_32.loc33, %.loc33_31.1 [template = i32] +// CHECK:STDOUT: %.loc33_31.3: type = ptr_type i32 [template = constants.%.8] +// CHECK:STDOUT: %p.loc33_25.1: i32* = param p +// CHECK:STDOUT: @InstanceCallIndirect.%p: i32* = bind_name p, %p.loc33_25.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: Simple = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc9_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc9_14.2: type = converted %Self.ref, %.loc9_14.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %self.loc9_8.1: Self = param self -// CHECK:STDOUT: %self.loc9_8.2: Self = bind_name self, %self.loc9_8.1 +// CHECK:STDOUT: %.loc13_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc13_14.2: type = converted %Self.ref, %.loc13_14.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %self.loc13_8.1: Self = param self +// CHECK:STDOUT: %self.loc13_8.2: Self = bind_name self, %self.loc13_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc9_21: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc13_21: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: .G = %.loc9_21 +// CHECK:STDOUT: .F = %.loc12 +// CHECK:STDOUT: .G = %.loc13_21 // CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -141,10 +145,10 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.5] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc14_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_14.2: type = converted %int.make_type_32, %.loc14_14.1 [template = i32] -// CHECK:STDOUT: %self.loc14_8.1: i32 = param self -// CHECK:STDOUT: %self.loc14_8.2: i32 = bind_name self, %self.loc14_8.1 +// CHECK:STDOUT: %.loc18_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_14.2: type = converted %int.make_type_32, %.loc18_14.1 [template = i32] +// CHECK:STDOUT: %self.loc18_8.1: i32 = param self +// CHECK:STDOUT: %self.loc18_8.2: i32 = bind_name self, %self.loc18_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl, %G.decl) [template = constants.%.7] // CHECK:STDOUT: @@ -156,19 +160,19 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.1(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.1[@Simple.%self.loc9_8.2: Self](); +// CHECK:STDOUT: fn @G.1[@Simple.%self.loc13_8.2: Self](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2(); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2[@impl.%self.loc14_8.2: i32](); +// CHECK:STDOUT: fn @G.2[@impl.%self.loc18_8.2: i32](); // CHECK:STDOUT: // CHECK:STDOUT: fn @NonInstanceCall(%n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc12 [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.4] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return @@ -178,10 +182,10 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc13_21 [template = constants.%.6] // CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.5] -// CHECK:STDOUT: %.loc22: = bound_method %n.ref, %.1 -// CHECK:STDOUT: %G.call: init () = call %.loc22(%n.ref) +// CHECK:STDOUT: %.loc26: = bound_method %n.ref, %.1 +// CHECK:STDOUT: %G.call: init () = call %.loc26(%n.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -189,8 +193,8 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc8 [template = constants.%.4] -// CHECK:STDOUT: %.loc26: ref i32 = deref %p.ref +// CHECK:STDOUT: %F.ref: = name_ref F, @Simple.%.loc12 [template = constants.%.4] +// CHECK:STDOUT: %.loc30: ref i32 = deref %p.ref // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.4] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return @@ -200,12 +204,12 @@ fn InstanceCallIndirect(p: i32*) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: i32* = name_ref p, %p // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc9_21 [template = constants.%.6] -// CHECK:STDOUT: %.loc30_4.1: ref i32 = deref %p.ref +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc13_21 [template = constants.%.6] +// CHECK:STDOUT: %.loc34_4.1: ref i32 = deref %p.ref // CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element1 [template = constants.%struct.5] -// CHECK:STDOUT: %.loc30_4.2: = bound_method %.loc30_4.1, %.1 -// CHECK:STDOUT: %.loc30_4.3: i32 = bind_value %.loc30_4.1 -// CHECK:STDOUT: %G.call: init () = call %.loc30_4.2(%.loc30_4.3) +// CHECK:STDOUT: %.loc34_4.2: = bound_method %.loc34_4.1, %.1 +// CHECK:STDOUT: %.loc34_4.3: i32 = bind_value %.loc34_4.1 +// CHECK:STDOUT: %G.call: init () = call %.loc34_4.2(%.loc34_4.3) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/declaration.carbon b/toolchain/check/testdata/impl/declaration.carbon index 31a12f9331b2..f82006654eb5 100644 --- a/toolchain/check/testdata/impl/declaration.carbon +++ b/toolchain/check/testdata/impl/declaration.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/declaration.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/declaration.carbon interface I {} @@ -28,8 +32,8 @@ impl i32 as I; // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32, %.loc9_6.1 [template = i32] +// CHECK:STDOUT: %.loc13_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_6.2: type = converted %int.make_type_32, %.loc13_6.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/empty.carbon b/toolchain/check/testdata/impl/empty.carbon index 40b722ec8c79..61c56ce533a1 100644 --- a/toolchain/check/testdata/impl/empty.carbon +++ b/toolchain/check/testdata/impl/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/empty.carbon interface Empty { } @@ -31,8 +35,8 @@ impl i32 as Empty { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_6.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_6.2: type = converted %int.make_type_32, %.loc10_6.1 [template = i32] +// CHECK:STDOUT: %.loc14_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_6.2: type = converted %int.make_type_32, %.loc14_6.1 [template = i32] // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/extend_impl.carbon b/toolchain/check/testdata/impl/extend_impl.carbon index 4caa8cc2eab7..e1b5bd60b9c6 100644 --- a/toolchain/check/testdata/impl/extend_impl.carbon +++ b/toolchain/check/testdata/impl/extend_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/extend_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/extend_impl.carbon interface HasF { fn F(); @@ -51,19 +55,19 @@ fn G(c: C) { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %c.loc17_6.1: C = param c -// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc17_6.1 +// CHECK:STDOUT: %c.loc21_6.1: C = param c +// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc21_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -96,13 +100,13 @@ fn G(c: C) { // CHECK:STDOUT: fn @G(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref.loc18: = name_ref F, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref.loc22: = name_ref F, @HasF.%.loc12 [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] -// CHECK:STDOUT: %F.call.loc18: init () = call %.1() +// CHECK:STDOUT: %F.call.loc22: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %F.ref.loc19: = name_ref F, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref.loc23: = name_ref F, @HasF.%.loc12 [template = constants.%.4] // CHECK:STDOUT: %.2: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] -// CHECK:STDOUT: %F.call.loc19: init () = call %.2() +// CHECK:STDOUT: %F.call.loc23: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_call_invalid.carbon b/toolchain/check/testdata/impl/fail_call_invalid.carbon index 5cc2cd833612..0bd9265edbbd 100644 --- a/toolchain/check/testdata/impl/fail_call_invalid.carbon +++ b/toolchain/check/testdata/impl/fail_call_invalid.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_call_invalid.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_call_invalid.carbon interface Simple { fn G[self: Self](); @@ -47,18 +51,18 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_6.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_6.2: type = converted %int.make_type_32.loc11, %.loc11_6.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32.loc15, %.loc15_6.1 [template = i32] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %InstanceCall.decl: InstanceCall = fn_decl @InstanceCall [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc18_20.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_20.2: type = converted %int.make_type_32.loc18, %.loc18_20.1 [template = i32] -// CHECK:STDOUT: %n.loc18_17.1: i32 = param n -// CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc18_17.1 +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc22_20.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_20.2: type = converted %int.make_type_32.loc22, %.loc22_20.1 [template = i32] +// CHECK:STDOUT: %n.loc22_17.1: i32 = param n +// CHECK:STDOUT: @InstanceCall.%n: i32 = bind_name n, %n.loc22_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -66,24 +70,24 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %G.decl: G = fn_decl @G.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: Simple = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref, %.loc8_14.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %self.loc8_8.1: Self = param self -// CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1 +// CHECK:STDOUT: %.loc12_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref, %.loc12_14.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %self.loc12_8.1: Self = param self +// CHECK:STDOUT: %self.loc12_8.2: Self = bind_name self, %self.loc12_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_21: = assoc_entity element0, %G.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12_21: = assoc_entity element0, %G.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .G = %.loc8_21 +// CHECK:STDOUT: .G = %.loc12_21 // CHECK:STDOUT: witness = (%G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: i32 as Simple { // CHECK:STDOUT: %G.decl: G = fn_decl @G.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Undeclared.ref: = name_ref Undeclared, [template = ] -// CHECK:STDOUT: %self.loc15_8.1: = param self -// CHECK:STDOUT: %self.loc15_8.2: = bind_name self, %self.loc15_8.1 +// CHECK:STDOUT: %self.loc19_8.1: = param self +// CHECK:STDOUT: %self.loc19_8.2: = bind_name self, %self.loc19_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: @@ -92,19 +96,19 @@ fn InstanceCall(n: i32) { // CHECK:STDOUT: witness = %.1 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.1[@Simple.%self.loc8_8.2: Self](); +// CHECK:STDOUT: fn @G.1[@Simple.%self.loc12_8.2: Self](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G.2[@impl.%self.loc15_8.2: ](); +// CHECK:STDOUT: fn @G.2[@impl.%self.loc19_8.2: ](); // CHECK:STDOUT: // CHECK:STDOUT: fn @InstanceCall(%n: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %n.ref: i32 = name_ref n, %n // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1] -// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc8_21 [template = constants.%.4] +// CHECK:STDOUT: %G.ref: = name_ref G, @Simple.%.loc12_21 [template = constants.%.4] // CHECK:STDOUT: %.1: G = interface_witness_access @impl.%.1, element0 [template = ] -// CHECK:STDOUT: %.loc19: = bound_method %n.ref, %.1 +// CHECK:STDOUT: %.loc23: = bound_method %n.ref, %.1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon index 72c6ae1047c4..900c18216692 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_forall.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_impl_forall.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_impl_forall.carbon // CHECK:STDERR: fail_extend_impl_forall.carbon:[[@LINE+4]]:1: ERROR: Semantics TODO: `generic interface`. // CHECK:STDERR: interface GenericInterface(T:! type) { @@ -54,8 +58,8 @@ class C { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %GenericInterface.decl: type = interface_decl @GenericInterface [template = constants.%.1] { -// CHECK:STDOUT: %T.loc11_28.1: type = param T -// CHECK:STDOUT: %T.loc11_28.2: type = bind_symbolic_name T 0, %T.loc11_28.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc15_28.1: type = param T +// CHECK:STDOUT: %T.loc15_28.2: type = bind_symbolic_name T 0, %T.loc15_28.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: } @@ -63,23 +67,23 @@ class C { // CHECK:STDOUT: interface @GenericInterface { // CHECK:STDOUT: %Self: GenericInterface = bind_symbolic_name Self 1 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc11_28.2 [symbolic = constants.%T] -// CHECK:STDOUT: %x.loc12_8.1: T = param x -// CHECK:STDOUT: %x.loc12_8.2: T = bind_name x, %x.loc12_8.1 +// CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc15_28.2 [symbolic = constants.%T] +// CHECK:STDOUT: %x.loc16_8.1: T = param x +// CHECK:STDOUT: %x.loc16_8.2: T = bind_name x, %x.loc16_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc16: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc12 +// CHECK:STDOUT: .F = %.loc16 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { -// CHECK:STDOUT: %T.ref: type = name_ref T, @C.%T.loc27_23.2 [symbolic = constants.%T] -// CHECK:STDOUT: %x.loc28_10.1: T = param x -// CHECK:STDOUT: %x.loc28_10.2: T = bind_name x, %x.loc28_10.1 +// CHECK:STDOUT: %T.ref: type = name_ref T, @C.%T.loc31_23.2 [symbolic = constants.%T] +// CHECK:STDOUT: %x.loc32_10.1: T = param x +// CHECK:STDOUT: %x.loc32_10.2: T = bind_name x, %x.loc32_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -89,10 +93,10 @@ class C { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %T.loc27_23.1: type = param T -// CHECK:STDOUT: %T.loc27_23.2: type = bind_symbolic_name T 0, %T.loc27_23.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc31_23.1: type = param T +// CHECK:STDOUT: %T.loc31_23.2: type = bind_symbolic_name T 0, %T.loc31_23.1 [symbolic = constants.%T] // CHECK:STDOUT: %GenericInterface.ref: type = name_ref GenericInterface, file.%GenericInterface.decl [template = constants.%.1] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc27_23.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc31_23.2 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: !members: @@ -100,9 +104,9 @@ class C { // CHECK:STDOUT: has_error // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1(@GenericInterface.%x.loc12_8.2: T); +// CHECK:STDOUT: fn @F.1(@GenericInterface.%x.loc16_8.2: T); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2(@impl.%x.loc28_10.2: T) { +// CHECK:STDOUT: fn @F.2(@impl.%x.loc32_10.2: T) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon index 078321d24ac6..5ada8e738ffc 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_impl_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_impl_scope.carbon interface I {} @@ -32,8 +36,8 @@ extend impl i32 as I {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32, %.loc16_13.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon index 3b8d4ee89470..faf499e3fbc5 100644 --- a/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +++ b/toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_impl_type_as.carbon interface I {} @@ -93,8 +97,8 @@ class E { // CHECK:STDOUT: class @C { // CHECK:STDOUT: impl_decl @impl.1 { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32, %.loc14_15.1 [template = i32] +// CHECK:STDOUT: %.loc18_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_15.2: type = converted %int.make_type_32, %.loc18_15.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon index f35a43c7148a..5a6d3d44f79e 100644 --- a/toolchain/check/testdata/impl/fail_extend_non_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_non_interface.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_non_interface.carbon class C { // CHECK:STDERR: fail_extend_non_interface.carbon:[[@LINE+3]]:3: ERROR: Semantics TODO: `extending non-interface constraint`. @@ -34,8 +38,8 @@ class C { // CHECK:STDOUT: impl @impl: C as i32; // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32, %.loc11_18.1 [template = i32] +// CHECK:STDOUT: %.loc15_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_18.2: type = converted %int.make_type_32, %.loc15_18.1 [template = i32] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon index cce85f4916fb..27308c9480b3 100644 --- a/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_partially_defined_interface.carbon interface I { class C { diff --git a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon index 59558b9afce4..4bc05e5dc0df 100644 --- a/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +++ b/toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_extend_undefined_interface.carbon interface I; diff --git a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon index 4112a944967e..3f8a2a6e0831 100644 --- a/toolchain/check/testdata/impl/fail_impl_as_scope.carbon +++ b/toolchain/check/testdata/impl/fail_impl_as_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_as_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_as_scope.carbon interface Simple { fn F(); @@ -45,11 +49,11 @@ impl as Simple { // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon index 7bd5cdc8b04b..0425c0f9eaaf 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_const.carbon interface I { let T:! type; } @@ -33,8 +37,8 @@ impl bool as I {} // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] -// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_6.2: type = converted %bool.make_type, %.loc12_6.1 [template = bool] +// CHECK:STDOUT: %.loc16_6.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_6.2: type = converted %bool.make_type, %.loc16_6.1 [template = bool] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -42,11 +46,11 @@ impl bool as I {} // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc7: = assoc_entity element0, %T [template = constants.%.3] +// CHECK:STDOUT: %.loc11: = assoc_entity element0, %T [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc7 +// CHECK:STDOUT: .T = %.loc11 // CHECK:STDOUT: witness = (%T) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon index 036a8f1718ae..ccd474441f99 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_assoc_fn.carbon interface I { fn F(); } @@ -368,70 +372,70 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc7: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc11: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc7 +// CHECK:STDOUT: .F = %.loc11 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @J { // CHECK:STDOUT: %Self: J = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.7] { -// CHECK:STDOUT: %bool.make_type.loc89_26: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc89_26.1: type = value_of_initializer %bool.make_type.loc89_26 [template = bool] -// CHECK:STDOUT: %.loc89_26.2: type = converted %bool.make_type.loc89_26, %.loc89_26.1 [template = bool] -// CHECK:STDOUT: %self.loc89_20.1: bool = param self -// CHECK:STDOUT: %self.loc89_20.2: bool = bind_name self, %self.loc89_20.1 -// CHECK:STDOUT: %bool.make_type.loc89_35: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc89_35.1: type = value_of_initializer %bool.make_type.loc89_35 [template = bool] -// CHECK:STDOUT: %.loc89_35.2: type = converted %bool.make_type.loc89_35, %.loc89_35.1 [template = bool] -// CHECK:STDOUT: %b.loc89_32.1: bool = param b -// CHECK:STDOUT: %b.loc89_32.2: bool = bind_name b, %b.loc89_32.1 -// CHECK:STDOUT: %bool.make_type.loc89_44: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc89_44.1: type = value_of_initializer %bool.make_type.loc89_44 [template = bool] -// CHECK:STDOUT: %.loc89_44.2: type = converted %bool.make_type.loc89_44, %.loc89_44.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc93_26: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc93_26.1: type = value_of_initializer %bool.make_type.loc93_26 [template = bool] +// CHECK:STDOUT: %.loc93_26.2: type = converted %bool.make_type.loc93_26, %.loc93_26.1 [template = bool] +// CHECK:STDOUT: %self.loc93_20.1: bool = param self +// CHECK:STDOUT: %self.loc93_20.2: bool = bind_name self, %self.loc93_20.1 +// CHECK:STDOUT: %bool.make_type.loc93_35: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc93_35.1: type = value_of_initializer %bool.make_type.loc93_35 [template = bool] +// CHECK:STDOUT: %.loc93_35.2: type = converted %bool.make_type.loc93_35, %.loc93_35.1 [template = bool] +// CHECK:STDOUT: %b.loc93_32.1: bool = param b +// CHECK:STDOUT: %b.loc93_32.2: bool = bind_name b, %b.loc93_32.1 +// CHECK:STDOUT: %bool.make_type.loc93_44: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc93_44.1: type = value_of_initializer %bool.make_type.loc93_44 [template = bool] +// CHECK:STDOUT: %.loc93_44.2: type = converted %bool.make_type.loc93_44, %.loc93_44.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc89_48: = assoc_entity element0, %F.decl [template = constants.%.8] +// CHECK:STDOUT: %.loc93_48: = assoc_entity element0, %F.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc89_48 +// CHECK:STDOUT: .F = %.loc93_48 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SelfNested { // CHECK:STDOUT: %Self: SelfNested = bind_symbolic_name Self 0 [symbolic = constants.%Self.3] // CHECK:STDOUT: %F.decl: F = fn_decl @F.13 [template = constants.%struct.16] { -// CHECK:STDOUT: %Self.ref.loc184_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_16.1: type = facet_type_access %Self.ref.loc184_12 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_16.2: type = converted %Self.ref.loc184_12, %.loc184_16.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_16.3: type = ptr_type Self [symbolic = constants.%.10] -// CHECK:STDOUT: %Self.ref.loc184_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_24.1: type = facet_type_access %Self.ref.loc184_24 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_24.2: type = converted %Self.ref.loc184_24, %.loc184_24.1 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %Self.ref.loc188_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_16.1: type = facet_type_access %Self.ref.loc188_12 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_16.2: type = converted %Self.ref.loc188_12, %.loc188_16.1 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_16.3: type = ptr_type Self [symbolic = constants.%.10] +// CHECK:STDOUT: %Self.ref.loc188_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_24.1: type = facet_type_access %Self.ref.loc188_24 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_24.2: type = converted %Self.ref.loc188_24, %.loc188_24.1 [symbolic = constants.%Self.3] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.15() [template = i32] -// CHECK:STDOUT: %.loc184_34.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc184_34.2: type = converted %int.make_type_32, %.loc184_34.1 [template = i32] -// CHECK:STDOUT: %.loc184_37: type = struct_type {.x: Self, .y: i32} [symbolic = constants.%.11] -// CHECK:STDOUT: %.loc184_38.1: (type, type) = tuple_literal (%.loc184_16.3, %.loc184_37) -// CHECK:STDOUT: %.loc184_38.2: type = converted %.loc184_38.1, constants.%.13 [symbolic = constants.%.13] -// CHECK:STDOUT: %x.loc184_8.1: (Self*, {.x: Self, .y: i32}) = param x -// CHECK:STDOUT: %x.loc184_8.2: (Self*, {.x: Self, .y: i32}) = bind_name x, %x.loc184_8.1 -// CHECK:STDOUT: %Self.ref.loc184_45: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_51: i32 = int_literal 4 [template = constants.%.14] -// CHECK:STDOUT: %.loc184_45.1: type = facet_type_access %Self.ref.loc184_45 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_45.2: type = converted %Self.ref.loc184_45, %.loc184_45.1 [symbolic = constants.%Self.3] -// CHECK:STDOUT: %.loc184_52: type = array_type %.loc184_51, Self [symbolic = constants.%.15] +// CHECK:STDOUT: %.loc188_34.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc188_34.2: type = converted %int.make_type_32, %.loc188_34.1 [template = i32] +// CHECK:STDOUT: %.loc188_37: type = struct_type {.x: Self, .y: i32} [symbolic = constants.%.11] +// CHECK:STDOUT: %.loc188_38.1: (type, type) = tuple_literal (%.loc188_16.3, %.loc188_37) +// CHECK:STDOUT: %.loc188_38.2: type = converted %.loc188_38.1, constants.%.13 [symbolic = constants.%.13] +// CHECK:STDOUT: %x.loc188_8.1: (Self*, {.x: Self, .y: i32}) = param x +// CHECK:STDOUT: %x.loc188_8.2: (Self*, {.x: Self, .y: i32}) = bind_name x, %x.loc188_8.1 +// CHECK:STDOUT: %Self.ref.loc188_45: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_51: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc188_45.1: type = facet_type_access %Self.ref.loc188_45 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_45.2: type = converted %Self.ref.loc188_45, %.loc188_45.1 [symbolic = constants.%Self.3] +// CHECK:STDOUT: %.loc188_52: type = array_type %.loc188_51, Self [symbolic = constants.%.15] // CHECK:STDOUT: %return.var: ref [Self; 4] = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc184_53: = assoc_entity element0, %F.decl [template = constants.%.17] +// CHECK:STDOUT: %.loc188_53: = assoc_entity element0, %F.decl [template = constants.%.17] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc184_53 +// CHECK:STDOUT: .F = %.loc188_53 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -464,10 +468,10 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.4: FExtraParam as I { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.4] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc58_13.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc58_13.2: type = converted %bool.make_type, %.loc58_13.1 [template = bool] -// CHECK:STDOUT: %b.loc58_10.1: bool = param b -// CHECK:STDOUT: %b.loc58_10.2: bool = bind_name b, %b.loc58_10.1 +// CHECK:STDOUT: %.loc62_13.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc62_13.2: type = converted %bool.make_type, %.loc62_13.1 [template = bool] +// CHECK:STDOUT: %b.loc62_10.1: bool = param b +// CHECK:STDOUT: %b.loc62_10.2: bool = bind_name b, %b.loc62_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: @@ -479,8 +483,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.5: FExtraImplicitParam as I { // CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.5] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FExtraImplicitParam [template = constants.%FExtraImplicitParam] -// CHECK:STDOUT: %self.loc71_10.1: FExtraImplicitParam = param self -// CHECK:STDOUT: %self.loc71_10.2: FExtraImplicitParam = bind_name self, %self.loc71_10.1 +// CHECK:STDOUT: %self.loc75_10.1: FExtraImplicitParam = param self +// CHECK:STDOUT: %self.loc75_10.2: FExtraImplicitParam = bind_name self, %self.loc75_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: @@ -492,8 +496,8 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.6: FExtraReturnType as I { // CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.6] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc85_15.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc85_15.2: type = converted %bool.make_type, %.loc85_15.1 [template = bool] +// CHECK:STDOUT: %.loc89_15.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc89_15.2: type = converted %bool.make_type, %.loc89_15.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -505,14 +509,14 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.7: FMissingParam as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.8] { -// CHECK:STDOUT: %bool.make_type.loc100_16: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc100_16.1: type = value_of_initializer %bool.make_type.loc100_16 [template = bool] -// CHECK:STDOUT: %.loc100_16.2: type = converted %bool.make_type.loc100_16, %.loc100_16.1 [template = bool] -// CHECK:STDOUT: %self.loc100_10.1: bool = param self -// CHECK:STDOUT: %self.loc100_10.2: bool = bind_name self, %self.loc100_10.1 -// CHECK:STDOUT: %bool.make_type.loc100_27: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc100_27.1: type = value_of_initializer %bool.make_type.loc100_27 [template = bool] -// CHECK:STDOUT: %.loc100_27.2: type = converted %bool.make_type.loc100_27, %.loc100_27.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc104_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc104_16.1: type = value_of_initializer %bool.make_type.loc104_16 [template = bool] +// CHECK:STDOUT: %.loc104_16.2: type = converted %bool.make_type.loc104_16, %.loc104_16.1 [template = bool] +// CHECK:STDOUT: %self.loc104_10.1: bool = param self +// CHECK:STDOUT: %self.loc104_10.2: bool = bind_name self, %self.loc104_10.1 +// CHECK:STDOUT: %bool.make_type.loc104_27: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc104_27.1: type = value_of_initializer %bool.make_type.loc104_27 [template = bool] +// CHECK:STDOUT: %.loc104_27.2: type = converted %bool.make_type.loc104_27, %.loc104_27.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -524,14 +528,14 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.8: FMissingImplicitParam as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.7 [template = constants.%struct.9] { -// CHECK:STDOUT: %bool.make_type.loc113_13: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc113_13.1: type = value_of_initializer %bool.make_type.loc113_13 [template = bool] -// CHECK:STDOUT: %.loc113_13.2: type = converted %bool.make_type.loc113_13, %.loc113_13.1 [template = bool] -// CHECK:STDOUT: %b.loc113_10.1: bool = param b -// CHECK:STDOUT: %b.loc113_10.2: bool = bind_name b, %b.loc113_10.1 -// CHECK:STDOUT: %bool.make_type.loc113_22: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc113_22.1: type = value_of_initializer %bool.make_type.loc113_22 [template = bool] -// CHECK:STDOUT: %.loc113_22.2: type = converted %bool.make_type.loc113_22, %.loc113_22.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc117_13: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc117_13.1: type = value_of_initializer %bool.make_type.loc117_13 [template = bool] +// CHECK:STDOUT: %.loc117_13.2: type = converted %bool.make_type.loc117_13, %.loc117_13.1 [template = bool] +// CHECK:STDOUT: %b.loc117_10.1: bool = param b +// CHECK:STDOUT: %b.loc117_10.2: bool = bind_name b, %b.loc117_10.1 +// CHECK:STDOUT: %bool.make_type.loc117_22: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc117_22.1: type = value_of_initializer %bool.make_type.loc117_22 [template = bool] +// CHECK:STDOUT: %.loc117_22.2: type = converted %bool.make_type.loc117_22, %.loc117_22.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -543,16 +547,16 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.9: FMissingReturnType as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.8 [template = constants.%struct.10] { -// CHECK:STDOUT: %bool.make_type.loc126_16: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc126_16.1: type = value_of_initializer %bool.make_type.loc126_16 [template = bool] -// CHECK:STDOUT: %.loc126_16.2: type = converted %bool.make_type.loc126_16, %.loc126_16.1 [template = bool] -// CHECK:STDOUT: %self.loc126_10.1: bool = param self -// CHECK:STDOUT: %self.loc126_10.2: bool = bind_name self, %self.loc126_10.1 -// CHECK:STDOUT: %bool.make_type.loc126_25: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc126_25.1: type = value_of_initializer %bool.make_type.loc126_25 [template = bool] -// CHECK:STDOUT: %.loc126_25.2: type = converted %bool.make_type.loc126_25, %.loc126_25.1 [template = bool] -// CHECK:STDOUT: %b.loc126_22.1: bool = param b -// CHECK:STDOUT: %b.loc126_22.2: bool = bind_name b, %b.loc126_22.1 +// CHECK:STDOUT: %bool.make_type.loc130_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc130_16.1: type = value_of_initializer %bool.make_type.loc130_16 [template = bool] +// CHECK:STDOUT: %.loc130_16.2: type = converted %bool.make_type.loc130_16, %.loc130_16.1 [template = bool] +// CHECK:STDOUT: %self.loc130_10.1: bool = param self +// CHECK:STDOUT: %self.loc130_10.2: bool = bind_name self, %self.loc130_10.1 +// CHECK:STDOUT: %bool.make_type.loc130_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc130_25.1: type = value_of_initializer %bool.make_type.loc130_25 [template = bool] +// CHECK:STDOUT: %.loc130_25.2: type = converted %bool.make_type.loc130_25, %.loc130_25.1 [template = bool] +// CHECK:STDOUT: %b.loc130_22.1: bool = param b +// CHECK:STDOUT: %b.loc130_22.2: bool = bind_name b, %b.loc130_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] // CHECK:STDOUT: @@ -563,17 +567,17 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.10: FDifferentParamType as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.9 [template = constants.%struct.11] { -// CHECK:STDOUT: %bool.make_type.loc139_16: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc139_16.1: type = value_of_initializer %bool.make_type.loc139_16 [template = bool] -// CHECK:STDOUT: %.loc139_16.2: type = converted %bool.make_type.loc139_16, %.loc139_16.1 [template = bool] -// CHECK:STDOUT: %self.loc139_10.1: bool = param self -// CHECK:STDOUT: %self.loc139_10.2: bool = bind_name self, %self.loc139_10.1 +// CHECK:STDOUT: %bool.make_type.loc143_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc143_16.1: type = value_of_initializer %bool.make_type.loc143_16 [template = bool] +// CHECK:STDOUT: %.loc143_16.2: type = converted %bool.make_type.loc143_16, %.loc143_16.1 [template = bool] +// CHECK:STDOUT: %self.loc143_10.1: bool = param self +// CHECK:STDOUT: %self.loc143_10.2: bool = bind_name self, %self.loc143_10.1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentParamType [template = constants.%FDifferentParamType] -// CHECK:STDOUT: %b.loc139_22.1: FDifferentParamType = param b -// CHECK:STDOUT: %b.loc139_22.2: FDifferentParamType = bind_name b, %b.loc139_22.1 -// CHECK:STDOUT: %bool.make_type.loc139_34: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc139_34.1: type = value_of_initializer %bool.make_type.loc139_34 [template = bool] -// CHECK:STDOUT: %.loc139_34.2: type = converted %bool.make_type.loc139_34, %.loc139_34.1 [template = bool] +// CHECK:STDOUT: %b.loc143_22.1: FDifferentParamType = param b +// CHECK:STDOUT: %b.loc143_22.2: FDifferentParamType = bind_name b, %b.loc143_22.1 +// CHECK:STDOUT: %bool.make_type.loc143_34: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc143_34.1: type = value_of_initializer %bool.make_type.loc143_34 [template = bool] +// CHECK:STDOUT: %.loc143_34.2: type = converted %bool.make_type.loc143_34, %.loc143_34.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -586,16 +590,16 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: impl @impl.11: FDifferentImplicitParamType as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.10 [template = constants.%struct.12] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentImplicitParamType [template = constants.%FDifferentImplicitParamType] -// CHECK:STDOUT: %self.loc152_10.1: FDifferentImplicitParamType = param self -// CHECK:STDOUT: %self.loc152_10.2: FDifferentImplicitParamType = bind_name self, %self.loc152_10.1 -// CHECK:STDOUT: %bool.make_type.loc152_25: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc152_25.1: type = value_of_initializer %bool.make_type.loc152_25 [template = bool] -// CHECK:STDOUT: %.loc152_25.2: type = converted %bool.make_type.loc152_25, %.loc152_25.1 [template = bool] -// CHECK:STDOUT: %b.loc152_22.1: bool = param b -// CHECK:STDOUT: %b.loc152_22.2: bool = bind_name b, %b.loc152_22.1 -// CHECK:STDOUT: %bool.make_type.loc152_34: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc152_34.1: type = value_of_initializer %bool.make_type.loc152_34 [template = bool] -// CHECK:STDOUT: %.loc152_34.2: type = converted %bool.make_type.loc152_34, %.loc152_34.1 [template = bool] +// CHECK:STDOUT: %self.loc156_10.1: FDifferentImplicitParamType = param self +// CHECK:STDOUT: %self.loc156_10.2: FDifferentImplicitParamType = bind_name self, %self.loc156_10.1 +// CHECK:STDOUT: %bool.make_type.loc156_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc156_25.1: type = value_of_initializer %bool.make_type.loc156_25 [template = bool] +// CHECK:STDOUT: %.loc156_25.2: type = converted %bool.make_type.loc156_25, %.loc156_25.1 [template = bool] +// CHECK:STDOUT: %b.loc156_22.1: bool = param b +// CHECK:STDOUT: %b.loc156_22.2: bool = bind_name b, %b.loc156_22.1 +// CHECK:STDOUT: %bool.make_type.loc156_34: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc156_34.1: type = value_of_initializer %bool.make_type.loc156_34 [template = bool] +// CHECK:STDOUT: %.loc156_34.2: type = converted %bool.make_type.loc156_34, %.loc156_34.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -607,16 +611,16 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.12: FDifferentReturnType as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.11 [template = constants.%struct.13] { -// CHECK:STDOUT: %bool.make_type.loc165_16: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc165_16.1: type = value_of_initializer %bool.make_type.loc165_16 [template = bool] -// CHECK:STDOUT: %.loc165_16.2: type = converted %bool.make_type.loc165_16, %.loc165_16.1 [template = bool] -// CHECK:STDOUT: %self.loc165_10.1: bool = param self -// CHECK:STDOUT: %self.loc165_10.2: bool = bind_name self, %self.loc165_10.1 -// CHECK:STDOUT: %bool.make_type.loc165_25: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc165_25.1: type = value_of_initializer %bool.make_type.loc165_25 [template = bool] -// CHECK:STDOUT: %.loc165_25.2: type = converted %bool.make_type.loc165_25, %.loc165_25.1 [template = bool] -// CHECK:STDOUT: %b.loc165_22.1: bool = param b -// CHECK:STDOUT: %b.loc165_22.2: bool = bind_name b, %b.loc165_22.1 +// CHECK:STDOUT: %bool.make_type.loc169_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc169_16.1: type = value_of_initializer %bool.make_type.loc169_16 [template = bool] +// CHECK:STDOUT: %.loc169_16.2: type = converted %bool.make_type.loc169_16, %.loc169_16.1 [template = bool] +// CHECK:STDOUT: %self.loc169_10.1: bool = param self +// CHECK:STDOUT: %self.loc169_10.2: bool = bind_name self, %self.loc169_10.1 +// CHECK:STDOUT: %bool.make_type.loc169_25: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc169_25.1: type = value_of_initializer %bool.make_type.loc169_25 [template = bool] +// CHECK:STDOUT: %.loc169_25.2: type = converted %bool.make_type.loc169_25, %.loc169_25.1 [template = bool] +// CHECK:STDOUT: %b.loc169_22.1: bool = param b +// CHECK:STDOUT: %b.loc169_22.2: bool = bind_name b, %b.loc169_22.1 // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%FDifferentReturnType [template = constants.%FDifferentReturnType] // CHECK:STDOUT: %return.var: ref FDifferentReturnType = var // CHECK:STDOUT: } @@ -629,19 +633,19 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.13: FDifferentParamName as J { // CHECK:STDOUT: %F.decl: F = fn_decl @F.12 [template = constants.%struct.14] { -// CHECK:STDOUT: %bool.make_type.loc179_16: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc179_16.1: type = value_of_initializer %bool.make_type.loc179_16 [template = bool] -// CHECK:STDOUT: %.loc179_16.2: type = converted %bool.make_type.loc179_16, %.loc179_16.1 [template = bool] -// CHECK:STDOUT: %self.loc179_10.1: bool = param self -// CHECK:STDOUT: %self.loc179_10.2: bool = bind_name self, %self.loc179_10.1 -// CHECK:STDOUT: %bool.make_type.loc179_29: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc179_29.1: type = value_of_initializer %bool.make_type.loc179_29 [template = bool] -// CHECK:STDOUT: %.loc179_29.2: type = converted %bool.make_type.loc179_29, %.loc179_29.1 [template = bool] -// CHECK:STDOUT: %not_b.loc179_22.1: bool = param not_b -// CHECK:STDOUT: %not_b.loc179_22.2: bool = bind_name not_b, %not_b.loc179_22.1 -// CHECK:STDOUT: %bool.make_type.loc179_38: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc179_38.1: type = value_of_initializer %bool.make_type.loc179_38 [template = bool] -// CHECK:STDOUT: %.loc179_38.2: type = converted %bool.make_type.loc179_38, %.loc179_38.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc183_16: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc183_16.1: type = value_of_initializer %bool.make_type.loc183_16 [template = bool] +// CHECK:STDOUT: %.loc183_16.2: type = converted %bool.make_type.loc183_16, %.loc183_16.1 [template = bool] +// CHECK:STDOUT: %self.loc183_10.1: bool = param self +// CHECK:STDOUT: %self.loc183_10.2: bool = bind_name self, %self.loc183_10.1 +// CHECK:STDOUT: %bool.make_type.loc183_29: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc183_29.1: type = value_of_initializer %bool.make_type.loc183_29 [template = bool] +// CHECK:STDOUT: %.loc183_29.2: type = converted %bool.make_type.loc183_29, %.loc183_29.1 [template = bool] +// CHECK:STDOUT: %not_b.loc183_22.1: bool = param not_b +// CHECK:STDOUT: %not_b.loc183_22.2: bool = bind_name not_b, %not_b.loc183_22.1 +// CHECK:STDOUT: %bool.make_type.loc183_38: init type = call constants.%struct.3() [template = bool] +// CHECK:STDOUT: %.loc183_38.1: type = value_of_initializer %bool.make_type.loc183_38 [template = bool] +// CHECK:STDOUT: %.loc183_38.2: type = converted %bool.make_type.loc183_38, %.loc183_38.1 [template = bool] // CHECK:STDOUT: %return.var: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -653,22 +657,22 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.14: SelfNestedBadParam as SelfNested { // CHECK:STDOUT: %F.decl: F = fn_decl @F.14 [template = constants.%struct.17] { -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc196_32: type = ptr_type SelfNestedBadParam [template = constants.%.18] -// CHECK:STDOUT: %int.make_type_32.loc196_40: init type = call constants.%struct.15() [template = i32] -// CHECK:STDOUT: %.loc196_40.1: type = value_of_initializer %int.make_type_32.loc196_40 [template = i32] -// CHECK:STDOUT: %.loc196_40.2: type = converted %int.make_type_32.loc196_40, %.loc196_40.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc196_49: init type = call constants.%struct.15() [template = i32] -// CHECK:STDOUT: %.loc196_49.1: type = value_of_initializer %int.make_type_32.loc196_49 [template = i32] -// CHECK:STDOUT: %.loc196_49.2: type = converted %int.make_type_32.loc196_49, %.loc196_49.1 [template = i32] -// CHECK:STDOUT: %.loc196_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19] -// CHECK:STDOUT: %.loc196_53.1: (type, type) = tuple_literal (%.loc196_32, %.loc196_52) -// CHECK:STDOUT: %.loc196_53.2: type = converted %.loc196_53.1, constants.%.20 [template = constants.%.20] -// CHECK:STDOUT: %x.loc196_10.1: (SelfNestedBadParam*, {.x: i32, .y: i32}) = param x -// CHECK:STDOUT: %x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32}) = bind_name x, %x.loc196_10.1 -// CHECK:STDOUT: %SelfNestedBadParam.ref.loc196_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc196_80: i32 = int_literal 4 [template = constants.%.14] -// CHECK:STDOUT: %.loc196_81: type = array_type %.loc196_80, SelfNestedBadParam [template = constants.%.21] +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_14: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %.loc200_32: type = ptr_type SelfNestedBadParam [template = constants.%.18] +// CHECK:STDOUT: %int.make_type_32.loc200_40: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc200_40.1: type = value_of_initializer %int.make_type_32.loc200_40 [template = i32] +// CHECK:STDOUT: %.loc200_40.2: type = converted %int.make_type_32.loc200_40, %.loc200_40.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc200_49: init type = call constants.%struct.15() [template = i32] +// CHECK:STDOUT: %.loc200_49.1: type = value_of_initializer %int.make_type_32.loc200_49 [template = i32] +// CHECK:STDOUT: %.loc200_49.2: type = converted %int.make_type_32.loc200_49, %.loc200_49.1 [template = i32] +// CHECK:STDOUT: %.loc200_52: type = struct_type {.x: i32, .y: i32} [template = constants.%.19] +// CHECK:STDOUT: %.loc200_53.1: (type, type) = tuple_literal (%.loc200_32, %.loc200_52) +// CHECK:STDOUT: %.loc200_53.2: type = converted %.loc200_53.1, constants.%.20 [template = constants.%.20] +// CHECK:STDOUT: %x.loc200_10.1: (SelfNestedBadParam*, {.x: i32, .y: i32}) = param x +// CHECK:STDOUT: %x.loc200_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32}) = bind_name x, %x.loc200_10.1 +// CHECK:STDOUT: %SelfNestedBadParam.ref.loc200_60: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] +// CHECK:STDOUT: %.loc200_80: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc200_81: type = array_type %.loc200_80, SelfNestedBadParam [template = constants.%.21] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -680,20 +684,20 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.15: SelfNestedBadReturnType as SelfNested { // CHECK:STDOUT: %F.decl: F = fn_decl @F.15 [template = constants.%struct.18] { -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] -// CHECK:STDOUT: %.loc208_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.24] -// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc208_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_14: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] +// CHECK:STDOUT: %.loc212_37: type = ptr_type SelfNestedBadReturnType [template = constants.%.24] +// CHECK:STDOUT: %SelfNestedBadReturnType.ref.loc212_45: type = name_ref SelfNestedBadReturnType, file.%SelfNestedBadReturnType.decl [template = constants.%SelfNestedBadReturnType] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.15() [template = i32] -// CHECK:STDOUT: %.loc208_74.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc208_74.2: type = converted %int.make_type_32, %.loc208_74.1 [template = i32] -// CHECK:STDOUT: %.loc208_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.25] -// CHECK:STDOUT: %.loc208_78.1: (type, type) = tuple_literal (%.loc208_37, %.loc208_77) -// CHECK:STDOUT: %.loc208_78.2: type = converted %.loc208_78.1, constants.%.26 [template = constants.%.26] -// CHECK:STDOUT: %x.loc208_10.1: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = param x -// CHECK:STDOUT: %x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = bind_name x, %x.loc208_10.1 +// CHECK:STDOUT: %.loc212_74.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc212_74.2: type = converted %int.make_type_32, %.loc212_74.1 [template = i32] +// CHECK:STDOUT: %.loc212_77: type = struct_type {.x: SelfNestedBadReturnType, .y: i32} [template = constants.%.25] +// CHECK:STDOUT: %.loc212_78.1: (type, type) = tuple_literal (%.loc212_37, %.loc212_77) +// CHECK:STDOUT: %.loc212_78.2: type = converted %.loc212_78.1, constants.%.26 [template = constants.%.26] +// CHECK:STDOUT: %x.loc212_10.1: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = param x +// CHECK:STDOUT: %x.loc212_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32}) = bind_name x, %x.loc212_10.1 // CHECK:STDOUT: %SelfNestedBadParam.ref: type = name_ref SelfNestedBadParam, file.%SelfNestedBadParam.decl [template = constants.%SelfNestedBadParam] -// CHECK:STDOUT: %.loc208_105: i32 = int_literal 4 [template = constants.%.14] -// CHECK:STDOUT: %.loc208_106: type = array_type %.loc208_105, SelfNestedBadParam [template = constants.%.21] +// CHECK:STDOUT: %.loc212_105: i32 = int_literal 4 [template = constants.%.14] +// CHECK:STDOUT: %.loc212_106: type = array_type %.loc212_105, SelfNestedBadParam [template = constants.%.21] // CHECK:STDOUT: %return.var: ref [SelfNestedBadParam; 4] = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness () [template = ] @@ -846,33 +850,33 @@ class SelfNestedBadReturnType { // CHECK:STDOUT: // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2(@impl.4.%b.loc58_10.2: bool); +// CHECK:STDOUT: fn @F.2(@impl.4.%b.loc62_10.2: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.3[@impl.5.%self.loc71_10.2: FExtraImplicitParam](); +// CHECK:STDOUT: fn @F.3[@impl.5.%self.loc75_10.2: FExtraImplicitParam](); // CHECK:STDOUT: // CHECK:STDOUT: fn @F.4() -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.5[@J.%self.loc89_20.2: bool](@J.%b.loc89_32.2: bool) -> bool; +// CHECK:STDOUT: fn @F.5[@J.%self.loc93_20.2: bool](@J.%b.loc93_32.2: bool) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.6[@impl.7.%self.loc100_10.2: bool]() -> bool; +// CHECK:STDOUT: fn @F.6[@impl.7.%self.loc104_10.2: bool]() -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.7(@impl.8.%b.loc113_10.2: bool) -> bool; +// CHECK:STDOUT: fn @F.7(@impl.8.%b.loc117_10.2: bool) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.8[@impl.9.%self.loc126_10.2: bool](@impl.9.%b.loc126_22.2: bool); +// CHECK:STDOUT: fn @F.8[@impl.9.%self.loc130_10.2: bool](@impl.9.%b.loc130_22.2: bool); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.9[@impl.10.%self.loc139_10.2: bool](@impl.10.%b.loc139_22.2: FDifferentParamType) -> bool; +// CHECK:STDOUT: fn @F.9[@impl.10.%self.loc143_10.2: bool](@impl.10.%b.loc143_22.2: FDifferentParamType) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.10[@impl.11.%self.loc152_10.2: FDifferentImplicitParamType](@impl.11.%b.loc152_22.2: bool) -> bool; +// CHECK:STDOUT: fn @F.10[@impl.11.%self.loc156_10.2: FDifferentImplicitParamType](@impl.11.%b.loc156_22.2: bool) -> bool; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.11[@impl.12.%self.loc165_10.2: bool](@impl.12.%b.loc165_22.2: bool) -> FDifferentReturnType; +// CHECK:STDOUT: fn @F.11[@impl.12.%self.loc169_10.2: bool](@impl.12.%b.loc169_22.2: bool) -> FDifferentReturnType; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.12[@impl.13.%self.loc179_10.2: bool](@impl.13.%not_b.loc179_22.2: bool) -> bool; +// CHECK:STDOUT: fn @F.12[@impl.13.%self.loc183_10.2: bool](@impl.13.%not_b.loc183_22.2: bool) -> bool; // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc184_8.2: (Self*, {.x: Self, .y: i32})) -> [Self; 4]; +// CHECK:STDOUT: fn @F.13(@SelfNested.%x.loc188_8.2: (Self*, {.x: Self, .y: i32})) -> [Self; 4]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.14(@impl.14.%x.loc196_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; +// CHECK:STDOUT: fn @F.14(@impl.14.%x.loc200_10.2: (SelfNestedBadParam*, {.x: i32, .y: i32})) -> [SelfNestedBadParam; 4]; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.15(@impl.15.%x.loc208_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4]; +// CHECK:STDOUT: fn @F.15(@impl.15.%x.loc212_10.2: (SelfNestedBadReturnType*, {.x: SelfNestedBadReturnType, .y: i32})) -> [SelfNestedBadParam; 4]; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon index bb28450faccc..ff45a635d06d 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_interface.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_interface.carbon // CHECK:STDERR: fail_impl_bad_interface.carbon:[[@LINE+7]]:1: ERROR: Semantics TODO: `impl as non-interface`. // CHECK:STDERR: impl i32 as false {} @@ -30,9 +34,9 @@ impl i32 as false {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc14_6.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_6.2: type = converted %int.make_type_32, %.loc14_6.1 [template = i32] -// CHECK:STDOUT: %.loc14_13: bool = bool_literal false [template = constants.%.2] +// CHECK:STDOUT: %.loc18_6.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_6.2: type = converted %int.make_type_32, %.loc18_6.1 [template = i32] +// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon index da749cb913e4..77304f24e027 100644 --- a/toolchain/check/testdata/impl/fail_impl_bad_type.carbon +++ b/toolchain/check/testdata/impl/fail_impl_bad_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_impl_bad_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_impl_bad_type.carbon interface I {} @@ -28,7 +32,7 @@ impl true as I {} // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc16: bool = bool_literal true [template = constants.%.2] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/impl/fail_redefinition.carbon b/toolchain/check/testdata/impl/fail_redefinition.carbon index 18f4b076c04c..e1dc49d2e3c9 100644 --- a/toolchain/check/testdata/impl/fail_redefinition.carbon +++ b/toolchain/check/testdata/impl/fail_redefinition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_redefinition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_redefinition.carbon interface I {} @@ -36,17 +40,17 @@ impl i32 as I {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32.loc9, %.loc9_6.1 [template = i32] -// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_6.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_6.2: type = converted %int.make_type_32.loc13, %.loc13_6.1 [template = i32] +// CHECK:STDOUT: %I.ref.loc13: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc17_6.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_6.2: type = converted %int.make_type_32.loc17, %.loc17_6.1 [template = i32] -// CHECK:STDOUT: %I.ref.loc17: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc21_6.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_6.2: type = converted %int.make_type_32.loc21, %.loc21_6.1 [template = i32] +// CHECK:STDOUT: %I.ref.loc21: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon b/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon index 074dc9966e73..82da1491a479 100644 --- a/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon +++ b/toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/fail_todo_impl_assoc_const.carbon interface I { let T:! type; } @@ -33,8 +37,8 @@ impl bool as I where .T = bool {} // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct() [template = bool] -// CHECK:STDOUT: %.loc12_6.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc12_6.2: type = converted %bool.make_type, %.loc12_6.1 [template = bool] +// CHECK:STDOUT: %.loc16_6.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc16_6.2: type = converted %bool.make_type, %.loc16_6.1 [template = bool] // CHECK:STDOUT: %I.ref: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -42,11 +46,11 @@ impl bool as I where .T = bool {} // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc7: = assoc_entity element0, %T [template = constants.%.3] +// CHECK:STDOUT: %.loc11: = assoc_entity element0, %T [template = constants.%.3] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc7 +// CHECK:STDOUT: .T = %.loc11 // CHECK:STDOUT: witness = (%T) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/impl_as.carbon b/toolchain/check/testdata/impl/impl_as.carbon index d2e12cd38acf..9bae3dabe4ec 100644 --- a/toolchain/check/testdata/impl/impl_as.carbon +++ b/toolchain/check/testdata/impl/impl_as.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/impl_as.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/impl_as.carbon interface Simple { fn F(); @@ -50,11 +54,11 @@ class C { // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,10 +87,10 @@ class C { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc15_19.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_19.2: init C = class_init (), %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_20: init C = converted %.loc15_19.1, %.loc15_19.2 [template = constants.%struct.3] -// CHECK:STDOUT: assign %c.var, %.loc15_20 +// CHECK:STDOUT: %.loc19_19.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_19.2: init C = class_init (), %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_20: init C = converted %.loc19_19.1, %.loc19_19.2 [template = constants.%struct.3] +// CHECK:STDOUT: assign %c.var, %.loc19_20 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/impl_forall.carbon b/toolchain/check/testdata/impl/impl_forall.carbon index bf29614f9940..f76d08dd233b 100644 --- a/toolchain/check/testdata/impl/impl_forall.carbon +++ b/toolchain/check/testdata/impl/impl_forall.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/impl_forall.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/impl_forall.carbon interface Simple { fn F(); @@ -36,9 +40,9 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {} // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %T.loc11_14.1: type = param T -// CHECK:STDOUT: %T.loc11_14.2: type = bind_symbolic_name T 0, %T.loc11_14.1 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc11_14.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc15_14.1: type = param T +// CHECK:STDOUT: %T.loc15_14.2: type = bind_symbolic_name T 0, %T.loc15_14.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc15_14.2 [symbolic = constants.%T] // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, %Simple.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -46,11 +50,11 @@ impl forall [T:! type] T as Simple { // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/alias.carbon b/toolchain/check/testdata/impl/lookup/alias.carbon index 0c31d6dde09f..32ee548981f4 100644 --- a/toolchain/check/testdata/impl/lookup/alias.carbon +++ b/toolchain/check/testdata/impl/lookup/alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/alias.carbon interface HasF { fn F(); @@ -52,24 +56,24 @@ fn G(c: C) { // CHECK:STDOUT: %HasF.decl: type = interface_decl @HasF [template = constants.%.1] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, %HasF.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %c.loc19_6.1: C = param c -// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc19_6.1 +// CHECK:STDOUT: %C.ref.loc23: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %c.loc23_6.1: C = param c +// CHECK:STDOUT: @G.%c: C = bind_name c, %c.loc23_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @HasF { // CHECK:STDOUT: %Self: HasF = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -84,8 +88,8 @@ fn G(c: C) { // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %HasF.ref: type = name_ref HasF, file.%HasF.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @HasF.%.loc8 [template = constants.%.4] -// CHECK:STDOUT: %G: = bind_alias G, @HasF.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @HasF.%.loc12 [template = constants.%.4] +// CHECK:STDOUT: %G: = bind_alias G, @HasF.%.loc12 [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -102,13 +106,13 @@ fn G(c: C) { // CHECK:STDOUT: fn @G(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %G.ref.loc20: = name_ref G, @C.%G [template = constants.%.4] +// CHECK:STDOUT: %G.ref.loc24: = name_ref G, @C.%G [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] -// CHECK:STDOUT: %F.call.loc20: init () = call %.1() +// CHECK:STDOUT: %F.call.loc24: init () = call %.1() // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %G.ref.loc21: = name_ref G, @C.%G [template = constants.%.4] +// CHECK:STDOUT: %G.ref.loc25: = name_ref G, @C.%G [template = constants.%.4] // CHECK:STDOUT: %.2: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] -// CHECK:STDOUT: %F.call.loc21: init () = call %.2() +// CHECK:STDOUT: %F.call.loc25: init () = call %.2() // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon index ee9154c2d7d5..7b10b65171f9 100644 --- a/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/fail_alias_impl_not_found.carbon interface I { fn F(); @@ -53,26 +57,26 @@ fn F(c: C) { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %c.loc15_6.1: C = param c -// CHECK:STDOUT: @F.2.%c: C = bind_name c, %c.loc15_6.1 +// CHECK:STDOUT: %c.loc19_6.1: C = param c +// CHECK:STDOUT: @F.2.%c: C = bind_name c, %c.loc19_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8 [template = constants.%.4] -// CHECK:STDOUT: %F: = bind_alias F, @I.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc12 [template = constants.%.4] +// CHECK:STDOUT: %F: = bind_alias F, @I.%.loc12 [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C @@ -84,9 +88,9 @@ fn F(c: C) { // CHECK:STDOUT: fn @F.2(%c: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref.loc20: = name_ref F, @C.%F [template = constants.%.4] -// CHECK:STDOUT: %c.ref: C = name_ref c, %c // CHECK:STDOUT: %F.ref.loc24: = name_ref F, @C.%F [template = constants.%.4] +// CHECK:STDOUT: %c.ref: C = name_ref c, %c +// CHECK:STDOUT: %F.ref.loc28: = name_ref F, @C.%F [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon index bf6c274b1134..5619c3d85a66 100644 --- a/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +++ b/toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/fail_todo_undefined_impl.carbon interface I { fn F(); @@ -58,8 +62,8 @@ impl C as I { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32, %.loc15_11.1 [template = i32] +// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32, %.loc19_11.1 [template = i32] // CHECK:STDOUT: @F.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl { @@ -71,11 +75,11 @@ impl C as I { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -105,7 +109,7 @@ impl C as I { // CHECK:STDOUT: fn @F.2() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc8 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc12 [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/import.carbon b/toolchain/check/testdata/impl/lookup/import.carbon index 600e02817a70..3c1adb73036b 100644 --- a/toolchain/check/testdata/impl/lookup/import.carbon +++ b/toolchain/check/testdata/impl/lookup/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/import.carbon // --- impl.carbon diff --git a/toolchain/check/testdata/impl/lookup/instance_method.carbon b/toolchain/check/testdata/impl/lookup/instance_method.carbon index 96c325099786..c72b7be3f4f6 100644 --- a/toolchain/check/testdata/impl/lookup/instance_method.carbon +++ b/toolchain/check/testdata/impl/lookup/instance_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/instance_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/instance_method.carbon class C; @@ -45,24 +49,24 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .C = %C.decl.loc7 +// CHECK:STDOUT: .C = %C.decl.loc11 // CHECK:STDOUT: .I = %I.decl // CHECK:STDOUT: .F = %F.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %C.decl.loc7: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %C.decl.loc11: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %C.decl.loc13: type = class_decl @C [template = constants.%C] {} +// CHECK:STDOUT: %C.decl.loc17: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl.loc7 [template = constants.%C] -// CHECK:STDOUT: %c.loc19_6.1: C = param c -// CHECK:STDOUT: @F.3.%c: C = bind_name c, %c.loc19_6.1 +// CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl.loc11 [template = constants.%C] +// CHECK:STDOUT: %c.loc23_6.1: C = param c +// CHECK:STDOUT: @F.3.%c: C = bind_name c, %c.loc23_6.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc19_15.2: type = converted %int.make_type_32, %.loc19_15.1 [template = i32] +// CHECK:STDOUT: %.loc23_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc23_15.2: type = converted %int.make_type_32, %.loc23_15.1 [template = i32] // CHECK:STDOUT: @F.3.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -71,31 +75,31 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.2] { // CHECK:STDOUT: %Self.ref: I = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc10_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc10_14.2: type = converted %Self.ref, %.loc10_14.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %self.loc10_8.1: Self = param self -// CHECK:STDOUT: %self.loc10_8.2: Self = bind_name self, %self.loc10_8.1 +// CHECK:STDOUT: %.loc14_14.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc14_14.2: type = converted %Self.ref, %.loc14_14.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %self.loc14_8.1: Self = param self +// CHECK:STDOUT: %self.loc14_8.2: Self = bind_name self, %self.loc14_8.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32, %.loc10_25.1 [template = i32] +// CHECK:STDOUT: %.loc14_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_25.2: type = converted %int.make_type_32, %.loc14_25.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_28: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc14_28: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc10_28 +// CHECK:STDOUT: .F = %.loc14_28 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as I { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.3] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] -// CHECK:STDOUT: %self.loc15_10.1: C = param self -// CHECK:STDOUT: %self.loc15_10.2: C = bind_name self, %self.loc15_10.1 +// CHECK:STDOUT: %self.loc19_10.1: C = param self +// CHECK:STDOUT: %self.loc19_10.2: C = bind_name self, %self.loc19_10.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_27.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc15_27.2: type = converted %int.make_type_32, %.loc15_27.1 [template = i32] +// CHECK:STDOUT: %.loc19_27.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_27.2: type = converted %int.make_type_32, %.loc19_27.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.5] @@ -117,19 +121,19 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[@I.%self.loc10_8.2: Self]() -> i32; +// CHECK:STDOUT: fn @F.1[@I.%self.loc14_8.2: Self]() -> i32; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@impl.%self.loc15_10.2: C]() -> i32; +// CHECK:STDOUT: fn @F.2[@impl.%self.loc19_10.2: C]() -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @F.3(%c: C) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %c.ref: C = name_ref c, %c -// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc10_28 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc14_28 [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc20_11: = bound_method %c.ref, %.1 -// CHECK:STDOUT: %F.call: init i32 = call %.loc20_11(%c.ref) -// CHECK:STDOUT: %.loc20_15.1: i32 = value_of_initializer %F.call -// CHECK:STDOUT: %.loc20_15.2: i32 = converted %F.call, %.loc20_15.1 -// CHECK:STDOUT: return %.loc20_15.2 +// CHECK:STDOUT: %.loc24_11: = bound_method %c.ref, %.1 +// CHECK:STDOUT: %F.call: init i32 = call %.loc24_11(%c.ref) +// CHECK:STDOUT: %.loc24_15.1: i32 = value_of_initializer %F.call +// CHECK:STDOUT: %.loc24_15.2: i32 = converted %F.call, %.loc24_15.1 +// CHECK:STDOUT: return %.loc24_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon index dc977687cd68..1bb830c5e22a 100644 --- a/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon +++ b/toolchain/check/testdata/impl/lookup/no_prelude/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/no_prelude/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/import.carbon // --- impl.carbon diff --git a/toolchain/check/testdata/impl/no_prelude/basic.carbon b/toolchain/check/testdata/impl/no_prelude/basic.carbon index e0d1b2e8c27f..2337827f1687 100644 --- a/toolchain/check/testdata/impl/no_prelude/basic.carbon +++ b/toolchain/check/testdata/impl/no_prelude/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/basic.carbon interface Simple { fn F(); @@ -47,11 +51,11 @@ impl C as Simple { // CHECK:STDOUT: interface @Simple { // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/import_self.carbon b/toolchain/check/testdata/impl/no_prelude/import_self.carbon index d09bc0529135..8d7661dfbf19 100644 --- a/toolchain/check/testdata/impl/no_prelude/import_self.carbon +++ b/toolchain/check/testdata/impl/no_prelude/import_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/import_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/import_self.carbon // --- a.carbon diff --git a/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon b/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon index f49d9b643372..acdfff9b4c6a 100644 --- a/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon +++ b/toolchain/check/testdata/impl/no_prelude/self_in_class.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/self_in_class.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/self_in_class.carbon interface DefaultConstructible { fn Make() -> Self; @@ -53,15 +57,15 @@ class A { // CHECK:STDOUT: %Self: DefaultConstructible = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %Make.decl: Make = fn_decl @Make.1 [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: DefaultConstructible = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_16.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_16.2: type = converted %Self.ref, %.loc8_16.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_16.1: type = facet_type_access %Self.ref [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_16.2: type = converted %Self.ref, %.loc12_16.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_20: = assoc_entity element0, %Make.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12_20: = assoc_entity element0, %Make.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .Make = %.loc8_20 +// CHECK:STDOUT: .Make = %.loc12_20 // CHECK:STDOUT: witness = (%Make.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -96,9 +100,9 @@ class A { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make.2() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_33.1: {} = struct_literal () -// CHECK:STDOUT: %.loc17_33.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc17_34: init C = converted %.loc17_33.1, %.loc17_33.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc17_34 to @impl.%return.var +// CHECK:STDOUT: %.loc21_33.1: {} = struct_literal () +// CHECK:STDOUT: %.loc21_33.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc21_34: init C = converted %.loc21_33.1, %.loc21_33.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc21_34 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon b/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon index c6e48ef4fd08..72cfd9db6fe9 100644 --- a/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon +++ b/toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon interface UseSelf { fn F[self: Self](x: Self) -> Self; @@ -89,85 +93,85 @@ impl D as SelfNested { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %UseSelf.ref.loc15: type = name_ref UseSelf, %UseSelf.decl [template = constants.%.1] +// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %UseSelf.ref.loc19: type = name_ref UseSelf, %UseSelf.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %D.ref.loc19: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %UseSelf.ref.loc19: type = name_ref UseSelf, %UseSelf.decl [template = constants.%.1] +// CHECK:STDOUT: %D.ref.loc23: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %UseSelf.ref.loc23: type = name_ref UseSelf, %UseSelf.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%.9] {} // CHECK:STDOUT: impl_decl @impl.3 { -// CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %SelfNested.ref.loc27: type = name_ref SelfNested, %SelfNested.decl [template = constants.%.9] +// CHECK:STDOUT: %C.ref.loc31: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %SelfNested.ref.loc31: type = name_ref SelfNested, %SelfNested.decl [template = constants.%.9] // CHECK:STDOUT: } // CHECK:STDOUT: impl_decl @impl.4 { -// CHECK:STDOUT: %D.ref.loc31: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %SelfNested.ref.loc31: type = name_ref SelfNested, %SelfNested.decl [template = constants.%.9] +// CHECK:STDOUT: %D.ref.loc35: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %SelfNested.ref.loc35: type = name_ref SelfNested, %SelfNested.decl [template = constants.%.9] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @UseSelf { // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %Self.ref.loc8_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %self.loc8_8.1: Self = param self -// CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %Self.ref.loc8_23: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_23.1: type = facet_type_access %Self.ref.loc8_23 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_23.2: type = converted %Self.ref.loc8_23, %.loc8_23.1 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %x.loc8_20.1: Self = param x -// CHECK:STDOUT: %x.loc8_20.2: Self = bind_name x, %x.loc8_20.1 -// CHECK:STDOUT: %Self.ref.loc8_32: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_32.1: type = facet_type_access %Self.ref.loc8_32 [symbolic = constants.%Self.1] -// CHECK:STDOUT: %.loc8_32.2: type = converted %Self.ref.loc8_32, %.loc8_32.1 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %Self.ref.loc12_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_14.1: type = facet_type_access %Self.ref.loc12_14 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref.loc12_14, %.loc12_14.1 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %self.loc12_8.1: Self = param self +// CHECK:STDOUT: %self.loc12_8.2: Self = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %Self.ref.loc12_23: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_23.1: type = facet_type_access %Self.ref.loc12_23 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_23.2: type = converted %Self.ref.loc12_23, %.loc12_23.1 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %x.loc12_20.1: Self = param x +// CHECK:STDOUT: %x.loc12_20.2: Self = bind_name x, %x.loc12_20.1 +// CHECK:STDOUT: %Self.ref.loc12_32: UseSelf = name_ref Self, %Self [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_32.1: type = facet_type_access %Self.ref.loc12_32 [symbolic = constants.%Self.1] +// CHECK:STDOUT: %.loc12_32.2: type = converted %Self.ref.loc12_32, %.loc12_32.1 [symbolic = constants.%Self.1] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_36: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12_36: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8_36 +// CHECK:STDOUT: .F = %.loc12_36 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @SelfNested { // CHECK:STDOUT: %Self: SelfNested = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F.4 [template = constants.%struct.6] { -// CHECK:STDOUT: %Self.ref.loc24_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_16.1: type = facet_type_access %Self.ref.loc24_12 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_16.2: type = converted %Self.ref.loc24_12, %.loc24_16.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_16.3: type = ptr_type Self [symbolic = constants.%.10] -// CHECK:STDOUT: %Self.ref.loc24_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_24.1: type = facet_type_access %Self.ref.loc24_24 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_24.2: type = converted %Self.ref.loc24_24, %.loc24_24.1 [symbolic = constants.%Self.2] -// CHECK:STDOUT: %.loc24_35.1: () = tuple_literal () -// CHECK:STDOUT: %.loc24_35.2: type = converted %.loc24_35.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc24_36: type = struct_type {.x: Self, .y: ()} [symbolic = constants.%.11] -// CHECK:STDOUT: %.loc24_37.1: (type, type) = tuple_literal (%.loc24_16.3, %.loc24_36) -// CHECK:STDOUT: %.loc24_37.2: type = converted %.loc24_37.1, constants.%.13 [symbolic = constants.%.13] -// CHECK:STDOUT: %x.loc24_8.1: (Self*, {.x: Self, .y: ()}) = param x -// CHECK:STDOUT: %x.loc24_8.2: (Self*, {.x: Self, .y: ()}) = bind_name x, %x.loc24_8.1 +// CHECK:STDOUT: %Self.ref.loc28_12: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_16.1: type = facet_type_access %Self.ref.loc28_12 [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_16.2: type = converted %Self.ref.loc28_12, %.loc28_16.1 [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_16.3: type = ptr_type Self [symbolic = constants.%.10] +// CHECK:STDOUT: %Self.ref.loc28_24: SelfNested = name_ref Self, %Self [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_24.1: type = facet_type_access %Self.ref.loc28_24 [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_24.2: type = converted %Self.ref.loc28_24, %.loc28_24.1 [symbolic = constants.%Self.2] +// CHECK:STDOUT: %.loc28_35.1: () = tuple_literal () +// CHECK:STDOUT: %.loc28_35.2: type = converted %.loc28_35.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc28_36: type = struct_type {.x: Self, .y: ()} [symbolic = constants.%.11] +// CHECK:STDOUT: %.loc28_37.1: (type, type) = tuple_literal (%.loc28_16.3, %.loc28_36) +// CHECK:STDOUT: %.loc28_37.2: type = converted %.loc28_37.1, constants.%.13 [symbolic = constants.%.13] +// CHECK:STDOUT: %x.loc28_8.1: (Self*, {.x: Self, .y: ()}) = param x +// CHECK:STDOUT: %x.loc28_8.2: (Self*, {.x: Self, .y: ()}) = bind_name x, %x.loc28_8.1 // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc24_39: = assoc_entity element0, %F.decl [template = constants.%.15] +// CHECK:STDOUT: %.loc28_39: = assoc_entity element0, %F.decl [template = constants.%.15] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc24_39 +// CHECK:STDOUT: .F = %.loc28_39 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as UseSelf { // CHECK:STDOUT: %F.decl: F = fn_decl @F.2 [template = constants.%struct.2] { -// CHECK:STDOUT: %C.ref.loc16_14: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc16_8.1: C = param self -// CHECK:STDOUT: %self.loc16_8.2: C = bind_name self, %self.loc16_8.1 -// CHECK:STDOUT: %C.ref.loc16_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %x.loc16_17.1: C = param x -// CHECK:STDOUT: %x.loc16_17.2: C = bind_name x, %x.loc16_17.1 -// CHECK:STDOUT: %C.ref.loc16_26: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc20_14: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc20_8.1: C = param self +// CHECK:STDOUT: %self.loc20_8.2: C = bind_name self, %self.loc20_8.1 +// CHECK:STDOUT: %C.ref.loc20_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %x.loc20_17.1: C = param x +// CHECK:STDOUT: %x.loc20_17.2: C = bind_name x, %x.loc20_17.1 +// CHECK:STDOUT: %C.ref.loc20_26: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.6] @@ -179,13 +183,13 @@ impl D as SelfNested { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: D as UseSelf { // CHECK:STDOUT: %F.decl: F = fn_decl @F.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %Self.ref.loc20_14: type = name_ref Self, constants.%D [template = constants.%D] -// CHECK:STDOUT: %self.loc20_8.1: D = param self -// CHECK:STDOUT: %self.loc20_8.2: D = bind_name self, %self.loc20_8.1 -// CHECK:STDOUT: %Self.ref.loc20_23: type = name_ref Self, constants.%D [template = constants.%D] -// CHECK:STDOUT: %x.loc20_20.1: D = param x -// CHECK:STDOUT: %x.loc20_20.2: D = bind_name x, %x.loc20_20.1 -// CHECK:STDOUT: %Self.ref.loc20_32: type = name_ref Self, constants.%D [template = constants.%D] +// CHECK:STDOUT: %Self.ref.loc24_14: type = name_ref Self, constants.%D [template = constants.%D] +// CHECK:STDOUT: %self.loc24_8.1: D = param self +// CHECK:STDOUT: %self.loc24_8.2: D = bind_name self, %self.loc24_8.1 +// CHECK:STDOUT: %Self.ref.loc24_23: type = name_ref Self, constants.%D [template = constants.%D] +// CHECK:STDOUT: %x.loc24_20.1: D = param x +// CHECK:STDOUT: %x.loc24_20.2: D = bind_name x, %x.loc24_20.1 +// CHECK:STDOUT: %Self.ref.loc24_32: type = name_ref Self, constants.%D [template = constants.%D] // CHECK:STDOUT: %return.var: ref D = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.8] @@ -197,16 +201,16 @@ impl D as SelfNested { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.3: C as SelfNested { // CHECK:STDOUT: %F.decl: F = fn_decl @F.5 [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc28_12: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc28_13: type = ptr_type C [template = constants.%.16] -// CHECK:STDOUT: %C.ref.loc28_21: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc28_29.1: () = tuple_literal () -// CHECK:STDOUT: %.loc28_29.2: type = converted %.loc28_29.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc28_30: type = struct_type {.x: C, .y: ()} [template = constants.%.17] -// CHECK:STDOUT: %.loc28_31.1: (type, type) = tuple_literal (%.loc28_13, %.loc28_30) -// CHECK:STDOUT: %.loc28_31.2: type = converted %.loc28_31.1, constants.%.18 [template = constants.%.18] -// CHECK:STDOUT: %x.loc28_8.1: (C*, {.x: C, .y: ()}) = param x -// CHECK:STDOUT: %x.loc28_8.2: (C*, {.x: C, .y: ()}) = bind_name x, %x.loc28_8.1 +// CHECK:STDOUT: %C.ref.loc32_12: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc32_13: type = ptr_type C [template = constants.%.16] +// CHECK:STDOUT: %C.ref.loc32_21: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc32_29.1: () = tuple_literal () +// CHECK:STDOUT: %.loc32_29.2: type = converted %.loc32_29.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc32_30: type = struct_type {.x: C, .y: ()} [template = constants.%.17] +// CHECK:STDOUT: %.loc32_31.1: (type, type) = tuple_literal (%.loc32_13, %.loc32_30) +// CHECK:STDOUT: %.loc32_31.2: type = converted %.loc32_31.1, constants.%.18 [template = constants.%.18] +// CHECK:STDOUT: %x.loc32_8.1: (C*, {.x: C, .y: ()}) = param x +// CHECK:STDOUT: %x.loc32_8.2: (C*, {.x: C, .y: ()}) = bind_name x, %x.loc32_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.19] // CHECK:STDOUT: @@ -217,16 +221,16 @@ impl D as SelfNested { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.4: D as SelfNested { // CHECK:STDOUT: %F.decl: F = fn_decl @F.6 [template = constants.%struct.8] { -// CHECK:STDOUT: %Self.ref.loc32_12: type = name_ref Self, constants.%D [template = constants.%D] -// CHECK:STDOUT: %.loc32_16: type = ptr_type D [template = constants.%.20] -// CHECK:STDOUT: %Self.ref.loc32_24: type = name_ref Self, constants.%D [template = constants.%D] -// CHECK:STDOUT: %.loc32_35.1: () = tuple_literal () -// CHECK:STDOUT: %.loc32_35.2: type = converted %.loc32_35.1, constants.%.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc32_36: type = struct_type {.x: D, .y: ()} [template = constants.%.21] -// CHECK:STDOUT: %.loc32_37.1: (type, type) = tuple_literal (%.loc32_16, %.loc32_36) -// CHECK:STDOUT: %.loc32_37.2: type = converted %.loc32_37.1, constants.%.22 [template = constants.%.22] -// CHECK:STDOUT: %x.loc32_8.1: (D*, {.x: D, .y: ()}) = param x -// CHECK:STDOUT: %x.loc32_8.2: (D*, {.x: D, .y: ()}) = bind_name x, %x.loc32_8.1 +// CHECK:STDOUT: %Self.ref.loc36_12: type = name_ref Self, constants.%D [template = constants.%D] +// CHECK:STDOUT: %.loc36_16: type = ptr_type D [template = constants.%.20] +// CHECK:STDOUT: %Self.ref.loc36_24: type = name_ref Self, constants.%D [template = constants.%D] +// CHECK:STDOUT: %.loc36_35.1: () = tuple_literal () +// CHECK:STDOUT: %.loc36_35.2: type = converted %.loc36_35.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc36_36: type = struct_type {.x: D, .y: ()} [template = constants.%.21] +// CHECK:STDOUT: %.loc36_37.1: (type, type) = tuple_literal (%.loc36_16, %.loc36_36) +// CHECK:STDOUT: %.loc36_37.2: type = converted %.loc36_37.1, constants.%.22 [template = constants.%.22] +// CHECK:STDOUT: %x.loc36_8.1: (D*, {.x: D, .y: ()}) = param x +// CHECK:STDOUT: %x.loc36_8.2: (D*, {.x: D, .y: ()}) = bind_name x, %x.loc36_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%F.decl) [template = constants.%.23] // CHECK:STDOUT: @@ -245,27 +249,27 @@ impl D as SelfNested { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.1[@UseSelf.%self.loc8_8.2: Self](@UseSelf.%x.loc8_20.2: Self) -> Self; +// CHECK:STDOUT: fn @F.1[@UseSelf.%self.loc12_8.2: Self](@UseSelf.%x.loc12_20.2: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.2[@impl.1.%self.loc16_8.2: C](@impl.1.%x.loc16_17.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @F.2[@impl.1.%self.loc20_8.2: C](@impl.1.%x.loc20_17.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_38.1: {} = struct_literal () -// CHECK:STDOUT: %.loc16_38.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc16_39: init C = converted %.loc16_38.1, %.loc16_38.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc16_39 to @impl.1.%return.var +// CHECK:STDOUT: %.loc20_38.1: {} = struct_literal () +// CHECK:STDOUT: %.loc20_38.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc20_39: init C = converted %.loc20_38.1, %.loc20_38.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc20_39 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.3[@impl.2.%self.loc20_8.2: D](@impl.2.%x.loc20_20.2: D) -> @impl.2.%return.var: D { +// CHECK:STDOUT: fn @F.3[@impl.2.%self.loc24_8.2: D](@impl.2.%x.loc24_20.2: D) -> @impl.2.%return.var: D { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20_47.1: {} = struct_literal () -// CHECK:STDOUT: %.loc20_47.2: init D = class_init (), @impl.2.%return.var [template = constants.%struct.5] -// CHECK:STDOUT: %.loc20_48: init D = converted %.loc20_47.1, %.loc20_47.2 [template = constants.%struct.5] -// CHECK:STDOUT: return %.loc20_48 to @impl.2.%return.var +// CHECK:STDOUT: %.loc24_47.1: {} = struct_literal () +// CHECK:STDOUT: %.loc24_47.2: init D = class_init (), @impl.2.%return.var [template = constants.%struct.5] +// CHECK:STDOUT: %.loc24_48: init D = converted %.loc24_47.1, %.loc24_47.2 [template = constants.%struct.5] +// CHECK:STDOUT: return %.loc24_48 to @impl.2.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.4(@SelfNested.%x.loc24_8.2: (Self*, {.x: Self, .y: ()})); +// CHECK:STDOUT: fn @F.4(@SelfNested.%x.loc28_8.2: (Self*, {.x: Self, .y: ()})); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.5(@impl.3.%x.loc28_8.2: (C*, {.x: C, .y: ()})); +// CHECK:STDOUT: fn @F.5(@impl.3.%x.loc32_8.2: (C*, {.x: C, .y: ()})); // CHECK:STDOUT: -// CHECK:STDOUT: fn @F.6(@impl.4.%x.loc32_8.2: (D*, {.x: D, .y: ()})); +// CHECK:STDOUT: fn @F.6(@impl.4.%x.loc36_8.2: (D*, {.x: D, .y: ()})); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/impl/redeclaration.carbon b/toolchain/check/testdata/impl/redeclaration.carbon index 2c8a7b2506ef..9a29a6315b8c 100644 --- a/toolchain/check/testdata/impl/redeclaration.carbon +++ b/toolchain/check/testdata/impl/redeclaration.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/redeclaration.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/redeclaration.carbon interface I {} @@ -37,19 +41,19 @@ impl i32 as I {} // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_6.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_6.2: type = converted %int.make_type_32.loc9, %.loc9_6.1 [template = i32] -// CHECK:STDOUT: %I.ref.loc9: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_6.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_6.2: type = converted %int.make_type_32.loc13, %.loc13_6.1 [template = i32] +// CHECK:STDOUT: %I.ref.loc13: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc15_6.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_6.2: type = converted %int.make_type_32.loc15, %.loc15_6.1 [template = i32] -// CHECK:STDOUT: %I.ref.loc15: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc19_6.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_6.2: type = converted %int.make_type_32.loc19, %.loc19_6.1 [template = i32] +// CHECK:STDOUT: %I.ref.loc19: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -71,8 +75,8 @@ impl i32 as I {} // CHECK:STDOUT: class @X { // CHECK:STDOUT: impl_decl @impl { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %.loc16_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc16_8.2: type = converted %int.make_type_32, %.loc16_8.1 [template = i32] // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%.1] // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/array_element_access.carbon b/toolchain/check/testdata/index/array_element_access.carbon index cd09c369d418..e5a9795142fb 100644 --- a/toolchain/check/testdata/index/array_element_access.carbon +++ b/toolchain/check/testdata/index/array_element_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/array_element_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/array_element_access.carbon var a: [i32; 2] = (12, 24); var b: i32 = 1; @@ -36,29 +40,29 @@ var d: i32 = a[b]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 2 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 2 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 2] = var a // CHECK:STDOUT: %a: ref [i32; 2] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_8.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_8.2: type = converted %int.make_type_32.loc10, %.loc10_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_8.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_8.2: type = converted %int.make_type_32.loc14, %.loc14_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var // CHECK:STDOUT: } @@ -67,31 +71,31 @@ var d: i32 = a[b]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_24: i32 = int_literal 24 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_20, %.loc7_24) -// CHECK:STDOUT: %.loc7_26.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc7_26.3: ref i32 = array_index file.%a.var, %.loc7_26.2 -// CHECK:STDOUT: %.loc7_26.4: init i32 = initialize_from %.loc7_20 to %.loc7_26.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26.5: i32 = int_literal 1 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_26.6: ref i32 = array_index file.%a.var, %.loc7_26.5 -// CHECK:STDOUT: %.loc7_26.7: init i32 = initialize_from %.loc7_24 to %.loc7_26.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26.8: init [i32; 2] = array_init (%.loc7_26.4, %.loc7_26.7) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_27: init [i32; 2] = converted %.loc7_26.1, %.loc7_26.8 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_27 -// CHECK:STDOUT: %.loc8: i32 = int_literal 1 [template = constants.%.9] -// CHECK:STDOUT: assign file.%b.var, %.loc8 -// CHECK:STDOUT: %a.ref.loc9: ref [i32; 2] = name_ref a, file.%a -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc9_17.1: ref i32 = array_index %a.ref.loc9, %.loc9_16 -// CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 -// CHECK:STDOUT: assign file.%c.var, %.loc9_17.2 -// CHECK:STDOUT: %a.ref.loc10: ref [i32; 2] = name_ref a, file.%a +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_24: i32 = int_literal 24 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26.1: (i32, i32) = tuple_literal (%.loc11_20, %.loc11_24) +// CHECK:STDOUT: %.loc11_26.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc11_26.3: ref i32 = array_index file.%a.var, %.loc11_26.2 +// CHECK:STDOUT: %.loc11_26.4: init i32 = initialize_from %.loc11_20 to %.loc11_26.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26.5: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_26.6: ref i32 = array_index file.%a.var, %.loc11_26.5 +// CHECK:STDOUT: %.loc11_26.7: init i32 = initialize_from %.loc11_24 to %.loc11_26.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26.8: init [i32; 2] = array_init (%.loc11_26.4, %.loc11_26.7) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_27: init [i32; 2] = converted %.loc11_26.1, %.loc11_26.8 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_27 +// CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: assign file.%b.var, %.loc12 +// CHECK:STDOUT: %a.ref.loc13: ref [i32; 2] = name_ref a, file.%a +// CHECK:STDOUT: %.loc13_16: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc13_17.1: ref i32 = array_index %a.ref.loc13, %.loc13_16 +// CHECK:STDOUT: %.loc13_17.2: i32 = bind_value %.loc13_17.1 +// CHECK:STDOUT: assign file.%c.var, %.loc13_17.2 +// CHECK:STDOUT: %a.ref.loc14: ref [i32; 2] = name_ref a, file.%a // CHECK:STDOUT: %b.ref: ref i32 = name_ref b, file.%b -// CHECK:STDOUT: %.loc10_16: i32 = bind_value %b.ref -// CHECK:STDOUT: %.loc10_17.1: ref i32 = array_index %a.ref.loc10, %.loc10_16 -// CHECK:STDOUT: %.loc10_17.2: i32 = bind_value %.loc10_17.1 -// CHECK:STDOUT: assign file.%d.var, %.loc10_17.2 +// CHECK:STDOUT: %.loc14_16: i32 = bind_value %b.ref +// CHECK:STDOUT: %.loc14_17.1: ref i32 = array_index %a.ref.loc14, %.loc14_16 +// CHECK:STDOUT: %.loc14_17.2: i32 = bind_value %.loc14_17.1 +// CHECK:STDOUT: assign file.%d.var, %.loc14_17.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/expr_category.carbon b/toolchain/check/testdata/index/expr_category.carbon index 1510cb3f6819..defb852f18f2 100644 --- a/toolchain/check/testdata/index/expr_category.carbon +++ b/toolchain/check/testdata/index/expr_category.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/expr_category.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/expr_category.carbon fn F() -> [i32; 3]; @@ -58,34 +62,34 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7, %.loc7_12.1 [template = i32] -// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11, %.loc11_12.1 [template = i32] +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref [i32; 3] = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.3] -// CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b -// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15, i32 [template = constants.%.3] +// CHECK:STDOUT: %b.loc13_6.1: [i32; 3] = param b +// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc13_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ValueBinding.decl: ValueBinding = fn_decl @ValueBinding [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_26: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] -// CHECK:STDOUT: %.loc17_27: type = array_type %.loc17_26, i32 [template = constants.%.3] -// CHECK:STDOUT: %b.loc17_17.1: [i32; 3] = param b -// CHECK:STDOUT: @ValueBinding.%b: [i32; 3] = bind_name b, %b.loc17_17.1 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_26: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_21.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_21.2: type = converted %int.make_type_32.loc21, %.loc21_21.1 [template = i32] +// CHECK:STDOUT: %.loc21_27: type = array_type %.loc21_26, i32 [template = constants.%.3] +// CHECK:STDOUT: %b.loc21_17.1: [i32; 3] = param b +// CHECK:STDOUT: @ValueBinding.%b: [i32; 3] = bind_name b, %b.loc21_17.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } @@ -96,88 +100,88 @@ fn ValueBinding(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10, %.loc10_11.1 [template = i32] -// CHECK:STDOUT: %.loc10_17: type = array_type %.loc10_16, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14, %.loc14_11.1 [template = i32] +// CHECK:STDOUT: %.loc14_17: type = array_type %.loc14_16, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_28: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_29.1: (i32, i32, i32) = tuple_literal (%.loc10_22, %.loc10_25, %.loc10_28) -// CHECK:STDOUT: %.loc10_29.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc10_29.3: ref i32 = array_index %a.var, %.loc10_29.2 -// CHECK:STDOUT: %.loc10_29.4: init i32 = initialize_from %.loc10_22 to %.loc10_29.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_29.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_29.6: ref i32 = array_index %a.var, %.loc10_29.5 -// CHECK:STDOUT: %.loc10_29.7: init i32 = initialize_from %.loc10_25 to %.loc10_29.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_29.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_29.9: ref i32 = array_index %a.var, %.loc10_29.8 -// CHECK:STDOUT: %.loc10_29.10: init i32 = initialize_from %.loc10_28 to %.loc10_29.9 [template = constants.%.2] -// CHECK:STDOUT: %.loc10_29.11: init [i32; 3] = array_init (%.loc10_29.4, %.loc10_29.7, %.loc10_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc10_30: init [i32; 3] = converted %.loc10_29.1, %.loc10_29.11 [template = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc10_30 -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_14.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_14.2: type = converted %int.make_type_32.loc13, %.loc13_14.1 [template = i32] -// CHECK:STDOUT: %.loc13_14.3: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_25: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_28: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_29.1: (i32, i32, i32) = tuple_literal (%.loc14_22, %.loc14_25, %.loc14_28) +// CHECK:STDOUT: %.loc14_29.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_29.3: ref i32 = array_index %a.var, %.loc14_29.2 +// CHECK:STDOUT: %.loc14_29.4: init i32 = initialize_from %.loc14_22 to %.loc14_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_29.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_29.6: ref i32 = array_index %a.var, %.loc14_29.5 +// CHECK:STDOUT: %.loc14_29.7: init i32 = initialize_from %.loc14_25 to %.loc14_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_29.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_29.9: ref i32 = array_index %a.var, %.loc14_29.8 +// CHECK:STDOUT: %.loc14_29.10: init i32 = initialize_from %.loc14_28 to %.loc14_29.9 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_29.11: init [i32; 3] = array_init (%.loc14_29.4, %.loc14_29.7, %.loc14_29.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc14_30: init [i32; 3] = converted %.loc14_29.1, %.loc14_29.11 [template = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc14_30 +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_14.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_14.2: type = converted %int.make_type_32.loc17, %.loc17_14.1 [template = i32] +// CHECK:STDOUT: %.loc17_14.3: type = ptr_type i32 [template = constants.%.9] // CHECK:STDOUT: %pa.var: ref i32* = var pa // CHECK:STDOUT: %pa: ref i32* = bind_name pa, %pa.var -// CHECK:STDOUT: %a.ref.loc13: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc13_21: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc13_22: ref i32 = array_index %a.ref.loc13, %.loc13_21 -// CHECK:STDOUT: %.loc13_18: i32* = addr_of %.loc13_22 -// CHECK:STDOUT: assign %pa.var, %.loc13_18 -// CHECK:STDOUT: %a.ref.loc14: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc14_5: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc14_6: ref i32 = array_index %a.ref.loc14, %.loc14_5 -// CHECK:STDOUT: %.loc14_10: i32 = int_literal 4 [template = constants.%.10] -// CHECK:STDOUT: assign %.loc14_6, %.loc14_10 +// CHECK:STDOUT: %a.ref.loc17: ref [i32; 3] = name_ref a, %a +// CHECK:STDOUT: %.loc17_21: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc17_22: ref i32 = array_index %a.ref.loc17, %.loc17_21 +// CHECK:STDOUT: %.loc17_18: i32* = addr_of %.loc17_22 +// CHECK:STDOUT: assign %pa.var, %.loc17_18 +// CHECK:STDOUT: %a.ref.loc18: ref [i32; 3] = name_ref a, %a +// CHECK:STDOUT: %.loc18_5: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc18_6: ref i32 = array_index %a.ref.loc18, %.loc18_5 +// CHECK:STDOUT: %.loc18_10: i32 = int_literal 4 [template = constants.%.10] +// CHECK:STDOUT: assign %.loc18_6, %.loc18_10 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @ValueBinding(%b: [i32; 3]) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_11.2: type = converted %int.make_type_32, %.loc18_11.1 [template = i32] -// CHECK:STDOUT: %.loc18_17: type = array_type %.loc18_16, i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc22_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_11.2: type = converted %int.make_type_32, %.loc22_11.1 [template = i32] +// CHECK:STDOUT: %.loc22_17: type = array_type %.loc22_16, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 3] = var a // CHECK:STDOUT: %a: ref [i32; 3] = bind_name a, %a.var -// CHECK:STDOUT: %.loc18_22: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_25: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc18_28: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_29.1: (i32, i32, i32) = tuple_literal (%.loc18_22, %.loc18_25, %.loc18_28) -// CHECK:STDOUT: %.loc18_29.2: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc18_29.3: ref i32 = array_index %a.var, %.loc18_29.2 -// CHECK:STDOUT: %.loc18_29.4: init i32 = initialize_from %.loc18_22 to %.loc18_29.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_29.5: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc18_29.6: ref i32 = array_index %a.var, %.loc18_29.5 -// CHECK:STDOUT: %.loc18_29.7: init i32 = initialize_from %.loc18_25 to %.loc18_29.6 [template = constants.%.6] -// CHECK:STDOUT: %.loc18_29.8: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc18_29.9: ref i32 = array_index %a.var, %.loc18_29.8 -// CHECK:STDOUT: %.loc18_29.10: init i32 = initialize_from %.loc18_28 to %.loc18_29.9 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_29.11: init [i32; 3] = array_init (%.loc18_29.4, %.loc18_29.7, %.loc18_29.10) to %a.var [template = constants.%array] -// CHECK:STDOUT: %.loc18_30: init [i32; 3] = converted %.loc18_29.1, %.loc18_29.11 [template = constants.%array] -// CHECK:STDOUT: assign %a.var, %.loc18_30 +// CHECK:STDOUT: %.loc22_22: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc22_25: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc22_28: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_29.1: (i32, i32, i32) = tuple_literal (%.loc22_22, %.loc22_25, %.loc22_28) +// CHECK:STDOUT: %.loc22_29.2: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc22_29.3: ref i32 = array_index %a.var, %.loc22_29.2 +// CHECK:STDOUT: %.loc22_29.4: init i32 = initialize_from %.loc22_22 to %.loc22_29.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc22_29.5: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc22_29.6: ref i32 = array_index %a.var, %.loc22_29.5 +// CHECK:STDOUT: %.loc22_29.7: init i32 = initialize_from %.loc22_25 to %.loc22_29.6 [template = constants.%.6] +// CHECK:STDOUT: %.loc22_29.8: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc22_29.9: ref i32 = array_index %a.var, %.loc22_29.8 +// CHECK:STDOUT: %.loc22_29.10: init i32 = initialize_from %.loc22_28 to %.loc22_29.9 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_29.11: init [i32; 3] = array_init (%.loc22_29.4, %.loc22_29.7, %.loc22_29.10) to %a.var [template = constants.%array] +// CHECK:STDOUT: %.loc22_30: init [i32; 3] = converted %.loc22_29.1, %.loc22_29.11 [template = constants.%array] +// CHECK:STDOUT: assign %a.var, %.loc22_30 // CHECK:STDOUT: %a.ref: ref [i32; 3] = name_ref a, %a -// CHECK:STDOUT: %.loc22_5: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc22_6: ref i32 = array_index %a.ref, %.loc22_5 +// CHECK:STDOUT: %.loc26_5: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc26_6: ref i32 = array_index %a.ref, %.loc26_5 // CHECK:STDOUT: %b.ref: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc23_5: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc23_6.1: ref [i32; 3] = value_as_ref %b.ref -// CHECK:STDOUT: %.loc23_6.2: ref i32 = array_index %.loc23_6.1, %.loc23_5 -// CHECK:STDOUT: %.loc23_6.3: i32 = bind_value %.loc23_6.2 +// CHECK:STDOUT: %.loc27_5: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc27_6.1: ref [i32; 3] = value_as_ref %b.ref +// CHECK:STDOUT: %.loc27_6.2: ref i32 = array_index %.loc27_6.1, %.loc27_5 +// CHECK:STDOUT: %.loc27_6.3: i32 = bind_value %.loc27_6.2 // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc24_4.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %F.call: init [i32; 3] = call %F.ref() to %.loc24_4.1 -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: %.loc24_4.2: ref [i32; 3] = temporary %.loc24_4.1, %F.call -// CHECK:STDOUT: %.loc24_8.1: ref i32 = array_index %.loc24_4.2, %.loc24_7 -// CHECK:STDOUT: %.loc24_8.2: i32 = bind_value %.loc24_8.1 +// CHECK:STDOUT: %.loc28_4.1: ref [i32; 3] = temporary_storage +// CHECK:STDOUT: %F.call: init [i32; 3] = call %F.ref() to %.loc28_4.1 +// CHECK:STDOUT: %.loc28_7: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: %.loc28_4.2: ref [i32; 3] = temporary %.loc28_4.1, %F.call +// CHECK:STDOUT: %.loc28_8.1: ref i32 = array_index %.loc28_4.2, %.loc28_7 +// CHECK:STDOUT: %.loc28_8.2: i32 = bind_value %.loc28_8.1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_array_large_index.carbon b/toolchain/check/testdata/index/fail_array_large_index.carbon index b90a47d4a0ad..b02bbe496bde 100644 --- a/toolchain/check/testdata/index/fail_array_large_index.carbon +++ b/toolchain/check/testdata/index/fail_array_large_index.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_array_large_index.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_large_index.carbon var a: [i32; 1] = (12,); @@ -42,23 +46,23 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc18_8.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] -// CHECK:STDOUT: %.loc18_8.2: type = converted %int.make_type_32.loc18, %.loc18_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc22_8.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_8.2: type = converted %int.make_type_32.loc22, %.loc22_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: } @@ -67,24 +71,24 @@ var c: i32 = a[0x7FFF_FFFF]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_24 -// CHECK:STDOUT: %a.ref.loc13: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_17.1: ref i32 = array_index %a.ref.loc13, %.loc13_16 [template = ] -// CHECK:STDOUT: %.loc13_17.2: i32 = bind_value %.loc13_17.1 -// CHECK:STDOUT: assign file.%b.var, %.loc13_17.2 -// CHECK:STDOUT: %a.ref.loc18: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc18_16: i32 = int_literal 2147483647 [template = constants.%.8] -// CHECK:STDOUT: %.loc18_27.1: ref i32 = array_index %a.ref.loc18, %.loc18_16 [template = ] -// CHECK:STDOUT: %.loc18_27.2: i32 = bind_value %.loc18_27.1 -// CHECK:STDOUT: assign file.%c.var, %.loc18_27.2 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.1: (i32,) = tuple_literal (%.loc11_20) +// CHECK:STDOUT: %.loc11_23.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 +// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.5: init [i32; 1] = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init [i32; 1] = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_24 +// CHECK:STDOUT: %a.ref.loc17: ref [i32; 1] = name_ref a, file.%a +// CHECK:STDOUT: %.loc17_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_17.1: ref i32 = array_index %a.ref.loc17, %.loc17_16 [template = ] +// CHECK:STDOUT: %.loc17_17.2: i32 = bind_value %.loc17_17.1 +// CHECK:STDOUT: assign file.%b.var, %.loc17_17.2 +// CHECK:STDOUT: %a.ref.loc22: ref [i32; 1] = name_ref a, file.%a +// CHECK:STDOUT: %.loc22_16: i32 = int_literal 2147483647 [template = constants.%.8] +// CHECK:STDOUT: %.loc22_27.1: ref i32 = array_index %a.ref.loc22, %.loc22_16 [template = ] +// CHECK:STDOUT: %.loc22_27.2: i32 = bind_value %.loc22_27.1 +// CHECK:STDOUT: assign file.%c.var, %.loc22_27.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon index bebbecc4f20b..1a7996e4ea63 100644 --- a/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_array_non_int_indexing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_array_non_int_indexing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_non_int_indexing.carbon var a: [i32; 1] = (12,); // CHECK:STDERR: fail_array_non_int_indexing.carbon:[[@LINE+3]]:16: ERROR: Cannot implicitly convert from `f64` to `i32`. @@ -34,17 +38,17 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -53,19 +57,19 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_24 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.1: (i32,) = tuple_literal (%.loc11_20) +// CHECK:STDOUT: %.loc11_23.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 +// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.5: init [i32; 1] = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init [i32; 1] = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_24 // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_19.1: ref i32 = array_index %a.ref, -// CHECK:STDOUT: %.loc11_19.2: i32 = bind_value %.loc11_19.1 -// CHECK:STDOUT: assign file.%b.var, %.loc11_19.2 +// CHECK:STDOUT: %.loc15_16: f64 = float_literal 2.6000000000000001 [template = constants.%.8] +// CHECK:STDOUT: %.loc15_19.1: ref i32 = array_index %a.ref, +// CHECK:STDOUT: %.loc15_19.2: i32 = bind_value %.loc15_19.1 +// CHECK:STDOUT: assign file.%b.var, %.loc15_19.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon index e6f011f2a9b7..8c2cee2d6809 100644 --- a/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_array_out_of_bound_access.carbon var a: [i32; 1] = (12,); // CHECK:STDERR: fail_array_out_of_bound_access.carbon:[[@LINE+3]]:16: ERROR: Array index `1` is past the end of type `[i32; 1]`. @@ -33,17 +37,17 @@ var b: i32 = a[1]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %.loc7_15: type = array_type %.loc7_14, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %.loc11_15: type = array_type %.loc11_14, i32 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref [i32; 1] = var a // CHECK:STDOUT: %a: ref [i32; 1] = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -52,19 +56,19 @@ var b: i32 = a[1]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_20: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.1: (i32,) = tuple_literal (%.loc7_20) -// CHECK:STDOUT: %.loc7_23.2: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_23.3: ref i32 = array_index file.%a.var, %.loc7_23.2 -// CHECK:STDOUT: %.loc7_23.4: init i32 = initialize_from %.loc7_20 to %.loc7_23.3 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_23.5: init [i32; 1] = array_init (%.loc7_23.4) to file.%a.var [template = constants.%array] -// CHECK:STDOUT: %.loc7_24: init [i32; 1] = converted %.loc7_23.1, %.loc7_23.5 [template = constants.%array] -// CHECK:STDOUT: assign file.%a.var, %.loc7_24 +// CHECK:STDOUT: %.loc11_20: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.1: (i32,) = tuple_literal (%.loc11_20) +// CHECK:STDOUT: %.loc11_23.2: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_23.3: ref i32 = array_index file.%a.var, %.loc11_23.2 +// CHECK:STDOUT: %.loc11_23.4: init i32 = initialize_from %.loc11_20 to %.loc11_23.3 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_23.5: init [i32; 1] = array_init (%.loc11_23.4) to file.%a.var [template = constants.%array] +// CHECK:STDOUT: %.loc11_24: init [i32; 1] = converted %.loc11_23.1, %.loc11_23.5 [template = constants.%array] +// CHECK:STDOUT: assign file.%a.var, %.loc11_24 // CHECK:STDOUT: %a.ref: ref [i32; 1] = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_17.1: ref i32 = array_index %a.ref, %.loc11_16 [template = ] -// CHECK:STDOUT: %.loc11_17.2: i32 = bind_value %.loc11_17.1 -// CHECK:STDOUT: assign file.%b.var, %.loc11_17.2 +// CHECK:STDOUT: %.loc15_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_17.1: ref i32 = array_index %a.ref, %.loc15_16 [template = ] +// CHECK:STDOUT: %.loc15_17.2: i32 = bind_value %.loc15_17.1 +// CHECK:STDOUT: assign file.%b.var, %.loc15_17.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon index 76b8b3904b65..8f853fda6df5 100644 --- a/toolchain/check/testdata/index/fail_empty_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_empty_tuple_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_empty_tuple_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_empty_tuple_access.carbon fn F() {} @@ -44,10 +48,10 @@ fn Run() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.1] // CHECK:STDOUT: %F.call: init () = call %F.ref() -// CHECK:STDOUT: %.loc13_7: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc13_4.1: ref () = temporary_storage -// CHECK:STDOUT: %.loc13_4.2: ref () = temporary %.loc13_4.1, %F.call -// CHECK:STDOUT: %.loc13_8: ref = tuple_index %.loc13_4.2, +// CHECK:STDOUT: %.loc17_7: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc17_4.1: ref () = temporary_storage +// CHECK:STDOUT: %.loc17_4.2: ref () = temporary %.loc17_4.1, %F.call +// CHECK:STDOUT: %.loc17_8: ref = tuple_index %.loc17_4.2, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_expr_category.carbon b/toolchain/check/testdata/index/fail_expr_category.carbon index db2f106aa679..a67cec35f849 100644 --- a/toolchain/check/testdata/index/fail_expr_category.carbon +++ b/toolchain/check/testdata/index/fail_expr_category.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_expr_category.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_expr_category.carbon fn F() -> [i32; 3]; @@ -59,22 +63,22 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc7_12.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_12.2: type = converted %int.make_type_32.loc7, %.loc7_12.1 [template = i32] -// CHECK:STDOUT: %.loc7_18: type = array_type %.loc7_17, i32 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc11_12.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_12.2: type = converted %int.make_type_32.loc11, %.loc11_12.1 [template = i32] +// CHECK:STDOUT: %.loc11_18: type = array_type %.loc11_17, i32 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref [i32; 3] = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_16: type = array_type %.loc9_15, i32 [template = constants.%.3] -// CHECK:STDOUT: %b.loc9_6.1: [i32; 3] = param b -// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc9_6.1 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_15: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_16: type = array_type %.loc13_15, i32 [template = constants.%.3] +// CHECK:STDOUT: %b.loc13_6.1: [i32; 3] = param b +// CHECK:STDOUT: @G.%b: [i32; 3] = bind_name b, %b.loc13_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -86,50 +90,50 @@ fn G(b: [i32; 3]) { // CHECK:STDOUT: // CHECK:STDOUT: fn @G(%b: [i32; 3]) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] -// CHECK:STDOUT: %.loc15_14.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc19_14.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_14.2: type = converted %int.make_type_32.loc19, %.loc19_14.1 [template = i32] +// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pb.var: ref i32* = var pb // CHECK:STDOUT: %pb: ref i32* = bind_name pb, %pb.var -// CHECK:STDOUT: %b.ref.loc15: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc15_22.1: ref [i32; 3] = value_as_ref %b.ref.loc15 -// CHECK:STDOUT: %.loc15_22.2: ref i32 = array_index %.loc15_22.1, %.loc15_21 -// CHECK:STDOUT: %.loc15_22.3: i32 = bind_value %.loc15_22.2 -// CHECK:STDOUT: %.loc15_18: i32* = addr_of [template = ] -// CHECK:STDOUT: assign %pb.var, %.loc15_18 -// CHECK:STDOUT: %b.ref.loc20: [i32; 3] = name_ref b, %b -// CHECK:STDOUT: %.loc20_5: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc20_6.1: ref [i32; 3] = value_as_ref %b.ref.loc20 -// CHECK:STDOUT: %.loc20_6.2: ref i32 = array_index %.loc20_6.1, %.loc20_5 -// CHECK:STDOUT: %.loc20_6.3: i32 = bind_value %.loc20_6.2 -// CHECK:STDOUT: %.loc20_10: i32 = int_literal 4 [template = constants.%.7] -// CHECK:STDOUT: assign %.loc20_6.3, %.loc20_10 -// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc28_14.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] -// CHECK:STDOUT: %.loc28_14.2: type = converted %int.make_type_32.loc28, %.loc28_14.1 [template = i32] -// CHECK:STDOUT: %.loc28_14.3: type = ptr_type i32 [template = constants.%.5] +// CHECK:STDOUT: %b.ref.loc19: [i32; 3] = name_ref b, %b +// CHECK:STDOUT: %.loc19_21: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc19_22.1: ref [i32; 3] = value_as_ref %b.ref.loc19 +// CHECK:STDOUT: %.loc19_22.2: ref i32 = array_index %.loc19_22.1, %.loc19_21 +// CHECK:STDOUT: %.loc19_22.3: i32 = bind_value %.loc19_22.2 +// CHECK:STDOUT: %.loc19_18: i32* = addr_of [template = ] +// CHECK:STDOUT: assign %pb.var, %.loc19_18 +// CHECK:STDOUT: %b.ref.loc24: [i32; 3] = name_ref b, %b +// CHECK:STDOUT: %.loc24_5: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc24_6.1: ref [i32; 3] = value_as_ref %b.ref.loc24 +// CHECK:STDOUT: %.loc24_6.2: ref i32 = array_index %.loc24_6.1, %.loc24_5 +// CHECK:STDOUT: %.loc24_6.3: i32 = bind_value %.loc24_6.2 +// CHECK:STDOUT: %.loc24_10: i32 = int_literal 4 [template = constants.%.7] +// CHECK:STDOUT: assign %.loc24_6.3, %.loc24_10 +// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc32_14.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] +// CHECK:STDOUT: %.loc32_14.2: type = converted %int.make_type_32.loc32, %.loc32_14.1 [template = i32] +// CHECK:STDOUT: %.loc32_14.3: type = ptr_type i32 [template = constants.%.5] // CHECK:STDOUT: %pf.var: ref i32* = var pf // CHECK:STDOUT: %pf: ref i32* = bind_name pf, %pf.var -// CHECK:STDOUT: %F.ref.loc28: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc28_20.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %F.call.loc28: init [i32; 3] = call %F.ref.loc28() to %.loc28_20.1 -// CHECK:STDOUT: %.loc28_23: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc28_20.2: ref [i32; 3] = temporary %.loc28_20.1, %F.call.loc28 -// CHECK:STDOUT: %.loc28_24.1: ref i32 = array_index %.loc28_20.2, %.loc28_23 -// CHECK:STDOUT: %.loc28_24.2: i32 = bind_value %.loc28_24.1 -// CHECK:STDOUT: %.loc28_18: i32* = addr_of [template = ] -// CHECK:STDOUT: assign %pf.var, %.loc28_18 // CHECK:STDOUT: %F.ref.loc32: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc32_4.1: ref [i32; 3] = temporary_storage -// CHECK:STDOUT: %F.call.loc32: init [i32; 3] = call %F.ref.loc32() to %.loc32_4.1 -// CHECK:STDOUT: %.loc32_7: i32 = int_literal 0 [template = constants.%.6] -// CHECK:STDOUT: %.loc32_4.2: ref [i32; 3] = temporary %.loc32_4.1, %F.call.loc32 -// CHECK:STDOUT: %.loc32_8.1: ref i32 = array_index %.loc32_4.2, %.loc32_7 -// CHECK:STDOUT: %.loc32_8.2: i32 = bind_value %.loc32_8.1 -// CHECK:STDOUT: %.loc32_12: i32 = int_literal 4 [template = constants.%.7] -// CHECK:STDOUT: assign %.loc32_8.2, %.loc32_12 +// CHECK:STDOUT: %.loc32_20.1: ref [i32; 3] = temporary_storage +// CHECK:STDOUT: %F.call.loc32: init [i32; 3] = call %F.ref.loc32() to %.loc32_20.1 +// CHECK:STDOUT: %.loc32_23: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc32_20.2: ref [i32; 3] = temporary %.loc32_20.1, %F.call.loc32 +// CHECK:STDOUT: %.loc32_24.1: ref i32 = array_index %.loc32_20.2, %.loc32_23 +// CHECK:STDOUT: %.loc32_24.2: i32 = bind_value %.loc32_24.1 +// CHECK:STDOUT: %.loc32_18: i32* = addr_of [template = ] +// CHECK:STDOUT: assign %pf.var, %.loc32_18 +// CHECK:STDOUT: %F.ref.loc36: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc36_4.1: ref [i32; 3] = temporary_storage +// CHECK:STDOUT: %F.call.loc36: init [i32; 3] = call %F.ref.loc36() to %.loc36_4.1 +// CHECK:STDOUT: %.loc36_7: i32 = int_literal 0 [template = constants.%.6] +// CHECK:STDOUT: %.loc36_4.2: ref [i32; 3] = temporary %.loc36_4.1, %F.call.loc36 +// CHECK:STDOUT: %.loc36_8.1: ref i32 = array_index %.loc36_4.2, %.loc36_7 +// CHECK:STDOUT: %.loc36_8.2: i32 = bind_value %.loc36_8.1 +// CHECK:STDOUT: %.loc36_12: i32 = int_literal 4 [template = constants.%.7] +// CHECK:STDOUT: assign %.loc36_8.2, %.loc36_12 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_invalid_base.carbon b/toolchain/check/testdata/index/fail_invalid_base.carbon index 83fc32df3289..301130408f02 100644 --- a/toolchain/check/testdata/index/fail_invalid_base.carbon +++ b/toolchain/check/testdata/index/fail_invalid_base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_invalid_base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_invalid_base.carbon namespace N; // CHECK:STDERR: fail_invalid_base.carbon:[[@LINE+4]]:14: ERROR: Expression cannot be used as a value. @@ -58,28 +62,28 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %N: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_8.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_8.2: type = converted %int.make_type_32.loc16, %.loc16_8.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_8.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] -// CHECK:STDOUT: %.loc19_8.2: type = converted %int.make_type_32.loc19, %.loc19_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_8.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_8.2: type = converted %int.make_type_32.loc23, %.loc23_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_8.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_8.2: type = converted %int.make_type_32.loc25, %.loc25_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_8.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_8.2: type = converted %int.make_type_32.loc29, %.loc29_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc30: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc30_8.1: type = value_of_initializer %int.make_type_32.loc30 [template = i32] -// CHECK:STDOUT: %.loc30_8.2: type = converted %int.make_type_32.loc30, %.loc30_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_8.1: type = value_of_initializer %int.make_type_32.loc34 [template = i32] +// CHECK:STDOUT: %.loc34_8.2: type = converted %int.make_type_32.loc34, %.loc34_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -93,26 +97,26 @@ var d: i32 = {.a: i32, .b: i32}[0]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %N.ref: = name_ref N, file.%N [template = file.%N] -// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc16: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%a.var, // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc23: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: assign file.%b.var, -// CHECK:STDOUT: %.loc25_20: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc25_28: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: %.loc25_29.1: {.a: i32, .b: i32} = struct_literal (%.loc25_20, %.loc25_28) -// CHECK:STDOUT: %.loc25_31: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc25_20, %.loc25_28) [template = constants.%struct.3] -// CHECK:STDOUT: %.loc25_29.2: {.a: i32, .b: i32} = converted %.loc25_29.1, %struct [template = constants.%struct.3] +// CHECK:STDOUT: %.loc29_20: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc29_28: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc29_29.1: {.a: i32, .b: i32} = struct_literal (%.loc29_20, %.loc29_28) +// CHECK:STDOUT: %.loc29_31: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc29_20, %.loc29_28) [template = constants.%struct.3] +// CHECK:STDOUT: %.loc29_29.2: {.a: i32, .b: i32} = converted %.loc29_29.1, %struct [template = constants.%struct.3] // CHECK:STDOUT: assign file.%c.var, -// CHECK:STDOUT: %int.make_type_32.loc30_19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc30_19.1: type = value_of_initializer %int.make_type_32.loc30_19 [template = i32] -// CHECK:STDOUT: %.loc30_19.2: type = converted %int.make_type_32.loc30_19, %.loc30_19.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc30_28: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc30_28.1: type = value_of_initializer %int.make_type_32.loc30_28 [template = i32] -// CHECK:STDOUT: %.loc30_28.2: type = converted %int.make_type_32.loc30_28, %.loc30_28.1 [template = i32] -// CHECK:STDOUT: %.loc30_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.5] -// CHECK:STDOUT: %.loc30_33: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc34_19: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_19.1: type = value_of_initializer %int.make_type_32.loc34_19 [template = i32] +// CHECK:STDOUT: %.loc34_19.2: type = converted %int.make_type_32.loc34_19, %.loc34_19.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc34_28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc34_28.1: type = value_of_initializer %int.make_type_32.loc34_28 [template = i32] +// CHECK:STDOUT: %.loc34_28.2: type = converted %int.make_type_32.loc34_28, %.loc34_28.1 [template = i32] +// CHECK:STDOUT: %.loc34_31: type = struct_type {.a: i32, .b: i32} [template = constants.%.5] +// CHECK:STDOUT: %.loc34_33: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_name_not_found.carbon b/toolchain/check/testdata/index/fail_name_not_found.carbon index 59a103b0aa81..d853dcf23e4a 100644 --- a/toolchain/check/testdata/index/fail_name_not_found.carbon +++ b/toolchain/check/testdata/index/fail_name_not_found.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_name_not_found.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_name_not_found.carbon fn Main() { // CHECK:STDERR: fail_name_not_found.carbon:[[@LINE+3]]:16: ERROR: Name `a` not found. @@ -35,12 +39,12 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] -// CHECK:STDOUT: %.loc11_18: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: assign %b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_negative_indexing.carbon b/toolchain/check/testdata/index/fail_negative_indexing.carbon index eb8f467ec147..6c0a08afccb4 100644 --- a/toolchain/check/testdata/index/fail_negative_indexing.carbon +++ b/toolchain/check/testdata/index/fail_negative_indexing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_negative_indexing.carbon var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_negative_indexing.carbon:[[@LINE+3]]:16: ERROR: Cannot access member of interface Negate in type i32 that does not implement that interface. @@ -39,21 +43,21 @@ var b: i32 = a[-10]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: %import_ref.4: type = import_ref ir4, inst+67, loaded [template = constants.%.8] @@ -76,19 +80,19 @@ var b: i32 = a[-10]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.6: init (i32, i32) = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init (i32, i32) = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_17: i32 = int_literal 10 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_19: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc15_17: i32 = int_literal 10 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_19: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon index 4f3052ec5b97..0384cbb6d9c4 100644 --- a/toolchain/check/testdata/index/fail_non_deterministic_type.carbon +++ b/toolchain/check/testdata/index/fail_non_deterministic_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_non_deterministic_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_non_deterministic_type.carbon var a: (i32, i32) = (2, 3); var b: i32 = 0; @@ -35,27 +39,27 @@ var c: i32 = a[b]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] -// CHECK:STDOUT: %b.var: ref i32 = var b -// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var -// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] // CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] +// CHECK:STDOUT: %b.var: ref i32 = var b +// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_8.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_8.2: type = converted %int.make_type_32.loc16, %.loc16_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: } @@ -64,22 +68,22 @@ var c: i32 = a[b]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 3 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) -// CHECK:STDOUT: %.loc7_26.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_26.3: init i32 = initialize_from %.loc7_22 to %.loc7_26.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_26.5: init i32 = initialize_from %.loc7_25 to %.loc7_26.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_26.6: init (i32, i32) = tuple_init (%.loc7_26.3, %.loc7_26.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27: init (i32, i32) = converted %.loc7_26.1, %.loc7_26.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_27 -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: assign file.%b.var, %.loc8 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_25: i32 = int_literal 3 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_25) +// CHECK:STDOUT: %.loc11_26.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_26.3: init i32 = initialize_from %.loc11_22 to %.loc11_26.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_26.5: init i32 = initialize_from %.loc11_25 to %.loc11_26.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_26.6: init (i32, i32) = tuple_init (%.loc11_26.3, %.loc11_26.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27: init (i32, i32) = converted %.loc11_26.1, %.loc11_26.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_27 +// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: assign file.%b.var, %.loc12 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a // CHECK:STDOUT: %b.ref: ref i32 = name_ref b, file.%b -// CHECK:STDOUT: %.loc12_16: i32 = bind_value %b.ref -// CHECK:STDOUT: %.loc12_17: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc16_16: i32 = bind_value %b.ref +// CHECK:STDOUT: %.loc16_17: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%c.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_non_tuple_access.carbon b/toolchain/check/testdata/index/fail_non_tuple_access.carbon index 8855ebc306bc..923db4b1299c 100644 --- a/toolchain/check/testdata/index/fail_non_tuple_access.carbon +++ b/toolchain/check/testdata/index/fail_non_tuple_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_non_tuple_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_non_tuple_access.carbon fn Main() { // CHECK:STDERR: fail_non_tuple_access.carbon:[[@LINE+3]]:3: ERROR: Type `i32` does not support indexing. @@ -32,8 +36,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_3: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_5: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_3: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_5: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon b/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon index f4852c88cb4a..8edc1d14240a 100644 --- a/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon +++ b/toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_out_of_bound_not_literal.carbon var a: (i32, i32) = (12, 34); // CHECK:STDERR: fail_out_of_bound_not_literal.carbon:[[@LINE+3]]:14: ERROR: Tuple element index `2` is past the end of type `(i32, i32)`. @@ -35,21 +39,21 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -58,23 +62,23 @@ var b: i32 = a[{.index = 2}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_28.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_28.6: init (i32, i32) = tuple_init (%.loc7_28.3, %.loc7_28.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_29: init (i32, i32) = converted %.loc7_28.1, %.loc7_28.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_29 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 34 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_22 to %.loc11_28.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_26 to %.loc11_28.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28.6: init (i32, i32) = tuple_init (%.loc11_28.3, %.loc11_28.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: init (i32, i32) = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_29 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_26: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_27.1: {.index: i32} = struct_literal (%.loc11_26) -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc11_26) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11_27.2: {.index: i32} = converted %.loc11_27.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc11_28: i32 = struct_access %.loc11_27.2, element0 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_34: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc15_26: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_27.1: {.index: i32} = struct_literal (%.loc15_26) +// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc15_26) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_27.2: {.index: i32} = converted %.loc15_27.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc15_28: i32 = struct_access %.loc15_27.2, element0 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_34: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_index_error.carbon b/toolchain/check/testdata/index/fail_tuple_index_error.carbon index ba093ed53778..19c54283c2bf 100644 --- a/toolchain/check/testdata/index/fail_tuple_index_error.carbon +++ b/toolchain/check/testdata/index/fail_tuple_index_error.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_tuple_index_error.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_tuple_index_error.carbon var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_tuple_index_error.carbon:[[@LINE+3]]:16: ERROR: Name `oops` not found. @@ -32,21 +36,21 @@ var b: i32 = a[oops]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -55,19 +59,19 @@ var b: i32 = a[oops]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.6: init (i32, i32) = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init (i32, i32) = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a // CHECK:STDOUT: %oops.ref: = name_ref oops, [template = ] -// CHECK:STDOUT: %.loc11: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc15: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_large_index.carbon b/toolchain/check/testdata/index/fail_tuple_large_index.carbon index 4f56985939bc..d7662989370f 100644 --- a/toolchain/check/testdata/index/fail_tuple_large_index.carbon +++ b/toolchain/check/testdata/index/fail_tuple_large_index.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_tuple_large_index.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_tuple_large_index.carbon var a: (i32,) = (12,); var b: (i32,) = a; @@ -40,31 +44,31 @@ var d: i32 = b[0x7FFF_FFFF]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] -// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: (type,) = tuple_literal (%int.make_type_32.loc11) +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.3: type = converted %int.make_type_32.loc11, %.loc11_13.2 [template = i32] +// CHECK:STDOUT: %.loc11_13.4: type = converted %.loc11_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) -// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] -// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: (type,) = tuple_literal (%int.make_type_32.loc12) +// CHECK:STDOUT: %.loc12_13.2: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.3: type = converted %int.make_type_32.loc12, %.loc12_13.2 [template = i32] +// CHECK:STDOUT: %.loc12_13.4: type = converted %.loc12_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref (i32,) = var b // CHECK:STDOUT: %b: ref (i32,) = bind_name b, %b.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] -// CHECK:STDOUT: %c.var: ref i32 = var c -// CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var -// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %.loc17_8.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] // CHECK:STDOUT: %.loc17_8.2: type = converted %int.make_type_32.loc17, %.loc17_8.1 [template = i32] +// CHECK:STDOUT: %c.var: ref i32 = var c +// CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc21_8.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_8.2: type = converted %int.make_type_32.loc21, %.loc21_8.1 [template = i32] // CHECK:STDOUT: %d.var: ref i32 = var d // CHECK:STDOUT: %d: ref i32 = bind_name d, %d.var // CHECK:STDOUT: } @@ -73,24 +77,24 @@ var d: i32 = b[0x7FFF_FFFF]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) -// CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_22: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_22 +// CHECK:STDOUT: %.loc11_18: i32 = int_literal 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_21.1: (i32,) = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_21.2: init (i32,) = tuple_init (%.loc11_18) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: init (i32,) = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_22 // CHECK:STDOUT: %a.ref: ref (i32,) = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_17.1: ref i32 = tuple_access %a.ref, element0 -// CHECK:STDOUT: %.loc8_17.2: i32 = bind_value %.loc8_17.1 -// CHECK:STDOUT: %.loc8_17.3: init (i32,) = tuple_init (%.loc8_17.2) to file.%b.var -// CHECK:STDOUT: %.loc8_18: init (i32,) = converted %a.ref, %.loc8_17.3 -// CHECK:STDOUT: assign file.%b.var, %.loc8_18 -// CHECK:STDOUT: %b.ref.loc13: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc13_16: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_17: ref = tuple_index %b.ref.loc13, -// CHECK:STDOUT: assign file.%c.var, +// CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %a.ref, element0 +// CHECK:STDOUT: %.loc12_17.2: i32 = bind_value %.loc12_17.1 +// CHECK:STDOUT: %.loc12_17.3: init (i32,) = tuple_init (%.loc12_17.2) to file.%b.var +// CHECK:STDOUT: %.loc12_18: init (i32,) = converted %a.ref, %.loc12_17.3 +// CHECK:STDOUT: assign file.%b.var, %.loc12_18 // CHECK:STDOUT: %b.ref.loc17: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc17_16: i32 = int_literal 2147483647 [template = constants.%.6] -// CHECK:STDOUT: %.loc17_27: ref = tuple_index %b.ref.loc17, +// CHECK:STDOUT: %.loc17_16: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_17: ref = tuple_index %b.ref.loc17, +// CHECK:STDOUT: assign file.%c.var, +// CHECK:STDOUT: %b.ref.loc21: ref (i32,) = name_ref b, file.%b +// CHECK:STDOUT: %.loc21_16: i32 = int_literal 2147483647 [template = constants.%.6] +// CHECK:STDOUT: %.loc21_27: ref = tuple_index %b.ref.loc21, // CHECK:STDOUT: assign file.%d.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon index af80e48d91c8..2a7901e55cfd 100644 --- a/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon +++ b/toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_tuple_non_int_indexing.carbon var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_tuple_non_int_indexing.carbon:[[@LINE+3]]:16: ERROR: Cannot implicitly convert from `f64` to `i32`. @@ -33,21 +37,21 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -56,19 +60,19 @@ var b: i32 = a[2.6]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.6: init (i32, i32) = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init (i32, i32) = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: f64 = float_literal 2.6000000000000001 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_19: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc15_16: f64 = float_literal 2.6000000000000001 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_19: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon index e3d5df2c58c2..c3cdc9bece6d 100644 --- a/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon +++ b/toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/fail_tuple_out_of_bound_access.carbon var a: (i32, i32) = (12, 6); // CHECK:STDERR: fail_tuple_out_of_bound_access.carbon:[[@LINE+3]]:14: ERROR: Tuple element index `2` is past the end of type `(i32, i32)`. @@ -33,21 +37,21 @@ var b: i32 = a[2]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -56,19 +60,19 @@ var b: i32 = a[2]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 6 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_27.3: init i32 = initialize_from %.loc7_22 to %.loc7_27.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_27.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_27.5: init i32 = initialize_from %.loc7_26 to %.loc7_27.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_27.6: init (i32, i32) = tuple_init (%.loc7_27.3, %.loc7_27.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_28: init (i32, i32) = converted %.loc7_27.1, %.loc7_27.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 6 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_27.3: init i32 = initialize_from %.loc11_22 to %.loc11_27.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_27.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_27.5: init i32 = initialize_from %.loc11_26 to %.loc11_27.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_27.6: init (i32, i32) = tuple_init (%.loc11_27.3, %.loc11_27.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_28: init (i32, i32) = converted %.loc11_27.1, %.loc11_27.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_28 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc11_16: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_17: ref = tuple_index %a.ref, +// CHECK:STDOUT: %.loc15_16: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_17: ref = tuple_index %a.ref, // CHECK:STDOUT: assign file.%b.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/index/index_not_literal.carbon b/toolchain/check/testdata/index/index_not_literal.carbon index 94bef88bd47d..801a38033325 100644 --- a/toolchain/check/testdata/index/index_not_literal.carbon +++ b/toolchain/check/testdata/index/index_not_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/index_not_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/index_not_literal.carbon var a: (i32, i32) = (12, 34); var b: i32 = a[{.index = 1}.index]; @@ -32,21 +36,21 @@ var b: i32 = a[{.index = 1}.index]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) +// CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_17.3: type = converted %int.make_type_32.loc11_9, %.loc11_17.2 [template = i32] +// CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] +// CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] +// CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32, i32) = var a // CHECK:STDOUT: %a: ref (i32, i32) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %b.var: ref i32 = var b // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var // CHECK:STDOUT: } @@ -55,25 +59,25 @@ var b: i32 = a[{.index = 1}.index]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 12 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 34 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_28.1: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_26) -// CHECK:STDOUT: %.loc7_28.2: ref i32 = tuple_access file.%a.var, element0 -// CHECK:STDOUT: %.loc7_28.3: init i32 = initialize_from %.loc7_22 to %.loc7_28.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_28.4: ref i32 = tuple_access file.%a.var, element1 -// CHECK:STDOUT: %.loc7_28.5: init i32 = initialize_from %.loc7_26 to %.loc7_28.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_28.6: init (i32, i32) = tuple_init (%.loc7_28.3, %.loc7_28.5) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_29: init (i32, i32) = converted %.loc7_28.1, %.loc7_28.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_29 +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 12 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 34 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28.1: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_26) +// CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access file.%a.var, element0 +// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_22 to %.loc11_28.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access file.%a.var, element1 +// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_26 to %.loc11_28.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28.6: init (i32, i32) = tuple_init (%.loc11_28.3, %.loc11_28.5) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: init (i32, i32) = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_29 // CHECK:STDOUT: %a.ref: ref (i32, i32) = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_26: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_27.1: {.index: i32} = struct_literal (%.loc8_26) -// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc8_26) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_27.2: {.index: i32} = converted %.loc8_27.1, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %.loc8_28: i32 = struct_access %.loc8_27.2, element0 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_34.1: ref i32 = tuple_index %a.ref, %.loc8_28 -// CHECK:STDOUT: %.loc8_34.2: i32 = bind_value %.loc8_34.1 -// CHECK:STDOUT: assign file.%b.var, %.loc8_34.2 +// CHECK:STDOUT: %.loc12_26: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_27.1: {.index: i32} = struct_literal (%.loc12_26) +// CHECK:STDOUT: %struct: {.index: i32} = struct_value (%.loc12_26) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_27.2: {.index: i32} = converted %.loc12_27.1, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %.loc12_28: i32 = struct_access %.loc12_27.2, element0 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_34.1: ref i32 = tuple_index %a.ref, %.loc12_28 +// CHECK:STDOUT: %.loc12_34.2: i32 = bind_value %.loc12_34.1 +// CHECK:STDOUT: assign file.%b.var, %.loc12_34.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/tuple_element_access.carbon b/toolchain/check/testdata/index/tuple_element_access.carbon index 8586a7a23811..4b90d387b988 100644 --- a/toolchain/check/testdata/index/tuple_element_access.carbon +++ b/toolchain/check/testdata/index/tuple_element_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/tuple_element_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/tuple_element_access.carbon var a: (i32,) = (12,); var b: (i32,) = a; @@ -30,25 +34,25 @@ var c: i32 = b[0]; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] -// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: (type,) = tuple_literal (%int.make_type_32.loc11) +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.3: type = converted %int.make_type_32.loc11, %.loc11_13.2 [template = i32] +// CHECK:STDOUT: %.loc11_13.4: type = converted %.loc11_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %a.var: ref (i32,) = var a // CHECK:STDOUT: %a: ref (i32,) = bind_name a, %a.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) -// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] -// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: (type,) = tuple_literal (%int.make_type_32.loc12) +// CHECK:STDOUT: %.loc12_13.2: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.3: type = converted %int.make_type_32.loc12, %.loc12_13.2 [template = i32] +// CHECK:STDOUT: %.loc12_13.4: type = converted %.loc12_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %b.var: ref (i32,) = var b // CHECK:STDOUT: %b: ref (i32,) = bind_name b, %b.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %c.var: ref i32 = var c // CHECK:STDOUT: %c: ref i32 = bind_name c, %c.var // CHECK:STDOUT: } @@ -57,22 +61,22 @@ var c: i32 = b[0]; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 12 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_21.1: (i32,) = tuple_literal (%.loc7_18) -// CHECK:STDOUT: %.loc7_21.2: init (i32,) = tuple_init (%.loc7_18) to file.%a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_22: init (i32,) = converted %.loc7_21.1, %.loc7_21.2 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%a.var, %.loc7_22 +// CHECK:STDOUT: %.loc11_18: i32 = int_literal 12 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_21.1: (i32,) = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_21.2: init (i32,) = tuple_init (%.loc11_18) to file.%a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_22: init (i32,) = converted %.loc11_21.1, %.loc11_21.2 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%a.var, %.loc11_22 // CHECK:STDOUT: %a.ref: ref (i32,) = name_ref a, file.%a -// CHECK:STDOUT: %.loc8_17.1: ref i32 = tuple_access %a.ref, element0 -// CHECK:STDOUT: %.loc8_17.2: i32 = bind_value %.loc8_17.1 -// CHECK:STDOUT: %.loc8_17.3: init (i32,) = tuple_init (%.loc8_17.2) to file.%b.var -// CHECK:STDOUT: %.loc8_18: init (i32,) = converted %a.ref, %.loc8_17.3 -// CHECK:STDOUT: assign file.%b.var, %.loc8_18 +// CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %a.ref, element0 +// CHECK:STDOUT: %.loc12_17.2: i32 = bind_value %.loc12_17.1 +// CHECK:STDOUT: %.loc12_17.3: init (i32,) = tuple_init (%.loc12_17.2) to file.%b.var +// CHECK:STDOUT: %.loc12_18: init (i32,) = converted %a.ref, %.loc12_17.3 +// CHECK:STDOUT: assign file.%b.var, %.loc12_18 // CHECK:STDOUT: %b.ref: ref (i32,) = name_ref b, file.%b -// CHECK:STDOUT: %.loc9_16: i32 = int_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_17.1: ref i32 = tuple_index %b.ref, %.loc9_16 -// CHECK:STDOUT: %.loc9_17.2: i32 = bind_value %.loc9_17.1 -// CHECK:STDOUT: assign file.%c.var, %.loc9_17.2 +// CHECK:STDOUT: %.loc13_16: i32 = int_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_17.1: ref i32 = tuple_index %b.ref, %.loc13_16 +// CHECK:STDOUT: %.loc13_17.2: i32 = bind_value %.loc13_17.1 +// CHECK:STDOUT: assign file.%c.var, %.loc13_17.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/index/tuple_return_value_access.carbon b/toolchain/check/testdata/index/tuple_return_value_access.carbon index fbbe78f68e87..fdf32fd36313 100644 --- a/toolchain/check/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/check/testdata/index/tuple_return_value_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/index/tuple_return_value_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/index/tuple_return_value_access.carbon fn F() -> (i32,) { return (0,); } @@ -35,18 +39,18 @@ fn Run() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_16.1: (type,) = tuple_literal (%int.make_type_32.loc7) -// CHECK:STDOUT: %.loc7_16.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_16.3: type = converted %int.make_type_32.loc7, %.loc7_16.2 [template = i32] -// CHECK:STDOUT: %.loc7_16.4: type = converted %.loc7_16.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_16.1: (type,) = tuple_literal (%int.make_type_32.loc11) +// CHECK:STDOUT: %.loc11_16.2: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_16.3: type = converted %int.make_type_32.loc11, %.loc11_16.2 [template = i32] +// CHECK:STDOUT: %.loc11_16.4: type = converted %.loc11_16.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32,) = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Run.decl: Run = fn_decl @Run [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] // CHECK:STDOUT: @Run.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -55,22 +59,22 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> (i32,) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_28: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_30: (i32,) = tuple_literal (%.loc7_28) -// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc7_28) [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_31: (i32,) = converted %.loc7_30, %tuple [template = constants.%tuple] -// CHECK:STDOUT: return %.loc7_31 +// CHECK:STDOUT: %.loc11_28: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_30: (i32,) = tuple_literal (%.loc11_28) +// CHECK:STDOUT: %tuple: (i32,) = tuple_value (%.loc11_28) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_31: (i32,) = converted %.loc11_30, %tuple [template = constants.%tuple] +// CHECK:STDOUT: return %.loc11_31 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Run() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init (i32,) = call %F.ref() -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 0 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_11.1: ref (i32,) = temporary_storage -// CHECK:STDOUT: %.loc10_11.2: ref (i32,) = temporary %.loc10_11.1, %F.call -// CHECK:STDOUT: %.loc10_15.1: ref i32 = tuple_index %.loc10_11.2, %.loc10_14 -// CHECK:STDOUT: %.loc10_15.2: i32 = bind_value %.loc10_15.1 -// CHECK:STDOUT: return %.loc10_15.2 +// CHECK:STDOUT: %.loc14_14: i32 = int_literal 0 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_11.1: ref (i32,) = temporary_storage +// CHECK:STDOUT: %.loc14_11.2: ref (i32,) = temporary %.loc14_11.1, %F.call +// CHECK:STDOUT: %.loc14_15.1: ref i32 = tuple_index %.loc14_11.2, %.loc14_14 +// CHECK:STDOUT: %.loc14_15.2: i32 = bind_value %.loc14_15.1 +// CHECK:STDOUT: return %.loc14_15.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/assoc_const.carbon b/toolchain/check/testdata/interface/assoc_const.carbon index 2e99e8d2f9c9..f521cc1037f8 100644 --- a/toolchain/check/testdata/interface/assoc_const.carbon +++ b/toolchain/check/testdata/interface/assoc_const.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/assoc_const.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/assoc_const.carbon interface I { let T:! type; @@ -36,17 +40,17 @@ interface I { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %T [template = constants.%.3] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %T [template = constants.%.3] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32, %.loc9_11.1 [template = i32] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32, %.loc13_11.1 [template = i32] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc9_14: = assoc_entity element1, %N [template = constants.%.6] +// CHECK:STDOUT: %.loc13_14: = assoc_entity element1, %N [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc8 -// CHECK:STDOUT: .N = %.loc9_14 +// CHECK:STDOUT: .T = %.loc12 +// CHECK:STDOUT: .N = %.loc13_14 // CHECK:STDOUT: witness = (%T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon index bc3ca0c886fd..05d256f88018 100644 --- a/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +++ b/toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_assoc_const_bad_default.carbon interface I { // CHECK:STDERR: fail_assoc_const_bad_default.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `i32` to `type`. @@ -32,13 +36,13 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc11_18: i32 = int_literal 42 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_18: i32 = int_literal 42 [template = constants.%.2] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc11_20: = assoc_entity element0, %T [template = constants.%.4] +// CHECK:STDOUT: %.loc15_20: = assoc_entity element0, %T [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc11_20 +// CHECK:STDOUT: .T = %.loc15_20 // CHECK:STDOUT: witness = (%T) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon index 4cf4bb58d9a8..561348ed2d08 100644 --- a/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +++ b/toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_assoc_const_default.carbon interface I { // CHECK:STDERR: fail_todo_assoc_const_default.carbon:[[@LINE+4]]:3: ERROR: Semantics TODO: `interface modifier`. @@ -47,27 +51,27 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] -// CHECK:STDOUT: %int.make_type_32.loc12_27: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc12_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc12_35: (type, type) = tuple_literal (%int.make_type_32.loc12_27, %int.make_type_32.loc12_32) -// CHECK:STDOUT: %.loc12_36.1: type = value_of_initializer %int.make_type_32.loc12_27 [template = i32] -// CHECK:STDOUT: %.loc12_36.2: type = converted %int.make_type_32.loc12_27, %.loc12_36.1 [template = i32] -// CHECK:STDOUT: %.loc12_36.3: type = value_of_initializer %int.make_type_32.loc12_32 [template = i32] -// CHECK:STDOUT: %.loc12_36.4: type = converted %int.make_type_32.loc12_32, %.loc12_36.3 [template = i32] -// CHECK:STDOUT: %.loc12_36.5: type = converted %.loc12_35, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc16_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc16_32: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc16_35: (type, type) = tuple_literal (%int.make_type_32.loc16_27, %int.make_type_32.loc16_32) +// CHECK:STDOUT: %.loc16_36.1: type = value_of_initializer %int.make_type_32.loc16_27 [template = i32] +// CHECK:STDOUT: %.loc16_36.2: type = converted %int.make_type_32.loc16_27, %.loc16_36.1 [template = i32] +// CHECK:STDOUT: %.loc16_36.3: type = value_of_initializer %int.make_type_32.loc16_32 [template = i32] +// CHECK:STDOUT: %.loc16_36.4: type = converted %int.make_type_32.loc16_32, %.loc16_36.3 [template = i32] +// CHECK:STDOUT: %.loc16_36.5: type = converted %.loc16_35, constants.%.4 [template = constants.%.4] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc12_36.6: = assoc_entity element0, %T [template = constants.%.6] -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32.loc16, %.loc16_19.1 [template = i32] -// CHECK:STDOUT: %.loc16_25: i32 = int_literal 42 [template = constants.%.7] +// CHECK:STDOUT: %.loc16_36.6: = assoc_entity element0, %T [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc20_19.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_19.2: type = converted %int.make_type_32.loc20, %.loc20_19.1 [template = i32] +// CHECK:STDOUT: %.loc20_25: i32 = int_literal 42 [template = constants.%.7] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc16_27: = assoc_entity element1, %N [template = constants.%.9] +// CHECK:STDOUT: %.loc20_27: = assoc_entity element1, %N [template = constants.%.9] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .T = %.loc12_36.6 -// CHECK:STDOUT: .N = %.loc16_27 +// CHECK:STDOUT: .T = %.loc16_36.6 +// CHECK:STDOUT: .N = %.loc20_27 // CHECK:STDOUT: witness = (%T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon index 092bd166b1c2..41c97d396afd 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_inline.carbon interface Interface { // CHECK:STDERR: fail_todo_define_default_fn_inline.carbon:[[@LINE+4]]:3: ERROR: Semantics TODO: `interface modifier`. @@ -50,29 +54,29 @@ interface Interface { // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc16: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc17_19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc17_19.1: type = value_of_initializer %int.make_type_32.loc17_19 [template = i32] -// CHECK:STDOUT: %.loc17_19.2: type = converted %int.make_type_32.loc17_19, %.loc17_19.1 [template = i32] -// CHECK:STDOUT: %a.loc17_16.1: i32 = param a -// CHECK:STDOUT: %a.loc17_16.2: i32 = bind_name a, %a.loc17_16.1 -// CHECK:STDOUT: %int.make_type_32.loc17_27: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc17_27.1: type = value_of_initializer %int.make_type_32.loc17_27 [template = i32] -// CHECK:STDOUT: %.loc17_27.2: type = converted %int.make_type_32.loc17_27, %.loc17_27.1 [template = i32] -// CHECK:STDOUT: %b.loc17_24.1: i32 = param b -// CHECK:STDOUT: %b.loc17_24.2: i32 = bind_name b, %b.loc17_24.1 -// CHECK:STDOUT: %int.make_type_32.loc17_35: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc17_35.1: type = value_of_initializer %int.make_type_32.loc17_35 [template = i32] -// CHECK:STDOUT: %.loc17_35.2: type = converted %int.make_type_32.loc17_35, %.loc17_35.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc21_19.1: type = value_of_initializer %int.make_type_32.loc21_19 [template = i32] +// CHECK:STDOUT: %.loc21_19.2: type = converted %int.make_type_32.loc21_19, %.loc21_19.1 [template = i32] +// CHECK:STDOUT: %a.loc21_16.1: i32 = param a +// CHECK:STDOUT: %a.loc21_16.2: i32 = bind_name a, %a.loc21_16.1 +// CHECK:STDOUT: %int.make_type_32.loc21_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc21_27.1: type = value_of_initializer %int.make_type_32.loc21_27 [template = i32] +// CHECK:STDOUT: %.loc21_27.2: type = converted %int.make_type_32.loc21_27, %.loc21_27.1 [template = i32] +// CHECK:STDOUT: %b.loc21_24.1: i32 = param b +// CHECK:STDOUT: %b.loc21_24.2: i32 = bind_name b, %b.loc21_24.1 +// CHECK:STDOUT: %int.make_type_32.loc21_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc21_35.1: type = value_of_initializer %int.make_type_32.loc21_35 [template = i32] +// CHECK:STDOUT: %.loc21_35.2: type = converted %int.make_type_32.loc21_35, %.loc21_35.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc17_39: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc21_39: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc12 -// CHECK:STDOUT: .G = %.loc17_39 +// CHECK:STDOUT: .F = %.loc16 +// CHECK:STDOUT: .G = %.loc21_39 // CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -83,5 +87,5 @@ interface Interface { // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(@Interface.%a.loc17_16.2: i32, @Interface.%b.loc17_24.2: i32) -> i32 = "int.sadd"; +// CHECK:STDOUT: fn @G(@Interface.%a.loc21_16.2: i32, @Interface.%b.loc21_24.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon index 7e225887328f..93d9570d2967 100644 --- a/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +++ b/toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/fail_todo_define_default_fn_out_of_line.carbon interface Interface { // CHECK:STDERR: fail_todo_define_default_fn_out_of_line.carbon:[[@LINE+4]]:3: ERROR: Semantics TODO: `interface modifier`. @@ -67,24 +71,24 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %.decl.loc28: = fn_decl @.1 [template = constants.%struct.4] {} +// CHECK:STDOUT: %.decl.loc32: = fn_decl @.1 [template = constants.%struct.4] {} // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %.decl.loc36: = fn_decl @.2 [template = constants.%struct.5] { -// CHECK:STDOUT: %int.make_type_32.loc36_19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc36_19.1: type = value_of_initializer %int.make_type_32.loc36_19 [template = i32] -// CHECK:STDOUT: %.loc36_19.2: type = converted %int.make_type_32.loc36_19, %.loc36_19.1 [template = i32] -// CHECK:STDOUT: %a.loc36_16.1: i32 = param a -// CHECK:STDOUT: @.2.%a: i32 = bind_name a, %a.loc36_16.1 -// CHECK:STDOUT: %int.make_type_32.loc36_27: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc36_27.1: type = value_of_initializer %int.make_type_32.loc36_27 [template = i32] -// CHECK:STDOUT: %.loc36_27.2: type = converted %int.make_type_32.loc36_27, %.loc36_27.1 [template = i32] -// CHECK:STDOUT: %b.loc36_24.1: i32 = param b -// CHECK:STDOUT: @.2.%b: i32 = bind_name b, %b.loc36_24.1 -// CHECK:STDOUT: %int.make_type_32.loc36_35: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc36_35.1: type = value_of_initializer %int.make_type_32.loc36_35 [template = i32] -// CHECK:STDOUT: %.loc36_35.2: type = converted %int.make_type_32.loc36_35, %.loc36_35.1 [template = i32] +// CHECK:STDOUT: %.decl.loc40: = fn_decl @.2 [template = constants.%struct.5] { +// CHECK:STDOUT: %int.make_type_32.loc40_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc40_19.1: type = value_of_initializer %int.make_type_32.loc40_19 [template = i32] +// CHECK:STDOUT: %.loc40_19.2: type = converted %int.make_type_32.loc40_19, %.loc40_19.1 [template = i32] +// CHECK:STDOUT: %a.loc40_16.1: i32 = param a +// CHECK:STDOUT: @.2.%a: i32 = bind_name a, %a.loc40_16.1 +// CHECK:STDOUT: %int.make_type_32.loc40_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc40_27.1: type = value_of_initializer %int.make_type_32.loc40_27 [template = i32] +// CHECK:STDOUT: %.loc40_27.2: type = converted %int.make_type_32.loc40_27, %.loc40_27.1 [template = i32] +// CHECK:STDOUT: %b.loc40_24.1: i32 = param b +// CHECK:STDOUT: @.2.%b: i32 = bind_name b, %b.loc40_24.1 +// CHECK:STDOUT: %int.make_type_32.loc40_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc40_35.1: type = value_of_initializer %int.make_type_32.loc40_35 [template = i32] +// CHECK:STDOUT: %.loc40_35.2: type = converted %int.make_type_32.loc40_35, %.loc40_35.1 [template = i32] // CHECK:STDOUT: @.2.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -92,29 +96,29 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc16: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc18_19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc18_19.1: type = value_of_initializer %int.make_type_32.loc18_19 [template = i32] -// CHECK:STDOUT: %.loc18_19.2: type = converted %int.make_type_32.loc18_19, %.loc18_19.1 [template = i32] -// CHECK:STDOUT: %a.loc18_16.1: i32 = param a -// CHECK:STDOUT: %a.loc18_16.2: i32 = bind_name a, %a.loc18_16.1 -// CHECK:STDOUT: %int.make_type_32.loc18_27: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc18_27.1: type = value_of_initializer %int.make_type_32.loc18_27 [template = i32] -// CHECK:STDOUT: %.loc18_27.2: type = converted %int.make_type_32.loc18_27, %.loc18_27.1 [template = i32] -// CHECK:STDOUT: %b.loc18_24.1: i32 = param b -// CHECK:STDOUT: %b.loc18_24.2: i32 = bind_name b, %b.loc18_24.1 -// CHECK:STDOUT: %int.make_type_32.loc18_35: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc18_35.1: type = value_of_initializer %int.make_type_32.loc18_35 [template = i32] -// CHECK:STDOUT: %.loc18_35.2: type = converted %int.make_type_32.loc18_35, %.loc18_35.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc22_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc22_19.1: type = value_of_initializer %int.make_type_32.loc22_19 [template = i32] +// CHECK:STDOUT: %.loc22_19.2: type = converted %int.make_type_32.loc22_19, %.loc22_19.1 [template = i32] +// CHECK:STDOUT: %a.loc22_16.1: i32 = param a +// CHECK:STDOUT: %a.loc22_16.2: i32 = bind_name a, %a.loc22_16.1 +// CHECK:STDOUT: %int.make_type_32.loc22_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc22_27.1: type = value_of_initializer %int.make_type_32.loc22_27 [template = i32] +// CHECK:STDOUT: %.loc22_27.2: type = converted %int.make_type_32.loc22_27, %.loc22_27.1 [template = i32] +// CHECK:STDOUT: %b.loc22_24.1: i32 = param b +// CHECK:STDOUT: %b.loc22_24.2: i32 = bind_name b, %b.loc22_24.1 +// CHECK:STDOUT: %int.make_type_32.loc22_35: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc22_35.1: type = value_of_initializer %int.make_type_32.loc22_35 [template = i32] +// CHECK:STDOUT: %.loc22_35.2: type = converted %int.make_type_32.loc22_35, %.loc22_35.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc18_38: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc22_38: = assoc_entity element1, %G.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc12 -// CHECK:STDOUT: .G = %.loc18_38 +// CHECK:STDOUT: .F = %.loc16 +// CHECK:STDOUT: .G = %.loc22_38 // CHECK:STDOUT: witness = (%F.decl, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -122,7 +126,7 @@ fn Interface.G(a: i32, b: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(@Interface.%a.loc18_16.2: i32, @Interface.%b.loc18_24.2: i32) -> i32; +// CHECK:STDOUT: fn @G(@Interface.%a.loc22_16.2: i32, @Interface.%b.loc22_24.2: i32) -> i32; // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() { // CHECK:STDOUT: !entry: diff --git a/toolchain/check/testdata/interface/no_prelude/as_type.carbon b/toolchain/check/testdata/interface/no_prelude/as_type.carbon index 84967e47eb5c..d231c363b4e3 100644 --- a/toolchain/check/testdata/interface/no_prelude/as_type.carbon +++ b/toolchain/check/testdata/interface/no_prelude/as_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/as_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/as_type.carbon interface Empty {} @@ -26,8 +30,8 @@ fn F(e: Empty) {} // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] -// CHECK:STDOUT: %e.loc9_6.1: Empty = param e -// CHECK:STDOUT: @F.%e: Empty = bind_name e, %e.loc9_6.1 +// CHECK:STDOUT: %e.loc13_6.1: Empty = param e +// CHECK:STDOUT: @F.%e: Empty = bind_name e, %e.loc13_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon b/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon index 38c7b65c9690..a3102a231f50 100644 --- a/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon +++ b/toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/as_type_of_type.carbon interface Empty {} @@ -29,8 +33,8 @@ fn F(T:! Empty) { // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %Empty.ref: type = name_ref Empty, %Empty.decl [template = constants.%.1] -// CHECK:STDOUT: %T.loc9_6.1: Empty = param T -// CHECK:STDOUT: @F.%T: Empty = bind_symbolic_name T 0, %T.loc9_6.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.loc13_6.1: Empty = param T +// CHECK:STDOUT: @F.%T: Empty = bind_symbolic_name T 0, %T.loc13_6.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -45,8 +49,8 @@ fn F(T:! Empty) { // CHECK:STDOUT: fn @F(%T: Empty) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: Empty = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc10_10.1: type = facet_type_access %T.ref [symbolic = constants.%T] -// CHECK:STDOUT: %.loc10_10.2: type = converted %T.ref, %.loc10_10.1 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc14_10.1: type = facet_type_access %T.ref [symbolic = constants.%T] +// CHECK:STDOUT: %.loc14_10.2: type = converted %T.ref, %.loc14_10.1 [symbolic = constants.%T] // CHECK:STDOUT: %x.var: ref T = var x // CHECK:STDOUT: %x: ref T = bind_name x, %x.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/interface/no_prelude/basic.carbon b/toolchain/check/testdata/interface/no_prelude/basic.carbon index 3199f10caa70..607e48ee1e8a 100644 --- a/toolchain/check/testdata/interface/no_prelude/basic.carbon +++ b/toolchain/check/testdata/interface/no_prelude/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/basic.carbon interface Empty { } @@ -30,11 +34,11 @@ interface ForwardDeclared { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Empty = %Empty.decl -// CHECK:STDOUT: .ForwardDeclared = %ForwardDeclared.decl.loc10 +// CHECK:STDOUT: .ForwardDeclared = %ForwardDeclared.decl.loc14 // CHECK:STDOUT: } // CHECK:STDOUT: %Empty.decl: type = interface_decl @Empty [template = constants.%.1] {} -// CHECK:STDOUT: %ForwardDeclared.decl.loc10: type = interface_decl @ForwardDeclared [template = constants.%.2] {} -// CHECK:STDOUT: %ForwardDeclared.decl.loc12: type = interface_decl @ForwardDeclared [template = constants.%.2] {} +// CHECK:STDOUT: %ForwardDeclared.decl.loc14: type = interface_decl @ForwardDeclared [template = constants.%.2] {} +// CHECK:STDOUT: %ForwardDeclared.decl.loc16: type = interface_decl @ForwardDeclared [template = constants.%.2] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Empty { @@ -48,11 +52,11 @@ interface ForwardDeclared { // CHECK:STDOUT: interface @ForwardDeclared { // CHECK:STDOUT: %Self: ForwardDeclared = bind_symbolic_name Self 0 [symbolic = constants.%Self.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {} -// CHECK:STDOUT: %.loc13: = assoc_entity element0, %F.decl [template = constants.%.5] +// CHECK:STDOUT: %.loc17: = assoc_entity element0, %F.decl [template = constants.%.5] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc13 +// CHECK:STDOUT: .F = %.loc17 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon index d194b77f43ba..0d672be06db2 100644 --- a/toolchain/check/testdata/interface/no_prelude/default_fn.carbon +++ b/toolchain/check/testdata/interface/no_prelude/default_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/default_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/default_fn.carbon class C { interface I { @@ -48,11 +52,11 @@ class C { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc10: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc14: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc10 +// CHECK:STDOUT: .F = %.loc14 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -82,13 +86,13 @@ class C { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc12_19.1: {} = struct_literal () -// CHECK:STDOUT: %.loc12_19.2: init C = class_init (), %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc12_20: init C = converted %.loc12_19.1, %.loc12_19.2 [template = constants.%struct.3] -// CHECK:STDOUT: assign %c.var, %.loc12_20 +// CHECK:STDOUT: %.loc16_19.1: {} = struct_literal () +// CHECK:STDOUT: %.loc16_19.2: init C = class_init (), %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc16_20: init C = converted %.loc16_19.1, %.loc16_19.2 [template = constants.%struct.3] +// CHECK:STDOUT: assign %c.var, %.loc16_20 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: %I.ref: type = name_ref I, @C.%I.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc10 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @I.%.loc14 [template = constants.%.4] // CHECK:STDOUT: %.1: F = interface_witness_access @impl.%.1, element0 [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init () = call %.1() // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/interface/no_prelude/export_name.carbon b/toolchain/check/testdata/interface/no_prelude/export_name.carbon index 76c1ca2db046..f45bfc2e8177 100644 --- a/toolchain/check/testdata/interface/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/interface/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon b/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon index 8dae73b5c10e..1d7eef16b91d 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_add_member_outside_definition.carbon interface Interface { } diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon index 2ffbbefde729..c8e64ba7346f 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_binding.carbon interface I { // CHECK:STDERR: fail_assoc_const_not_binding.carbon:[[@LINE+3]]:3: ERROR: Semantics TODO: `tuple pattern in let`. diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon index 9956ffb2108b..d9d2b97b5f87 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_not_constant.carbon interface I { // CHECK:STDERR: fail_assoc_const_not_constant.carbon:[[@LINE+7]]:7: ERROR: Pattern in associated constant declaration must be a single `:!` binding. @@ -35,10 +39,10 @@ alias UseOther = I.other; // CHECK:STDOUT: .UseOther = %UseOther // CHECK:STDOUT: } // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%.1] {} -// CHECK:STDOUT: %I.ref.loc19: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %I.ref.loc23: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] // CHECK:STDOUT: %UseA: = bind_alias UseA, [template = ] -// CHECK:STDOUT: %I.ref.loc22: type = name_ref I, %I.decl [template = constants.%.1] +// CHECK:STDOUT: %I.ref.loc26: type = name_ref I, %I.decl [template = constants.%.1] // CHECK:STDOUT: %other.ref: = name_ref other, [template = ] // CHECK:STDOUT: %UseOther: = bind_alias UseOther, [template = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon index e6ee68a2cd00..6c672537558c 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_assoc_const_template.carbon interface I { // CHECK:STDERR: fail_assoc_const_template.carbon:[[@LINE+3]]:7: ERROR: Semantics TODO: `HandleTemplate`. diff --git a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon index de65a26ad809..8e927323402d 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_duplicate.carbon interface Interface { } @@ -56,16 +60,16 @@ interface Class { } // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .Interface = %Interface.decl.loc7 +// CHECK:STDOUT: .Interface = %Interface.decl.loc11 // CHECK:STDOUT: .Function = %Function.decl // CHECK:STDOUT: .Class = %Class.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %Interface.decl.loc7: type = interface_decl @Interface [template = constants.%.1] {} -// CHECK:STDOUT: %Interface.decl.loc16: type = interface_decl @Interface [template = constants.%.1] {} +// CHECK:STDOUT: %Interface.decl.loc11: type = interface_decl @Interface [template = constants.%.1] {} +// CHECK:STDOUT: %Interface.decl.loc20: type = interface_decl @Interface [template = constants.%.1] {} // CHECK:STDOUT: %Function.decl: Function = fn_decl @Function [template = constants.%struct.2] {} -// CHECK:STDOUT: %.decl.loc29: type = interface_decl @.1 [template = constants.%.3] {} +// CHECK:STDOUT: %.decl.loc33: type = interface_decl @.1 [template = constants.%.3] {} // CHECK:STDOUT: %Class.decl: type = class_decl @Class [template = constants.%Class] {} -// CHECK:STDOUT: %.decl.loc39: type = interface_decl @.2 [template = constants.%.4] {} +// CHECK:STDOUT: %.decl.loc43: type = interface_decl @.2 [template = constants.%.4] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { diff --git a/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon b/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon index e9a0068ed31e..678c2480afa6 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_lookup_undefined.carbon interface Undefined; @@ -85,12 +89,12 @@ interface BeingDefined { // CHECK:STDOUT: %T.ref: = name_ref T, [template = ] // CHECK:STDOUT: %return.var: ref = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc41: = assoc_entity element0, %H.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc45: = assoc_entity element0, %H.decl [template = constants.%.6] // CHECK:STDOUT: %.decl: = fn_decl @.2 [template = constants.%struct.4] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .H = %.loc41 +// CHECK:STDOUT: .H = %.loc45 // CHECK:STDOUT: witness = (%H.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon index 7f70cf941bd3..0dca3d767417 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_member_lookup.carbon interface Interface { fn F(); @@ -51,14 +55,14 @@ fn F() { // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc10: = assoc_entity element1, %T [template = constants.%.6] +// CHECK:STDOUT: %.loc14: = assoc_entity element1, %T [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: .T = %.loc10 +// CHECK:STDOUT: .F = %.loc12 +// CHECK:STDOUT: .T = %.loc14 // CHECK:STDOUT: witness = (%F.decl, %T) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -66,10 +70,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F.2() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %Interface.ref.loc18: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc8 [template = constants.%.4] -// CHECK:STDOUT: %Interface.ref.loc23: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %T.ref: = name_ref T, @Interface.%.loc10 [template = constants.%.6] +// CHECK:STDOUT: %Interface.ref.loc22: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] +// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc12 [template = constants.%.4] +// CHECK:STDOUT: %Interface.ref.loc27: type = name_ref Interface, file.%Interface.decl [template = constants.%.1] +// CHECK:STDOUT: %T.ref: = name_ref T, @Interface.%.loc14 [template = constants.%.6] // CHECK:STDOUT: %v.var: ref = var v // CHECK:STDOUT: %v: ref = bind_name v, %v.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon index 0a9e2f23ef7f..8d3d7bd79406 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: ERROR: `abstract` not allowed on `interface` declaration. // CHECK:STDERR: abstract interface Abstract { diff --git a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon index 94abbf632a71..30e224b04d35 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_redeclare_member.carbon interface Interface { fn F(); @@ -39,12 +43,12 @@ interface Interface { // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] {} // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 +// CHECK:STDOUT: .F = %.loc12 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon index 66f0970140be..51a35edc85ef 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_facet_lookup.carbon interface Interface { fn F(); } @@ -46,30 +50,30 @@ fn CallFacet(T:! Interface, x: T) { // CHECK:STDOUT: } // CHECK:STDOUT: %Interface.decl: type = interface_decl @Interface [template = constants.%.1] {} // CHECK:STDOUT: %CallStatic.decl: CallStatic = fn_decl @CallStatic [template = constants.%struct.2] { -// CHECK:STDOUT: %Interface.ref.loc9: type = name_ref Interface, %Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %T.loc9_15.1: Interface = param T -// CHECK:STDOUT: @CallStatic.%T: Interface = bind_symbolic_name T 0, %T.loc9_15.1 [symbolic = constants.%T] +// CHECK:STDOUT: %Interface.ref.loc13: type = name_ref Interface, %Interface.decl [template = constants.%.1] +// CHECK:STDOUT: %T.loc13_15.1: Interface = param T +// CHECK:STDOUT: @CallStatic.%T: Interface = bind_symbolic_name T 0, %T.loc13_15.1 [symbolic = constants.%T] // CHECK:STDOUT: } // CHECK:STDOUT: %CallFacet.decl: CallFacet = fn_decl @CallFacet [template = constants.%struct.3] { -// CHECK:STDOUT: %Interface.ref.loc17: type = name_ref Interface, %Interface.decl [template = constants.%.1] -// CHECK:STDOUT: %T.loc17_14.1: Interface = param T -// CHECK:STDOUT: @CallFacet.%T: Interface = bind_symbolic_name T 0, %T.loc17_14.1 [symbolic = constants.%T] +// CHECK:STDOUT: %Interface.ref.loc21: type = name_ref Interface, %Interface.decl [template = constants.%.1] +// CHECK:STDOUT: %T.loc21_14.1: Interface = param T +// CHECK:STDOUT: @CallFacet.%T: Interface = bind_symbolic_name T 0, %T.loc21_14.1 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: Interface = name_ref T, @CallFacet.%T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc17_32.1: type = facet_type_access %T.ref [symbolic = constants.%T] -// CHECK:STDOUT: %.loc17_32.2: type = converted %T.ref, %.loc17_32.1 [symbolic = constants.%T] -// CHECK:STDOUT: %x.loc17_29.1: T = param x -// CHECK:STDOUT: @CallFacet.%x: T = bind_name x, %x.loc17_29.1 +// CHECK:STDOUT: %.loc21_32.1: type = facet_type_access %T.ref [symbolic = constants.%T] +// CHECK:STDOUT: %.loc21_32.2: type = converted %T.ref, %.loc21_32.1 [symbolic = constants.%T] +// CHECK:STDOUT: %x.loc21_29.1: T = param x +// CHECK:STDOUT: @CallFacet.%x: T = bind_name x, %x.loc21_29.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: interface @Interface { // CHECK:STDOUT: %Self: Interface = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc7: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc11: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc7 +// CHECK:STDOUT: .F = %.loc11 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -78,7 +82,7 @@ fn CallFacet(T:! Interface, x: T) { // CHECK:STDOUT: fn @CallStatic(%T: Interface) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %T.ref: Interface = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc7 [template = constants.%.4] +// CHECK:STDOUT: %F.ref: = name_ref F, @Interface.%.loc11 [template = constants.%.4] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon index 3e835357735b..cc2fdff96766 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_generic.carbon // CHECK:STDERR: fail_todo_generic.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `generic interface`. // CHECK:STDERR: interface I[](); diff --git a/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon b/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon index 11e08028f69b..5de7abad55a4 100644 --- a/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/fail_todo_modifiers.carbon interface Modifiers { // CHECK:STDERR: fail_todo_modifiers.carbon:[[@LINE+4]]:3: ERROR: Semantics TODO: `interface modifier`. @@ -53,14 +57,14 @@ private interface Private { // CHECK:STDOUT: interface @Modifiers { // CHECK:STDOUT: %Self: Modifiers = bind_symbolic_name Self 0 [symbolic = constants.%Self.1] // CHECK:STDOUT: %Final.decl: Final = fn_decl @Final [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc12: = assoc_entity element0, %Final.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc16: = assoc_entity element0, %Final.decl [template = constants.%.4] // CHECK:STDOUT: %Default.decl: Default = fn_decl @Default [template = constants.%struct.2] {} -// CHECK:STDOUT: %.loc17: = assoc_entity element1, %Default.decl [template = constants.%.6] +// CHECK:STDOUT: %.loc21: = assoc_entity element1, %Default.decl [template = constants.%.6] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .Final = %.loc12 -// CHECK:STDOUT: .Default = %.loc17 +// CHECK:STDOUT: .Final = %.loc16 +// CHECK:STDOUT: .Default = %.loc21 // CHECK:STDOUT: witness = (%Final.decl, %Default.decl) // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon b/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon index d427af642620..55ecab73d6ee 100644 --- a/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon +++ b/toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/generic_binding_after_assoc_const.carbon interface I { fn F(T:! type); @@ -41,27 +45,27 @@ interface I { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] { -// CHECK:STDOUT: %T.loc8_8.1: type = param T -// CHECK:STDOUT: %T.loc8_8.2: type = bind_symbolic_name T 1, %T.loc8_8.1 [symbolic = constants.%T] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8: = assoc_entity element0, %F.decl [template = constants.%.4] -// CHECK:STDOUT: %U: type = assoc_const_decl U [template] -// CHECK:STDOUT: %.loc9: = assoc_entity element1, %U [template = constants.%.6] -// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { // CHECK:STDOUT: %T.loc12_8.1: type = param T // CHECK:STDOUT: %T.loc12_8.2: type = bind_symbolic_name T 1, %T.loc12_8.1 [symbolic = constants.%T] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: = assoc_entity element2, %G.decl [template = constants.%.8] +// CHECK:STDOUT: %.loc12: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %U: type = assoc_const_decl U [template] +// CHECK:STDOUT: %.loc13: = assoc_entity element1, %U [template = constants.%.6] +// CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { +// CHECK:STDOUT: %T.loc16_8.1: type = param T +// CHECK:STDOUT: %T.loc16_8.2: type = bind_symbolic_name T 1, %T.loc16_8.1 [symbolic = constants.%T] +// CHECK:STDOUT: } +// CHECK:STDOUT: %.loc16: = assoc_entity element2, %G.decl [template = constants.%.8] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8 -// CHECK:STDOUT: .U = %.loc9 -// CHECK:STDOUT: .G = %.loc12 +// CHECK:STDOUT: .F = %.loc12 +// CHECK:STDOUT: .U = %.loc13 +// CHECK:STDOUT: .G = %.loc16 // CHECK:STDOUT: witness = (%F.decl, %U, %G.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(@I.%T.loc8_8.2: type); +// CHECK:STDOUT: fn @F(@I.%T.loc12_8.2: type); // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(@I.%T.loc12_8.2: type); +// CHECK:STDOUT: fn @G(@I.%T.loc16_8.2: type); // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/no_prelude/import.carbon b/toolchain/check/testdata/interface/no_prelude/import.carbon index 0a6ad4251df5..ccd09688d945 100644 --- a/toolchain/check/testdata/interface/no_prelude/import.carbon +++ b/toolchain/check/testdata/interface/no_prelude/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/import.carbon // --- a.carbon diff --git a/toolchain/check/testdata/interface/no_prelude/self.carbon b/toolchain/check/testdata/interface/no_prelude/self.carbon index a67ae9904dce..9469209469b0 100644 --- a/toolchain/check/testdata/interface/no_prelude/self.carbon +++ b/toolchain/check/testdata/interface/no_prelude/self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/no_prelude/self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/no_prelude/self.carbon interface UseSelf { fn F[self: Self]() -> Self; @@ -30,23 +34,23 @@ interface UseSelf { // CHECK:STDOUT: interface @UseSelf { // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %Self.ref.loc8_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self] -// CHECK:STDOUT: %self.loc8_8.1: Self = param self -// CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1 -// CHECK:STDOUT: %Self.ref.loc8_25: UseSelf = name_ref Self, %Self [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_25.1: type = facet_type_access %Self.ref.loc8_25 [symbolic = constants.%Self] -// CHECK:STDOUT: %.loc8_25.2: type = converted %Self.ref.loc8_25, %.loc8_25.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %Self.ref.loc12_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_14.1: type = facet_type_access %Self.ref.loc12_14 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref.loc12_14, %.loc12_14.1 [symbolic = constants.%Self] +// CHECK:STDOUT: %self.loc12_8.1: Self = param self +// CHECK:STDOUT: %self.loc12_8.2: Self = bind_name self, %self.loc12_8.1 +// CHECK:STDOUT: %Self.ref.loc12_25: UseSelf = name_ref Self, %Self [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_25.1: type = facet_type_access %Self.ref.loc12_25 [symbolic = constants.%Self] +// CHECK:STDOUT: %.loc12_25.2: type = converted %Self.ref.loc12_25, %.loc12_25.1 [symbolic = constants.%Self] // CHECK:STDOUT: %return.var: ref Self = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc8_29: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc12_29: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc8_29 +// CHECK:STDOUT: .F = %.loc12_29 // CHECK:STDOUT: witness = (%F.decl) // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @F[@UseSelf.%self.loc8_8.2: Self]() -> Self; +// CHECK:STDOUT: fn @F[@UseSelf.%self.loc12_8.2: Self]() -> Self; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/interface/todo_define_not_default.carbon b/toolchain/check/testdata/interface/todo_define_not_default.carbon index 5c01a9dac32b..f46ea268ff65 100644 --- a/toolchain/check/testdata/interface/todo_define_not_default.carbon +++ b/toolchain/check/testdata/interface/todo_define_not_default.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interface/todo_define_not_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interface/todo_define_not_default.carbon interface I { // TODO: A definition without `default` in an interface should be rejected. @@ -58,47 +62,47 @@ interface I { // CHECK:STDOUT: interface @I { // CHECK:STDOUT: %Self: I = bind_symbolic_name Self 0 [symbolic = constants.%Self] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} -// CHECK:STDOUT: %.loc9: = assoc_entity element0, %F.decl [template = constants.%.4] +// CHECK:STDOUT: %.loc13: = assoc_entity element0, %F.decl [template = constants.%.4] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] -// CHECK:STDOUT: %.loc10_11.2: type = converted %int.make_type_32.loc10_11, %.loc10_11.1 [template = i32] -// CHECK:STDOUT: %a.loc10_8.1: i32 = param a -// CHECK:STDOUT: %a.loc10_8.2: i32 = bind_name a, %a.loc10_8.1 -// CHECK:STDOUT: %int.make_type_32.loc10_19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_19.1: type = value_of_initializer %int.make_type_32.loc10_19 [template = i32] -// CHECK:STDOUT: %.loc10_19.2: type = converted %int.make_type_32.loc10_19, %.loc10_19.1 [template = i32] -// CHECK:STDOUT: %b.loc10_16.1: i32 = param b -// CHECK:STDOUT: %b.loc10_16.2: i32 = bind_name b, %b.loc10_16.1 -// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_27.1: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] -// CHECK:STDOUT: %.loc10_27.2: type = converted %int.make_type_32.loc10_27, %.loc10_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_11.2: type = converted %int.make_type_32.loc14_11, %.loc14_11.1 [template = i32] +// CHECK:STDOUT: %a.loc14_8.1: i32 = param a +// CHECK:STDOUT: %a.loc14_8.2: i32 = bind_name a, %a.loc14_8.1 +// CHECK:STDOUT: %int.make_type_32.loc14_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_19.1: type = value_of_initializer %int.make_type_32.loc14_19 [template = i32] +// CHECK:STDOUT: %.loc14_19.2: type = converted %int.make_type_32.loc14_19, %.loc14_19.1 [template = i32] +// CHECK:STDOUT: %b.loc14_16.1: i32 = param b +// CHECK:STDOUT: %b.loc14_16.2: i32 = bind_name b, %b.loc14_16.1 +// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_27.1: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] +// CHECK:STDOUT: %.loc14_27.2: type = converted %int.make_type_32.loc14_27, %.loc14_27.1 [template = i32] // CHECK:STDOUT: %return.var: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_31: = assoc_entity element1, %G.decl [template = constants.%.6] -// CHECK:STDOUT: %int.make_type_32.loc14_19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_24: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc14_27: (type, type) = tuple_literal (%int.make_type_32.loc14_19, %int.make_type_32.loc14_24) -// CHECK:STDOUT: %.loc14_28.1: type = value_of_initializer %int.make_type_32.loc14_19 [template = i32] -// CHECK:STDOUT: %.loc14_28.2: type = converted %int.make_type_32.loc14_19, %.loc14_28.1 [template = i32] -// CHECK:STDOUT: %.loc14_28.3: type = value_of_initializer %int.make_type_32.loc14_24 [template = i32] -// CHECK:STDOUT: %.loc14_28.4: type = converted %int.make_type_32.loc14_24, %.loc14_28.3 [template = i32] -// CHECK:STDOUT: %.loc14_28.5: type = converted %.loc14_27, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %.loc14_31: = assoc_entity element1, %G.decl [template = constants.%.6] +// CHECK:STDOUT: %int.make_type_32.loc18_19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_27: (type, type) = tuple_literal (%int.make_type_32.loc18_19, %int.make_type_32.loc18_24) +// CHECK:STDOUT: %.loc18_28.1: type = value_of_initializer %int.make_type_32.loc18_19 [template = i32] +// CHECK:STDOUT: %.loc18_28.2: type = converted %int.make_type_32.loc18_19, %.loc18_28.1 [template = i32] +// CHECK:STDOUT: %.loc18_28.3: type = value_of_initializer %int.make_type_32.loc18_24 [template = i32] +// CHECK:STDOUT: %.loc18_28.4: type = converted %int.make_type_32.loc18_24, %.loc18_28.3 [template = i32] +// CHECK:STDOUT: %.loc18_28.5: type = converted %.loc18_27, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %T: type = assoc_const_decl T [template] -// CHECK:STDOUT: %.loc14_28.6: = assoc_entity element2, %T [template = constants.%.10] -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_11.2: type = converted %int.make_type_32.loc15, %.loc15_11.1 [template = i32] -// CHECK:STDOUT: %.loc15_17: i32 = int_literal 42 [template = constants.%.11] +// CHECK:STDOUT: %.loc18_28.6: = assoc_entity element2, %T [template = constants.%.10] +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_11.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_11.2: type = converted %int.make_type_32.loc19, %.loc19_11.1 [template = i32] +// CHECK:STDOUT: %.loc19_17: i32 = int_literal 42 [template = constants.%.11] // CHECK:STDOUT: %N: i32 = assoc_const_decl N [template] -// CHECK:STDOUT: %.loc15_19: = assoc_entity element3, %N [template = constants.%.13] +// CHECK:STDOUT: %.loc19_19: = assoc_entity element3, %N [template = constants.%.13] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = %Self -// CHECK:STDOUT: .F = %.loc9 -// CHECK:STDOUT: .G = %.loc10_31 -// CHECK:STDOUT: .T = %.loc14_28.6 -// CHECK:STDOUT: .N = %.loc15_19 +// CHECK:STDOUT: .F = %.loc13 +// CHECK:STDOUT: .G = %.loc14_31 +// CHECK:STDOUT: .T = %.loc18_28.6 +// CHECK:STDOUT: .N = %.loc19_19 // CHECK:STDOUT: witness = (%F.decl, %G.decl, %T, %N) // CHECK:STDOUT: } // CHECK:STDOUT: @@ -109,5 +113,5 @@ interface I { // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @G(@I.%a.loc10_8.2: i32, @I.%b.loc10_16.2: i32) -> i32 = "int.sadd"; +// CHECK:STDOUT: fn @G(@I.%a.loc14_8.2: i32, @I.%b.loc14_16.2: i32) -> i32 = "int.sadd"; // CHECK:STDOUT: diff --git a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon index a9b1042d88b0..8ac08c2edffe 100644 --- a/toolchain/check/testdata/ir/duplicate_name_same_line.carbon +++ b/toolchain/check/testdata/ir/duplicate_name_same_line.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/ir/duplicate_name_same_line.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/ir/duplicate_name_same_line.carbon fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } @@ -32,34 +36,34 @@ fn A() { if (true) { var n: i32 = 1; } if (true) { var n: i32 = 2; } } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_14: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc7_14 br !if.then.loc7_18 else br !if.else.loc7_18 +// CHECK:STDOUT: %.loc11_14: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc11_14 br !if.then.loc11_18 else br !if.else.loc11_18 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc7_18: -// CHECK:STDOUT: %int.make_type_32.loc7_29: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_29.1: type = value_of_initializer %int.make_type_32.loc7_29 [template = i32] -// CHECK:STDOUT: %.loc7_29.2: type = converted %int.make_type_32.loc7_29, %.loc7_29.1 [template = i32] -// CHECK:STDOUT: %n.var.loc7_26: ref i32 = var n -// CHECK:STDOUT: %n.loc7_26: ref i32 = bind_name n, %n.var.loc7_26 -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: assign %n.var.loc7_26, %.loc7_35 -// CHECK:STDOUT: br !if.else.loc7_18 +// CHECK:STDOUT: !if.then.loc11_18: +// CHECK:STDOUT: %int.make_type_32.loc11_29: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_29.1: type = value_of_initializer %int.make_type_32.loc11_29 [template = i32] +// CHECK:STDOUT: %.loc11_29.2: type = converted %int.make_type_32.loc11_29, %.loc11_29.1 [template = i32] +// CHECK:STDOUT: %n.var.loc11_26: ref i32 = var n +// CHECK:STDOUT: %n.loc11_26: ref i32 = bind_name n, %n.var.loc11_26 +// CHECK:STDOUT: %.loc11_35: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: assign %n.var.loc11_26, %.loc11_35 +// CHECK:STDOUT: br !if.else.loc11_18 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc7_18: -// CHECK:STDOUT: %.loc7_44: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc7_44 br !if.then.loc7_48 else br !if.else.loc7_48 +// CHECK:STDOUT: !if.else.loc11_18: +// CHECK:STDOUT: %.loc11_44: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc11_44 br !if.then.loc11_48 else br !if.else.loc11_48 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc7_48: -// CHECK:STDOUT: %int.make_type_32.loc7_59: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_59.1: type = value_of_initializer %int.make_type_32.loc7_59 [template = i32] -// CHECK:STDOUT: %.loc7_59.2: type = converted %int.make_type_32.loc7_59, %.loc7_59.1 [template = i32] -// CHECK:STDOUT: %n.var.loc7_56: ref i32 = var n -// CHECK:STDOUT: %n.loc7_56: ref i32 = bind_name n, %n.var.loc7_56 -// CHECK:STDOUT: %.loc7_65: i32 = int_literal 2 [template = constants.%.4] -// CHECK:STDOUT: assign %n.var.loc7_56, %.loc7_65 -// CHECK:STDOUT: br !if.else.loc7_48 +// CHECK:STDOUT: !if.then.loc11_48: +// CHECK:STDOUT: %int.make_type_32.loc11_59: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_59.1: type = value_of_initializer %int.make_type_32.loc11_59 [template = i32] +// CHECK:STDOUT: %.loc11_59.2: type = converted %int.make_type_32.loc11_59, %.loc11_59.1 [template = i32] +// CHECK:STDOUT: %n.var.loc11_56: ref i32 = var n +// CHECK:STDOUT: %n.loc11_56: ref i32 = bind_name n, %n.var.loc11_56 +// CHECK:STDOUT: %.loc11_65: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: assign %n.var.loc11_56, %.loc11_65 +// CHECK:STDOUT: br !if.else.loc11_48 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc7_48: +// CHECK:STDOUT: !if.else.loc11_48: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/convert.carbon b/toolchain/check/testdata/let/convert.carbon index 103f50e4c16e..a6c6ed20370a 100644 --- a/toolchain/check/testdata/let/convert.carbon +++ b/toolchain/check/testdata/let/convert.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/convert.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/convert.carbon fn F() -> i32 { var v: (i32, i32, i32) = (1, 2, 3); @@ -37,8 +41,8 @@ fn F() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -53,56 +57,56 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc8_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc8_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc8_21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc8_11, %int.make_type_32.loc8_16, %int.make_type_32.loc8_21) -// CHECK:STDOUT: %.loc8_24.2: type = value_of_initializer %int.make_type_32.loc8_11 [template = i32] -// CHECK:STDOUT: %.loc8_24.3: type = converted %int.make_type_32.loc8_11, %.loc8_24.2 [template = i32] -// CHECK:STDOUT: %.loc8_24.4: type = value_of_initializer %int.make_type_32.loc8_16 [template = i32] -// CHECK:STDOUT: %.loc8_24.5: type = converted %int.make_type_32.loc8_16, %.loc8_24.4 [template = i32] -// CHECK:STDOUT: %.loc8_24.6: type = value_of_initializer %int.make_type_32.loc8_21 [template = i32] -// CHECK:STDOUT: %.loc8_24.7: type = converted %int.make_type_32.loc8_21, %.loc8_24.6 [template = i32] -// CHECK:STDOUT: %.loc8_24.8: type = converted %.loc8_24.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc12_11, %int.make_type_32.loc12_16, %int.make_type_32.loc12_21) +// CHECK:STDOUT: %.loc12_24.2: type = value_of_initializer %int.make_type_32.loc12_11 [template = i32] +// CHECK:STDOUT: %.loc12_24.3: type = converted %int.make_type_32.loc12_11, %.loc12_24.2 [template = i32] +// CHECK:STDOUT: %.loc12_24.4: type = value_of_initializer %int.make_type_32.loc12_16 [template = i32] +// CHECK:STDOUT: %.loc12_24.5: type = converted %int.make_type_32.loc12_16, %.loc12_24.4 [template = i32] +// CHECK:STDOUT: %.loc12_24.6: type = value_of_initializer %int.make_type_32.loc12_21 [template = i32] +// CHECK:STDOUT: %.loc12_24.7: type = converted %int.make_type_32.loc12_21, %.loc12_24.6 [template = i32] +// CHECK:STDOUT: %.loc12_24.8: type = converted %.loc12_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.var: ref (i32, i32, i32) = var v // CHECK:STDOUT: %v: ref (i32, i32, i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc8_29: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_32: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_35: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_36.1: (i32, i32, i32) = tuple_literal (%.loc8_29, %.loc8_32, %.loc8_35) -// CHECK:STDOUT: %.loc8_36.2: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc8_36.3: init i32 = initialize_from %.loc8_29 to %.loc8_36.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_36.4: ref i32 = tuple_access %v.var, element1 -// CHECK:STDOUT: %.loc8_36.5: init i32 = initialize_from %.loc8_32 to %.loc8_36.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc8_36.6: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc8_36.7: init i32 = initialize_from %.loc8_35 to %.loc8_36.6 [template = constants.%.7] -// CHECK:STDOUT: %.loc8_36.8: init (i32, i32, i32) = tuple_init (%.loc8_36.3, %.loc8_36.5, %.loc8_36.7) to %v.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_37: init (i32, i32, i32) = converted %.loc8_36.1, %.loc8_36.8 [template = constants.%tuple] -// CHECK:STDOUT: assign %v.var, %.loc8_37 -// CHECK:STDOUT: %int.make_type_32.loc10_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_11, %int.make_type_32.loc10_16, %int.make_type_32.loc10_21) -// CHECK:STDOUT: %.loc10_24.2: type = value_of_initializer %int.make_type_32.loc10_11 [template = i32] -// CHECK:STDOUT: %.loc10_24.3: type = converted %int.make_type_32.loc10_11, %.loc10_24.2 [template = i32] -// CHECK:STDOUT: %.loc10_24.4: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] -// CHECK:STDOUT: %.loc10_24.5: type = converted %int.make_type_32.loc10_16, %.loc10_24.4 [template = i32] -// CHECK:STDOUT: %.loc10_24.6: type = value_of_initializer %int.make_type_32.loc10_21 [template = i32] -// CHECK:STDOUT: %.loc10_24.7: type = converted %int.make_type_32.loc10_21, %.loc10_24.6 [template = i32] -// CHECK:STDOUT: %.loc10_24.8: type = converted %.loc10_24.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_29: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_32: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_35: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_36.1: (i32, i32, i32) = tuple_literal (%.loc12_29, %.loc12_32, %.loc12_35) +// CHECK:STDOUT: %.loc12_36.2: ref i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc12_36.3: init i32 = initialize_from %.loc12_29 to %.loc12_36.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_36.4: ref i32 = tuple_access %v.var, element1 +// CHECK:STDOUT: %.loc12_36.5: init i32 = initialize_from %.loc12_32 to %.loc12_36.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc12_36.6: ref i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc12_36.7: init i32 = initialize_from %.loc12_35 to %.loc12_36.6 [template = constants.%.7] +// CHECK:STDOUT: %.loc12_36.8: init (i32, i32, i32) = tuple_init (%.loc12_36.3, %.loc12_36.5, %.loc12_36.7) to %v.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_37: init (i32, i32, i32) = converted %.loc12_36.1, %.loc12_36.8 [template = constants.%tuple] +// CHECK:STDOUT: assign %v.var, %.loc12_37 +// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_24.1: (type, type, type) = tuple_literal (%int.make_type_32.loc14_11, %int.make_type_32.loc14_16, %int.make_type_32.loc14_21) +// CHECK:STDOUT: %.loc14_24.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] +// CHECK:STDOUT: %.loc14_24.3: type = converted %int.make_type_32.loc14_11, %.loc14_24.2 [template = i32] +// CHECK:STDOUT: %.loc14_24.4: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_24.5: type = converted %int.make_type_32.loc14_16, %.loc14_24.4 [template = i32] +// CHECK:STDOUT: %.loc14_24.6: type = value_of_initializer %int.make_type_32.loc14_21 [template = i32] +// CHECK:STDOUT: %.loc14_24.7: type = converted %int.make_type_32.loc14_21, %.loc14_24.6 [template = i32] +// CHECK:STDOUT: %.loc14_24.8: type = converted %.loc14_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %v.ref: ref (i32, i32, i32) = name_ref v, %v -// CHECK:STDOUT: %.loc10_28.1: ref i32 = tuple_access %v.ref, element0 -// CHECK:STDOUT: %.loc10_28.2: i32 = bind_value %.loc10_28.1 -// CHECK:STDOUT: %.loc10_28.3: ref i32 = tuple_access %v.ref, element1 -// CHECK:STDOUT: %.loc10_28.4: i32 = bind_value %.loc10_28.3 -// CHECK:STDOUT: %.loc10_28.5: ref i32 = tuple_access %v.ref, element2 -// CHECK:STDOUT: %.loc10_28.6: i32 = bind_value %.loc10_28.5 -// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.loc10_28.2, %.loc10_28.4, %.loc10_28.6) -// CHECK:STDOUT: %.loc10_29: (i32, i32, i32) = converted %v.ref, %tuple -// CHECK:STDOUT: %w: (i32, i32, i32) = bind_name w, %.loc10_29 +// CHECK:STDOUT: %.loc14_28.1: ref i32 = tuple_access %v.ref, element0 +// CHECK:STDOUT: %.loc14_28.2: i32 = bind_value %.loc14_28.1 +// CHECK:STDOUT: %.loc14_28.3: ref i32 = tuple_access %v.ref, element1 +// CHECK:STDOUT: %.loc14_28.4: i32 = bind_value %.loc14_28.3 +// CHECK:STDOUT: %.loc14_28.5: ref i32 = tuple_access %v.ref, element2 +// CHECK:STDOUT: %.loc14_28.6: i32 = bind_value %.loc14_28.5 +// CHECK:STDOUT: %tuple: (i32, i32, i32) = tuple_value (%.loc14_28.2, %.loc14_28.4, %.loc14_28.6) +// CHECK:STDOUT: %.loc14_29: (i32, i32, i32) = converted %v.ref, %tuple +// CHECK:STDOUT: %w: (i32, i32, i32) = bind_name w, %.loc14_29 // CHECK:STDOUT: %w.ref: (i32, i32, i32) = name_ref w, %w -// CHECK:STDOUT: %.loc11_12: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc11_13: i32 = tuple_index %w.ref, %.loc11_12 -// CHECK:STDOUT: return %.loc11_13 +// CHECK:STDOUT: %.loc15_12: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc15_13: i32 = tuple_index %w.ref, %.loc15_12 +// CHECK:STDOUT: return %.loc15_13 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_duplicate_decl.carbon b/toolchain/check/testdata/let/fail_duplicate_decl.carbon index 60c3cfa8537e..6ff683f090de 100644 --- a/toolchain/check/testdata/let/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/let/fail_duplicate_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_duplicate_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_duplicate_decl.carbon fn F() { let a: i32 = 1; @@ -40,16 +44,16 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_16 -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32.loc15, %.loc15_10.1 [template = i32] -// CHECK:STDOUT: %.loc15_16: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %a.loc15: i32 = bind_name a, %.loc15_16 +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_16 +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_10.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_10.2: type = converted %int.make_type_32.loc19, %.loc19_10.1 [template = i32] +// CHECK:STDOUT: %.loc19_16: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %a.loc19: i32 = bind_name a, %.loc19_16 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/fail_generic.carbon b/toolchain/check/testdata/let/fail_generic.carbon index f13be8236172..4d6069243425 100644 --- a/toolchain/check/testdata/let/fail_generic.carbon +++ b/toolchain/check/testdata/let/fail_generic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_generic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_generic.carbon // TODO: Should this be valid? fn F(a: i32) -> i32 { @@ -39,14 +43,14 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_9.1: type = value_of_initializer %int.make_type_32.loc8_9 [template = i32] -// CHECK:STDOUT: %.loc8_9.2: type = converted %int.make_type_32.loc8_9, %.loc8_9.1 [template = i32] -// CHECK:STDOUT: %a.loc8_6.1: i32 = param a -// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc8_6.1 -// CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_17.1: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32] -// CHECK:STDOUT: %.loc8_17.2: type = converted %int.make_type_32.loc8_17, %.loc8_17.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_9.1: type = value_of_initializer %int.make_type_32.loc12_9 [template = i32] +// CHECK:STDOUT: %.loc12_9.2: type = converted %int.make_type_32.loc12_9, %.loc12_9.1 [template = i32] +// CHECK:STDOUT: %a.loc12_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc12_6.1 +// CHECK:STDOUT: %int.make_type_32.loc12_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_17.1: type = value_of_initializer %int.make_type_32.loc12_17 [template = i32] +// CHECK:STDOUT: %.loc12_17.2: type = converted %int.make_type_32.loc12_17, %.loc12_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -57,11 +61,11 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: fn @F(%a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32, %.loc9_21.1 [template = i32] -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc9_21.2 [symbolic = constants.%T] +// CHECK:STDOUT: %.loc13_21.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32, %.loc13_21.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc13_21.2 [symbolic = constants.%T] // CHECK:STDOUT: %T.ref: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc14: i32 = int_literal 5 [template = constants.%.2] +// CHECK:STDOUT: %.loc18: i32 = int_literal 5 [template = constants.%.2] // CHECK:STDOUT: %x: T = bind_name x, // CHECK:STDOUT: %x.ref: T = name_ref x, %x // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/let/fail_generic_import.carbon b/toolchain/check/testdata/let/fail_generic_import.carbon index e7624897da17..120c479e7b16 100644 --- a/toolchain/check/testdata/let/fail_generic_import.carbon +++ b/toolchain/check/testdata/let/fail_generic_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_generic_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_generic_import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/let/fail_missing_value.carbon b/toolchain/check/testdata/let/fail_missing_value.carbon index ec27ce7b369e..284cd124a815 100644 --- a/toolchain/check/testdata/let/fail_missing_value.carbon +++ b/toolchain/check/testdata/let/fail_missing_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_missing_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_missing_value.carbon // CHECK:STDERR: fail_missing_value.carbon:[[@LINE+4]]:11: ERROR: Expected `=`; `let` declaration must have an initializer. // CHECK:STDERR: let n: i32; @@ -35,8 +39,8 @@ fn F() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] {} // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -47,8 +51,8 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc17_10.2: type = converted %int.make_type_32, %.loc17_10.1 [template = i32] +// CHECK:STDOUT: %.loc21_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_10.2: type = converted %int.make_type_32, %.loc21_10.1 [template = i32] // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/fail_modifiers.carbon b/toolchain/check/testdata/let/fail_modifiers.carbon index 8ef11ac65c6a..339d2ba83e21 100644 --- a/toolchain/check/testdata/let/fail_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: ERROR: `protected` not allowed on `let` declaration at file scope, `protected` is only allowed on class members. // CHECK:STDERR: protected let b: i32 = 1; @@ -94,53 +98,53 @@ protected protected let i: i32 = 1; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32.loc11, %.loc11_18.1 [template = i32] -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %b: i32 = bind_name b, %.loc11_24 +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_18.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_18.2: type = converted %int.make_type_32.loc15, %.loc15_18.1 [template = i32] +// CHECK:STDOUT: %.loc15_24: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %b: i32 = bind_name b, %.loc15_24 // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc17_16.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_16.2: type = converted %int.make_type_32.loc17, %.loc17_16.1 [template = i32] -// CHECK:STDOUT: %.loc17_22: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %c: i32 = bind_name c, %.loc17_22 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc21_16.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_16.2: type = converted %int.make_type_32.loc21, %.loc21_16.1 [template = i32] +// CHECK:STDOUT: %.loc21_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %c: i32 = bind_name c, %.loc21_22 // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc23_14.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] -// CHECK:STDOUT: %.loc23_14.2: type = converted %int.make_type_32.loc23, %.loc23_14.1 [template = i32] -// CHECK:STDOUT: %.loc23_20: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %d: i32 = bind_name d, %.loc23_20 +// CHECK:STDOUT: %int.make_type_32.loc27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc27_14.1: type = value_of_initializer %int.make_type_32.loc27 [template = i32] +// CHECK:STDOUT: %.loc27_14.2: type = converted %int.make_type_32.loc27, %.loc27_14.1 [template = i32] +// CHECK:STDOUT: %.loc27_20: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %d: i32 = bind_name d, %.loc27_20 // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc29_16.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] -// CHECK:STDOUT: %.loc29_16.2: type = converted %int.make_type_32.loc29, %.loc29_16.1 [template = i32] -// CHECK:STDOUT: %.loc29_22: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %e: i32 = bind_name e, %.loc29_22 +// CHECK:STDOUT: %int.make_type_32.loc33: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc33_16.1: type = value_of_initializer %int.make_type_32.loc33 [template = i32] +// CHECK:STDOUT: %.loc33_16.2: type = converted %int.make_type_32.loc33, %.loc33_16.1 [template = i32] +// CHECK:STDOUT: %.loc33_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %e: i32 = bind_name e, %.loc33_22 // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc42: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc42_22.1: type = value_of_initializer %int.make_type_32.loc42 [template = i32] -// CHECK:STDOUT: %.loc42_22.2: type = converted %int.make_type_32.loc42, %.loc42_22.1 [template = i32] -// CHECK:STDOUT: %.loc42_28: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %f: i32 = bind_name f, %.loc42_28 +// CHECK:STDOUT: %int.make_type_32.loc46: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc46_22.1: type = value_of_initializer %int.make_type_32.loc46 [template = i32] +// CHECK:STDOUT: %.loc46_22.2: type = converted %int.make_type_32.loc46, %.loc46_22.1 [template = i32] +// CHECK:STDOUT: %.loc46_28: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %f: i32 = bind_name f, %.loc46_28 // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc55: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc55_24.1: type = value_of_initializer %int.make_type_32.loc55 [template = i32] -// CHECK:STDOUT: %.loc55_24.2: type = converted %int.make_type_32.loc55, %.loc55_24.1 [template = i32] -// CHECK:STDOUT: %.loc55_30: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %g: i32 = bind_name g, %.loc55_30 +// CHECK:STDOUT: %int.make_type_32.loc59: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc59_24.1: type = value_of_initializer %int.make_type_32.loc59 [template = i32] +// CHECK:STDOUT: %.loc59_24.2: type = converted %int.make_type_32.loc59, %.loc59_24.1 [template = i32] +// CHECK:STDOUT: %.loc59_30: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %g: i32 = bind_name g, %.loc59_30 // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc68: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc68_26.1: type = value_of_initializer %int.make_type_32.loc68 [template = i32] -// CHECK:STDOUT: %.loc68_26.2: type = converted %int.make_type_32.loc68, %.loc68_26.1 [template = i32] -// CHECK:STDOUT: %.loc68_32: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %h: i32 = bind_name h, %.loc68_32 +// CHECK:STDOUT: %int.make_type_32.loc72: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc72_26.1: type = value_of_initializer %int.make_type_32.loc72 [template = i32] +// CHECK:STDOUT: %.loc72_26.2: type = converted %int.make_type_32.loc72, %.loc72_26.1 [template = i32] +// CHECK:STDOUT: %.loc72_32: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %h: i32 = bind_name h, %.loc72_32 // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc80: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc80_28.1: type = value_of_initializer %int.make_type_32.loc80 [template = i32] -// CHECK:STDOUT: %.loc80_28.2: type = converted %int.make_type_32.loc80, %.loc80_28.1 [template = i32] -// CHECK:STDOUT: %.loc80_34: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %i: i32 = bind_name i, %.loc80_34 +// CHECK:STDOUT: %int.make_type_32.loc84: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc84_28.1: type = value_of_initializer %int.make_type_32.loc84 [template = i32] +// CHECK:STDOUT: %.loc84_28.2: type = converted %int.make_type_32.loc84, %.loc84_28.1 [template = i32] +// CHECK:STDOUT: %.loc84_34: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %i: i32 = bind_name i, %.loc84_34 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/let/fail_todo_modifiers.carbon b/toolchain/check/testdata/let/fail_todo_modifiers.carbon index 3b4d34f091b8..503f3ea5a9ef 100644 --- a/toolchain/check/testdata/let/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/let/fail_todo_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_todo_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_todo_modifiers.carbon // CHECK:STDERR: fail_todo_modifiers.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `access modifier`. // CHECK:STDERR: private let a: i32 = 1; @@ -25,10 +29,10 @@ private let a: i32 = 1; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_32, %.loc10_16.1 [template = i32] -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %a: i32 = bind_name a, %.loc10_22 +// CHECK:STDOUT: %.loc14_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_16.2: type = converted %int.make_type_32, %.loc14_16.1 [template = i32] +// CHECK:STDOUT: %.loc14_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a: i32 = bind_name a, %.loc14_22 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/let/fail_use_in_init.carbon b/toolchain/check/testdata/let/fail_use_in_init.carbon index f45d811d6a2c..15a16744bf57 100644 --- a/toolchain/check/testdata/let/fail_use_in_init.carbon +++ b/toolchain/check/testdata/let/fail_use_in_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/fail_use_in_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/fail_use_in_init.carbon fn F() { // CHECK:STDERR: fail_use_in_init.carbon:[[@LINE+3]]:16: ERROR: Name `a` not found. @@ -34,8 +38,8 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32] // CHECK:STDOUT: %a.ref: = name_ref a, [template = ] // CHECK:STDOUT: %a: i32 = bind_name a, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/let/generic.carbon b/toolchain/check/testdata/let/generic.carbon index be5b26667c05..1d5a8c1b5901 100644 --- a/toolchain/check/testdata/let/generic.carbon +++ b/toolchain/check/testdata/let/generic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/generic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/generic.carbon fn F() { let T:! type = i32; @@ -35,21 +39,21 @@ fn F() { // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_21.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_21.2: type = converted %int.make_type_32, %.loc8_21.1 [template = i32] -// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc8_21.2 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref.loc9: type = name_ref T, %T [symbolic = constants.%T] -// CHECK:STDOUT: %.loc9: type = ptr_type T [symbolic = constants.%.2] +// CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_32, %.loc12_21.1 [template = i32] +// CHECK:STDOUT: %T: type = bind_symbolic_name T 0, %.loc12_21.2 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc13: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %.loc13: type = ptr_type T [symbolic = constants.%.2] // CHECK:STDOUT: %p.var: ref T* = var p // CHECK:STDOUT: %p: ref T* = bind_name p, %p.var -// CHECK:STDOUT: %T.ref.loc10: type = name_ref T, %T [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref.loc14: type = name_ref T, %T [symbolic = constants.%T] // CHECK:STDOUT: %a.var: ref T = var a // CHECK:STDOUT: %a: ref T = bind_name a, %a.var // CHECK:STDOUT: %p.ref: ref T* = name_ref p, %p -// CHECK:STDOUT: %.loc10_15: T* = bind_value %p.ref -// CHECK:STDOUT: %.loc10_14.1: ref T = deref %.loc10_15 -// CHECK:STDOUT: %.loc10_14.2: T = bind_value %.loc10_14.1 -// CHECK:STDOUT: assign %a.var, %.loc10_14.2 +// CHECK:STDOUT: %.loc14_15: T* = bind_value %p.ref +// CHECK:STDOUT: %.loc14_14.1: ref T = deref %.loc14_15 +// CHECK:STDOUT: %.loc14_14.2: T = bind_value %.loc14_14.1 +// CHECK:STDOUT: assign %a.var, %.loc14_14.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/let/generic_import.carbon b/toolchain/check/testdata/let/generic_import.carbon index 046be977d3e9..73f8b1dd9865 100644 --- a/toolchain/check/testdata/let/generic_import.carbon +++ b/toolchain/check/testdata/let/generic_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/generic_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/generic_import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/let/global.carbon b/toolchain/check/testdata/let/global.carbon index e7bcabeaa8e5..af0a7d0340c4 100644 --- a/toolchain/check/testdata/let/global.carbon +++ b/toolchain/check/testdata/let/global.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/global.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/global.carbon let n: i32 = 1; @@ -26,16 +30,16 @@ fn F() -> i32 { return n; } // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32] -// CHECK:STDOUT: %.loc7_14: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %n: i32 = bind_name n, %.loc7_14 +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %n: i32 = bind_name n, %.loc11_14 // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32.loc9, %.loc9_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/let/import.carbon b/toolchain/check/testdata/let/import.carbon index 60a69f011b6c..b9ab0dba1361 100644 --- a/toolchain/check/testdata/let/import.carbon +++ b/toolchain/check/testdata/let/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/let/local.carbon b/toolchain/check/testdata/let/local.carbon index 349e194fa389..6f3cddb62fff 100644 --- a/toolchain/check/testdata/let/local.carbon +++ b/toolchain/check/testdata/let/local.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/local.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/local.carbon fn F(a: i32) -> i32 { let b: i32 = a; @@ -28,14 +32,14 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %a.loc7_6.1: i32 = param a -// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_9, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %a.loc11_6.1: i32 = param a +// CHECK:STDOUT: @F.%a: i32 = bind_name a, %a.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_17.2: type = converted %int.make_type_32.loc11_17, %.loc11_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -46,8 +50,8 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: fn @F(%a: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a // CHECK:STDOUT: %b: i32 = bind_name b, %a.ref // CHECK:STDOUT: %b.ref: i32 = name_ref b, %b diff --git a/toolchain/check/testdata/let/shadowed_decl.carbon b/toolchain/check/testdata/let/shadowed_decl.carbon index f76a98996541..18a609e84bbe 100644 --- a/toolchain/check/testdata/let/shadowed_decl.carbon +++ b/toolchain/check/testdata/let/shadowed_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/let/shadowed_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/let/shadowed_decl.carbon fn F(a: i32) -> i32 { let a: i32 = 1; @@ -30,14 +34,14 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_9.2: type = converted %int.make_type_32.loc7_9, %.loc7_9.1 [template = i32] -// CHECK:STDOUT: %a.loc7_6.1: i32 = param a -// CHECK:STDOUT: @F.%a.loc7: i32 = bind_name a, %a.loc7_6.1 -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7_17, %.loc7_17.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] +// CHECK:STDOUT: %.loc11_9.2: type = converted %int.make_type_32.loc11_9, %.loc11_9.1 [template = i32] +// CHECK:STDOUT: %a.loc11_6.1: i32 = param a +// CHECK:STDOUT: @F.%a.loc11: i32 = bind_name a, %a.loc11_6.1 +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_17.2: type = converted %int.make_type_32.loc11_17, %.loc11_17.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -45,14 +49,14 @@ fn F(a: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: -// CHECK:STDOUT: fn @F(%a.loc7: i32) -> i32 { +// CHECK:STDOUT: fn @F(%a.loc11: i32) -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %a.loc8: i32 = bind_name a, %.loc8_16 -// CHECK:STDOUT: %a.ref: i32 = name_ref a, %a.loc8 +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %a.loc12: i32 = bind_name a, %.loc12_16 +// CHECK:STDOUT: %a.ref: i32 = name_ref a, %a.loc12 // CHECK:STDOUT: return %a.ref // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/add_to_import.carbon b/toolchain/check/testdata/namespace/add_to_import.carbon index 7f14c75c8911..f38afadd9f2b 100644 --- a/toolchain/check/testdata/namespace/add_to_import.carbon +++ b/toolchain/check/testdata/namespace/add_to_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/add_to_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/add_to_import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/namespace/alias.carbon b/toolchain/check/testdata/namespace/alias.carbon index 523c46e67c7d..3ee7c4143fef 100644 --- a/toolchain/check/testdata/namespace/alias.carbon +++ b/toolchain/check/testdata/namespace/alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/alias.carbon namespace NS; @@ -44,30 +48,30 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: %NS: = namespace [template] { // CHECK:STDOUT: .A = %A.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %NS.ref.loc9: = name_ref NS, %NS [template = %NS] +// CHECK:STDOUT: %NS.ref.loc13: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %ns: = bind_alias ns, %NS [template = %NS] // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11, %.loc11_14.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] // CHECK:STDOUT: @A.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] -// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] +// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } -// CHECK:STDOUT: %NS.ref.loc15: = name_ref NS, %NS [template = %NS] +// CHECK:STDOUT: %NS.ref.loc19: = name_ref NS, %NS [template = %NS] // CHECK:STDOUT: %A.ref: A = name_ref A, %A.decl [template = constants.%struct.2] // CHECK:STDOUT: %C: A = bind_alias C, %A.decl [template = constants.%struct.2] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.4] { -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32.loc17, %.loc17_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_11.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_11.2: type = converted %int.make_type_32.loc21, %.loc21_11.1 [template = i32] // CHECK:STDOUT: @D.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -76,8 +80,8 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: // CHECK:STDOUT: fn @A() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc11 +// CHECK:STDOUT: %.loc15: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc15 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { @@ -85,17 +89,17 @@ fn D() -> i32 { return C(); } // CHECK:STDOUT: %ns.ref: = name_ref ns, file.%ns [template = file.%NS] // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %A.ref() -// CHECK:STDOUT: %.loc13_30.1: i32 = value_of_initializer %A.call -// CHECK:STDOUT: %.loc13_30.2: i32 = converted %A.call, %.loc13_30.1 -// CHECK:STDOUT: return %.loc13_30.2 +// CHECK:STDOUT: %.loc17_30.1: i32 = value_of_initializer %A.call +// CHECK:STDOUT: %.loc17_30.2: i32 = converted %A.call, %.loc17_30.1 +// CHECK:STDOUT: return %.loc17_30.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @D() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: A = name_ref C, file.%C [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init i32 = call %C.ref() -// CHECK:STDOUT: %.loc17_27.1: i32 = value_of_initializer %A.call -// CHECK:STDOUT: %.loc17_27.2: i32 = converted %A.call, %.loc17_27.1 -// CHECK:STDOUT: return %.loc17_27.2 +// CHECK:STDOUT: %.loc21_27.1: i32 = value_of_initializer %A.call +// CHECK:STDOUT: %.loc21_27.2: i32 = converted %A.call, %.loc21_27.1 +// CHECK:STDOUT: return %.loc21_27.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon index c4377e9cd2f2..a101caa45a15 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_conflict_after_merge.carbon // --- namespace.carbon diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon index 074b7ea87f4d..0bc2a8989cfd 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.carbon // --- namespace.carbon diff --git a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon index 2a98e6337d6b..68a7569bb358 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.carbon // --- fn.carbon diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon index b43da94e01e5..16a189b845f6 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.carbon // --- namespace.carbon diff --git a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon index 6d5c2514a9ea..1ed5d2d36551 100644 --- a/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +++ b/toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.carbon // --- fn.carbon diff --git a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon index cd678ea985c4..c0fdcd8fef81 100644 --- a/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +++ b/toolchain/check/testdata/namespace/fail_decl_in_alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_decl_in_alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_decl_in_alias.carbon namespace NS; @@ -41,8 +45,8 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %.decl: = fn_decl @.1 [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_14.2: type = converted %int.make_type_32, %.loc18_14.1 [template = i32] +// CHECK:STDOUT: %.loc22_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_14.2: type = converted %int.make_type_32, %.loc22_14.1 [template = i32] // CHECK:STDOUT: @.1.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -51,7 +55,7 @@ fn ns.A() -> i32 { return 0; } // CHECK:STDOUT: // CHECK:STDOUT: fn @.1() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: return %.loc18 +// CHECK:STDOUT: %.loc22: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: return %.loc22 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_duplicate.carbon b/toolchain/check/testdata/namespace/fail_duplicate.carbon index 28c0f14245ee..45741ef48e88 100644 --- a/toolchain/check/testdata/namespace/fail_duplicate.carbon +++ b/toolchain/check/testdata/namespace/fail_duplicate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_duplicate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_duplicate.carbon namespace Foo; @@ -33,17 +37,17 @@ fn Foo.Baz() { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Foo: = namespace [template] { -// CHECK:STDOUT: .Baz = %Baz.decl.loc9 +// CHECK:STDOUT: .Baz = %Baz.decl.loc13 // CHECK:STDOUT: } -// CHECK:STDOUT: %Baz.decl.loc9: Baz = fn_decl @Baz [template = constants.%struct] {} -// CHECK:STDOUT: %Baz.decl.loc18: Baz = fn_decl @Baz [template = constants.%struct] {} +// CHECK:STDOUT: %Baz.decl.loc13: Baz = fn_decl @Baz [template = constants.%struct] {} +// CHECK:STDOUT: %Baz.decl.loc22: Baz = fn_decl @Baz [template = constants.%struct] {} // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Baz() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: -// CHECK:STDOUT: !.loc19: +// CHECK:STDOUT: !.loc23: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_modifiers.carbon b/toolchain/check/testdata/namespace/fail_modifiers.carbon index d13652b01f45..997d14fb9a43 100644 --- a/toolchain/check/testdata/namespace/fail_modifiers.carbon +++ b/toolchain/check/testdata/namespace/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+33]]:1: ERROR: `private` not allowed on `namespace` declaration. // CHECK:STDERR: private extern abstract base default final namespace A; diff --git a/toolchain/check/testdata/namespace/fail_params.carbon b/toolchain/check/testdata/namespace/fail_params.carbon index c6f9c2c8dbf8..19f845a09a82 100644 --- a/toolchain/check/testdata/namespace/fail_params.carbon +++ b/toolchain/check/testdata/namespace/fail_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_params.carbon // CHECK:STDERR: fail_params.carbon:[[@LINE+4]]:12: ERROR: `namespace` declaration cannot have parameters. // CHECK:STDERR: namespace A(); @@ -49,16 +53,16 @@ namespace C[T:! type](x: T); // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.1] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc20_16.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc20_16.2: type = converted %int.make_type_32, %.loc20_16.1 [template = i32] -// CHECK:STDOUT: %n.loc20_13.1: i32 = param n -// CHECK:STDOUT: %n.loc20_13.2: i32 = bind_name n, %n.loc20_13.1 +// CHECK:STDOUT: %.loc24_16.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc24_16.2: type = converted %int.make_type_32, %.loc24_16.1 [template = i32] +// CHECK:STDOUT: %n.loc24_13.1: i32 = param n +// CHECK:STDOUT: %n.loc24_13.2: i32 = bind_name n, %n.loc24_13.1 // CHECK:STDOUT: %B: = namespace [template] {} -// CHECK:STDOUT: %T.loc25_13.1: type = param T -// CHECK:STDOUT: %T.loc25_13.2: type = bind_symbolic_name T 0, %T.loc25_13.1 [symbolic = constants.%T] -// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc25_13.2 [symbolic = constants.%T] -// CHECK:STDOUT: %x.loc25_23.1: T = param x -// CHECK:STDOUT: %x.loc25_23.2: T = bind_name x, %x.loc25_23.1 +// CHECK:STDOUT: %T.loc29_13.1: type = param T +// CHECK:STDOUT: %T.loc29_13.2: type = bind_symbolic_name T 0, %T.loc29_13.1 [symbolic = constants.%T] +// CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc29_13.2 [symbolic = constants.%T] +// CHECK:STDOUT: %x.loc29_23.1: T = param x +// CHECK:STDOUT: %x.loc29_23.2: T = bind_name x, %x.loc29_23.1 // CHECK:STDOUT: %C: = namespace [template] {} // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon index 35920c8a2218..727a0151a52d 100644 --- a/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +++ b/toolchain/check/testdata/namespace/fail_unresolved_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/fail_unresolved_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/fail_unresolved_scope.carbon // CHECK:STDERR: fail_unresolved_scope.carbon:[[@LINE+3]]:4: ERROR: Name `Foo` not found. // CHECK:STDERR: fn Foo.Baz() { diff --git a/toolchain/check/testdata/namespace/function.carbon b/toolchain/check/testdata/namespace/function.carbon index afe58fd42e2a..346c013c86f4 100644 --- a/toolchain/check/testdata/namespace/function.carbon +++ b/toolchain/check/testdata/namespace/function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/function.carbon namespace Foo; @@ -33,15 +37,15 @@ fn Bar() { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core // CHECK:STDOUT: .Foo = %Foo -// CHECK:STDOUT: .Baz = %Baz.decl.loc10 +// CHECK:STDOUT: .Baz = %Baz.decl.loc14 // CHECK:STDOUT: .Bar = %Bar.decl // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %Foo: = namespace [template] { -// CHECK:STDOUT: .Baz = %Baz.decl.loc13 +// CHECK:STDOUT: .Baz = %Baz.decl.loc17 // CHECK:STDOUT: } -// CHECK:STDOUT: %Baz.decl.loc10: Baz = fn_decl @Baz.1 [template = constants.%struct.1] {} -// CHECK:STDOUT: %Baz.decl.loc13: Baz = fn_decl @Baz.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %Baz.decl.loc14: Baz = fn_decl @Baz.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %Baz.decl.loc17: Baz = fn_decl @Baz.2 [template = constants.%struct.2] {} // CHECK:STDOUT: %Bar.decl: Bar = fn_decl @Bar [template = constants.%struct.3] {} // CHECK:STDOUT: } // CHECK:STDOUT: @@ -58,7 +62,7 @@ fn Bar() { // CHECK:STDOUT: fn @Bar() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %Foo.ref: = name_ref Foo, file.%Foo [template = file.%Foo] -// CHECK:STDOUT: %Baz.ref: Baz = name_ref Baz, file.%Baz.decl.loc13 [template = constants.%struct.2] +// CHECK:STDOUT: %Baz.ref: Baz = name_ref Baz, file.%Baz.decl.loc17 [template = constants.%struct.2] // CHECK:STDOUT: %Baz.call: init () = call %Baz.ref() // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/namespace/imported.carbon b/toolchain/check/testdata/namespace/imported.carbon index 4c6cf86b3b64..955754e22bc4 100644 --- a/toolchain/check/testdata/namespace/imported.carbon +++ b/toolchain/check/testdata/namespace/imported.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/imported.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/imported.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/namespace/imported_indirect.carbon b/toolchain/check/testdata/namespace/imported_indirect.carbon index 1588165ccdd9..d885b01d5839 100644 --- a/toolchain/check/testdata/namespace/imported_indirect.carbon +++ b/toolchain/check/testdata/namespace/imported_indirect.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/imported_indirect.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/imported_indirect.carbon // --- a.carbon diff --git a/toolchain/check/testdata/namespace/merging.carbon b/toolchain/check/testdata/namespace/merging.carbon index c4aee3113aa4..21b5ef5090fb 100644 --- a/toolchain/check/testdata/namespace/merging.carbon +++ b/toolchain/check/testdata/namespace/merging.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/merging.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/merging.carbon // --- a.carbon diff --git a/toolchain/check/testdata/namespace/nested.carbon b/toolchain/check/testdata/namespace/nested.carbon index 29b2afcb84b6..7a8631f75dc9 100644 --- a/toolchain/check/testdata/namespace/nested.carbon +++ b/toolchain/check/testdata/namespace/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/nested.carbon namespace Foo; namespace Foo.Bar; diff --git a/toolchain/check/testdata/namespace/shadow.carbon b/toolchain/check/testdata/namespace/shadow.carbon index 3d4182be8563..bb990047d958 100644 --- a/toolchain/check/testdata/namespace/shadow.carbon +++ b/toolchain/check/testdata/namespace/shadow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/shadow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/shadow.carbon fn A(); @@ -42,24 +46,24 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .Core = %Core -// CHECK:STDOUT: .A = %A.decl.loc7 +// CHECK:STDOUT: .A = %A.decl.loc11 // CHECK:STDOUT: .N = %N // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %A.decl.loc7: A = fn_decl @A.1 [template = constants.%struct.1] {} +// CHECK:STDOUT: %A.decl.loc11: A = fn_decl @A.1 [template = constants.%struct.1] {} // CHECK:STDOUT: %N: = namespace [template] { -// CHECK:STDOUT: .A = %A.decl.loc10 +// CHECK:STDOUT: .A = %A.decl.loc14 // CHECK:STDOUT: .M = %M // CHECK:STDOUT: } -// CHECK:STDOUT: %A.decl.loc10: A = fn_decl @A.2 [template = constants.%struct.2] {} +// CHECK:STDOUT: %A.decl.loc14: A = fn_decl @A.2 [template = constants.%struct.2] {} // CHECK:STDOUT: %M: = namespace [template] { // CHECK:STDOUT: .B = %B.decl // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.4] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32, %.loc14_15.1 [template = i32] +// CHECK:STDOUT: %.loc18_15.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc18_15.2: type = converted %int.make_type_32, %.loc18_15.1 [template = i32] // CHECK:STDOUT: @B.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] @@ -73,25 +77,25 @@ fn N.M.B() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @B() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl.loc10 [template = constants.%struct.2] -// CHECK:STDOUT: %A.call: init () = call %A.ref.loc16() -// CHECK:STDOUT: %.loc17: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc17 br !if.then else br !if.else +// CHECK:STDOUT: %A.ref.loc20: A = name_ref A, file.%A.decl.loc14 [template = constants.%struct.2] +// CHECK:STDOUT: %A.call: init () = call %A.ref.loc20() +// CHECK:STDOUT: %.loc21: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc21 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc18_12.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_12.2: type = converted %int.make_type_32, %.loc18_12.1 [template = i32] +// CHECK:STDOUT: %.loc22_12.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_12.2: type = converted %int.make_type_32, %.loc22_12.1 [template = i32] // CHECK:STDOUT: %A.var: ref i32 = var A // CHECK:STDOUT: %A: ref i32 = bind_name A, %A.var -// CHECK:STDOUT: %.loc18_18: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %A.var, %.loc18_18 -// CHECK:STDOUT: %A.ref.loc21: ref i32 = name_ref A, %A -// CHECK:STDOUT: %.loc21: i32 = bind_value %A.ref.loc21 -// CHECK:STDOUT: return %.loc21 +// CHECK:STDOUT: %.loc22_18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %A.var, %.loc22_18 +// CHECK:STDOUT: %A.ref.loc25: ref i32 = name_ref A, %A +// CHECK:STDOUT: %.loc25: i32 = bind_value %A.ref.loc25 +// CHECK:STDOUT: return %.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: return %.loc23 +// CHECK:STDOUT: %.loc27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: return %.loc27 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/namespace/unqualified_lookup.carbon b/toolchain/check/testdata/namespace/unqualified_lookup.carbon index 943d7f8e33bc..fd6e15993934 100644 --- a/toolchain/check/testdata/namespace/unqualified_lookup.carbon +++ b/toolchain/check/testdata/namespace/unqualified_lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/namespace/unqualified_lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/namespace/unqualified_lookup.carbon namespace OuterN; namespace OuterN.InnerN; diff --git a/toolchain/check/testdata/operators/builtin/and.carbon b/toolchain/check/testdata/operators/builtin/and.carbon index 35b4feb109ee..ce83690097c6 100644 --- a/toolchain/check/testdata/operators/builtin/and.carbon +++ b/toolchain/check/testdata/operators/builtin/and.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/and.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/and.carbon fn F() -> bool { return true; } fn G() -> bool { return true; } @@ -55,23 +59,23 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] -// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] -// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_11.2: type = converted %bool.make_type.loc12, %.loc12_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %And.decl: And = fn_decl @And [template = constants.%struct.4] { -// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] -// CHECK:STDOUT: %.loc10_13.2: type = converted %bool.make_type.loc10, %.loc10_13.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_13.2: type = converted %bool.make_type.loc14, %.loc14_13.1 [template = bool] // CHECK:STDOUT: @And.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] {} @@ -81,11 +85,11 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.6] { -// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] -// CHECK:STDOUT: %.loc21_23.2: type = converted %bool.make_type.loc21, %.loc21_23.1 [template = bool] -// CHECK:STDOUT: %x.loc21_20.1: bool = param x -// CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 +// CHECK:STDOUT: %bool.make_type.loc25: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc25_23.1: type = value_of_initializer %bool.make_type.loc25 [template = bool] +// CHECK:STDOUT: %.loc25_23.2: type = converted %bool.make_type.loc25, %.loc25_23.1 [template = bool] +// CHECK:STDOUT: %x.loc25_20.1: bool = param x +// CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc25_20.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } @@ -94,197 +98,197 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @And() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init bool = call %F.ref() -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call -// CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.3: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc11_14.2 br !and.rhs else br !and.result(%.loc11_14.3) +// CHECK:STDOUT: %.loc15_14.1: bool = value_of_initializer %F.call +// CHECK:STDOUT: %.loc15_14.2: bool = converted %F.call, %.loc15_14.1 +// CHECK:STDOUT: %.loc15_14.3: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc15_14.2 br !and.rhs else br !and.result(%.loc15_14.3) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init bool = call %G.ref() -// CHECK:STDOUT: %.loc11_14.4: bool = value_of_initializer %G.call -// CHECK:STDOUT: %.loc11_14.5: bool = converted %G.call, %.loc11_14.4 -// CHECK:STDOUT: br !and.result(%.loc11_14.5) +// CHECK:STDOUT: %.loc15_14.4: bool = value_of_initializer %G.call +// CHECK:STDOUT: %.loc15_14.5: bool = converted %G.call, %.loc15_14.4 +// CHECK:STDOUT: br !and.result(%.loc15_14.5) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc11_14.6: bool = block_arg !and.result -// CHECK:STDOUT: return %.loc11_14.6 +// CHECK:STDOUT: %.loc15_14.6: bool = block_arg !and.result +// CHECK:STDOUT: return %.loc15_14.6 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc15_18.1: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc15_13 br !and.rhs.loc15 else br !and.result.loc15(%.loc15_18.1) +// CHECK:STDOUT: %.loc19_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc19_18.1: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc19_13 br !and.rhs.loc19 else br !and.result.loc19(%.loc19_18.1) // CHECK:STDOUT: -// CHECK:STDOUT: !and.rhs.loc15: -// CHECK:STDOUT: %.loc15_22: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: br !and.result.loc15(%.loc15_22) +// CHECK:STDOUT: !and.rhs.loc19: +// CHECK:STDOUT: %.loc19_22: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: br !and.result.loc19(%.loc19_22) // CHECK:STDOUT: -// CHECK:STDOUT: !and.result.loc15: -// CHECK:STDOUT: %.loc15_18.2: bool = block_arg !and.result.loc15 [template = constants.%.2] -// CHECK:STDOUT: if %.loc15_18.2 br !if.expr.then.loc15 else br !if.expr.else.loc15 +// CHECK:STDOUT: !and.result.loc19: +// CHECK:STDOUT: %.loc19_18.2: bool = block_arg !and.result.loc19 [template = constants.%.2] +// CHECK:STDOUT: if %.loc19_18.2 br !if.expr.then.loc19 else br !if.expr.else.loc19 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] -// CHECK:STDOUT: %.loc15_32.2: type = converted %bool.make_type.loc15, %.loc15_32.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_32.2) +// CHECK:STDOUT: !if.expr.then.loc19: +// CHECK:STDOUT: %bool.make_type.loc19: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc19_32.1: type = value_of_initializer %bool.make_type.loc19 [template = bool] +// CHECK:STDOUT: %.loc19_32.2: type = converted %bool.make_type.loc19, %.loc19_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_32.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc15: -// CHECK:STDOUT: %.loc15_43: () = tuple_literal () -// CHECK:STDOUT: %.loc15_37: type = converted %.loc15_43, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_37) +// CHECK:STDOUT: !if.expr.else.loc19: +// CHECK:STDOUT: %.loc19_43: () = tuple_literal () +// CHECK:STDOUT: %.loc19_37: type = converted %.loc19_43, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc15: -// CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = bool] +// CHECK:STDOUT: !if.expr.result.loc19: +// CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc15_47: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc15_47 -// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc16_18.1: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc16_13 br !and.rhs.loc16 else br !and.result.loc16(%.loc16_18.1) +// CHECK:STDOUT: %.loc19_47: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc19_47 +// CHECK:STDOUT: %.loc20_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc20_18.1: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc20_13 br !and.rhs.loc20 else br !and.result.loc20(%.loc20_18.1) // CHECK:STDOUT: -// CHECK:STDOUT: !and.rhs.loc16: -// CHECK:STDOUT: %.loc16_22: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: br !and.result.loc16(%.loc16_22) +// CHECK:STDOUT: !and.rhs.loc20: +// CHECK:STDOUT: %.loc20_22: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: br !and.result.loc20(%.loc20_22) // CHECK:STDOUT: -// CHECK:STDOUT: !and.result.loc16: -// CHECK:STDOUT: %.loc16_18.2: bool = block_arg !and.result.loc16 [template = constants.%.3] -// CHECK:STDOUT: if %.loc16_18.2 br !if.expr.then.loc16 else br !if.expr.else.loc16 +// CHECK:STDOUT: !and.result.loc20: +// CHECK:STDOUT: %.loc20_18.2: bool = block_arg !and.result.loc20 [template = constants.%.3] +// CHECK:STDOUT: if %.loc20_18.2 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc16_33.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] -// CHECK:STDOUT: %.loc16_33.2: type = converted %bool.make_type.loc16, %.loc16_33.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_33.2) +// CHECK:STDOUT: !if.expr.then.loc20: +// CHECK:STDOUT: %bool.make_type.loc20: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc20_33.1: type = value_of_initializer %bool.make_type.loc20 [template = bool] +// CHECK:STDOUT: %.loc20_33.2: type = converted %bool.make_type.loc20, %.loc20_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_33.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc16: -// CHECK:STDOUT: %.loc16_44: () = tuple_literal () -// CHECK:STDOUT: %.loc16_38: type = converted %.loc16_44, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_38) +// CHECK:STDOUT: !if.expr.else.loc20: +// CHECK:STDOUT: %.loc20_44: () = tuple_literal () +// CHECK:STDOUT: %.loc20_38: type = converted %.loc20_44, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_38) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc16: -// CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = constants.%.1] +// CHECK:STDOUT: !if.expr.result.loc20: +// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %.loc16_49.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_49.2: init () = tuple_init () to %b.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc16_50: init () = converted %.loc16_49.1, %.loc16_49.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %b.var, %.loc16_50 -// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc17_19.1: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc17_13 br !and.rhs.loc17 else br !and.result.loc17(%.loc17_19.1) +// CHECK:STDOUT: %.loc20_49.1: () = tuple_literal () +// CHECK:STDOUT: %.loc20_49.2: init () = tuple_init () to %b.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc20_50: init () = converted %.loc20_49.1, %.loc20_49.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %b.var, %.loc20_50 +// CHECK:STDOUT: %.loc21_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc21_19.1: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc21_13 br !and.rhs.loc21 else br !and.result.loc21(%.loc21_19.1) // CHECK:STDOUT: -// CHECK:STDOUT: !and.rhs.loc17: -// CHECK:STDOUT: %.loc17_23: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: br !and.result.loc17(%.loc17_23) +// CHECK:STDOUT: !and.rhs.loc21: +// CHECK:STDOUT: %.loc21_23: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: br !and.result.loc21(%.loc21_23) // CHECK:STDOUT: -// CHECK:STDOUT: !and.result.loc17: -// CHECK:STDOUT: %.loc17_19.2: bool = block_arg !and.result.loc17 [template = constants.%.3] -// CHECK:STDOUT: if %.loc17_19.2 br !if.expr.then.loc17 else br !if.expr.else.loc17 +// CHECK:STDOUT: !and.result.loc21: +// CHECK:STDOUT: %.loc21_19.2: bool = block_arg !and.result.loc21 [template = constants.%.3] +// CHECK:STDOUT: if %.loc21_19.2 br !if.expr.then.loc21 else br !if.expr.else.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc17: -// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc17_33.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] -// CHECK:STDOUT: %.loc17_33.2: type = converted %bool.make_type.loc17, %.loc17_33.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_33.2) +// CHECK:STDOUT: !if.expr.then.loc21: +// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc21_33.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] +// CHECK:STDOUT: %.loc21_33.2: type = converted %bool.make_type.loc21, %.loc21_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc21(%.loc21_33.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc17: -// CHECK:STDOUT: %.loc17_44: () = tuple_literal () -// CHECK:STDOUT: %.loc17_38: type = converted %.loc17_44, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_38) +// CHECK:STDOUT: !if.expr.else.loc21: +// CHECK:STDOUT: %.loc21_44: () = tuple_literal () +// CHECK:STDOUT: %.loc21_38: type = converted %.loc21_44, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc21(%.loc21_38) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc17: -// CHECK:STDOUT: %.loc17_10: type = block_arg !if.expr.result.loc17 [template = constants.%.1] +// CHECK:STDOUT: !if.expr.result.loc21: +// CHECK:STDOUT: %.loc21_10: type = block_arg !if.expr.result.loc21 [template = constants.%.1] // CHECK:STDOUT: %c.var: ref () = var c // CHECK:STDOUT: %c: ref () = bind_name c, %c.var -// CHECK:STDOUT: %.loc17_49.1: () = tuple_literal () -// CHECK:STDOUT: %.loc17_49.2: init () = tuple_init () to %c.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc17_50: init () = converted %.loc17_49.1, %.loc17_49.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %c.var, %.loc17_50 -// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc18_19.1: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc18_13 br !and.rhs.loc18 else br !and.result.loc18(%.loc18_19.1) +// CHECK:STDOUT: %.loc21_49.1: () = tuple_literal () +// CHECK:STDOUT: %.loc21_49.2: init () = tuple_init () to %c.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc21_50: init () = converted %.loc21_49.1, %.loc21_49.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %c.var, %.loc21_50 +// CHECK:STDOUT: %.loc22_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc22_19.1: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc22_13 br !and.rhs.loc22 else br !and.result.loc22(%.loc22_19.1) // CHECK:STDOUT: -// CHECK:STDOUT: !and.rhs.loc18: -// CHECK:STDOUT: %.loc18_23: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: br !and.result.loc18(%.loc18_23) +// CHECK:STDOUT: !and.rhs.loc22: +// CHECK:STDOUT: %.loc22_23: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: br !and.result.loc22(%.loc22_23) // CHECK:STDOUT: -// CHECK:STDOUT: !and.result.loc18: -// CHECK:STDOUT: %.loc18_19.2: bool = block_arg !and.result.loc18 [template = constants.%.3] -// CHECK:STDOUT: if %.loc18_19.2 br !if.expr.then.loc18 else br !if.expr.else.loc18 +// CHECK:STDOUT: !and.result.loc22: +// CHECK:STDOUT: %.loc22_19.2: bool = block_arg !and.result.loc22 [template = constants.%.3] +// CHECK:STDOUT: if %.loc22_19.2 br !if.expr.then.loc22 else br !if.expr.else.loc22 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc18: -// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc18_34.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] -// CHECK:STDOUT: %.loc18_34.2: type = converted %bool.make_type.loc18, %.loc18_34.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_34.2) +// CHECK:STDOUT: !if.expr.then.loc22: +// CHECK:STDOUT: %bool.make_type.loc22: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_34.1: type = value_of_initializer %bool.make_type.loc22 [template = bool] +// CHECK:STDOUT: %.loc22_34.2: type = converted %bool.make_type.loc22, %.loc22_34.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_34.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc18: -// CHECK:STDOUT: %.loc18_45: () = tuple_literal () -// CHECK:STDOUT: %.loc18_39: type = converted %.loc18_45, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_39) +// CHECK:STDOUT: !if.expr.else.loc22: +// CHECK:STDOUT: %.loc22_45: () = tuple_literal () +// CHECK:STDOUT: %.loc22_39: type = converted %.loc22_45, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_39) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc18: -// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.1] +// CHECK:STDOUT: !if.expr.result.loc22: +// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result.loc22 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var -// CHECK:STDOUT: %.loc18_50.1: () = tuple_literal () -// CHECK:STDOUT: %.loc18_50.2: init () = tuple_init () to %d.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc18_51: init () = converted %.loc18_50.1, %.loc18_50.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %d.var, %.loc18_51 +// CHECK:STDOUT: %.loc22_50.1: () = tuple_literal () +// CHECK:STDOUT: %.loc22_50.2: init () = tuple_init () to %d.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc22_51: init () = converted %.loc22_50.1, %.loc22_50.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %d.var, %.loc22_51 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_13: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc22_19.1: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: if %.loc22_13 br !and.rhs else br !and.result(%.loc22_19.1) +// CHECK:STDOUT: %.loc26_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc26_19.1: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: if %.loc26_13 br !and.rhs else br !and.result(%.loc26_19.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: // CHECK:STDOUT: %x.ref: bool = name_ref x, %x // CHECK:STDOUT: br !and.result(%x.ref) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc22_19.2: bool = block_arg !and.result [template = constants.%.3] -// CHECK:STDOUT: if %.loc22_19.2 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %.loc26_19.2: bool = block_arg !and.result [template = constants.%.3] +// CHECK:STDOUT: if %.loc26_19.2 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc22_30.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc22_30.2: type = converted %bool.make_type, %.loc22_30.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result(%.loc22_30.2) +// CHECK:STDOUT: %.loc26_30.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc26_30.2: type = converted %bool.make_type, %.loc26_30.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result(%.loc26_30.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %.loc22_41: () = tuple_literal () -// CHECK:STDOUT: %.loc22_35: type = converted %.loc22_41, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result(%.loc22_35) +// CHECK:STDOUT: %.loc26_41: () = tuple_literal () +// CHECK:STDOUT: %.loc26_35: type = converted %.loc26_41, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result(%.loc26_35) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result [template = constants.%.1] +// CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.loc22_46.1: () = tuple_literal () -// CHECK:STDOUT: %.loc22_46.2: init () = tuple_init () to %a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc22_47: init () = converted %.loc22_46.1, %.loc22_46.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %a.var, %.loc22_47 +// CHECK:STDOUT: %.loc26_46.1: () = tuple_literal () +// CHECK:STDOUT: %.loc26_46.2: init () = tuple_init () to %a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc26_47: init () = converted %.loc26_46.1, %.loc26_46.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %a.var, %.loc26_47 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/assignment.carbon b/toolchain/check/testdata/operators/builtin/assignment.carbon index a0ceb769613f..29a623341a95 100644 --- a/toolchain/check/testdata/operators/builtin/assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/assignment.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/assignment.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/assignment.carbon fn Main() { var a: i32 = 12; @@ -67,105 +71,105 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 12 [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc8_16 -// CHECK:STDOUT: %a.ref.loc9: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc9: i32 = int_literal 9 [template = constants.%.3] -// CHECK:STDOUT: assign %a.ref.loc9, %.loc9 -// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_19.1: (type, type) = tuple_literal (%int.make_type_32.loc11_11, %int.make_type_32.loc11_16) -// CHECK:STDOUT: %.loc11_19.2: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] -// CHECK:STDOUT: %.loc11_19.3: type = converted %int.make_type_32.loc11_11, %.loc11_19.2 [template = i32] -// CHECK:STDOUT: %.loc11_19.4: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] -// CHECK:STDOUT: %.loc11_19.5: type = converted %int.make_type_32.loc11_16, %.loc11_19.4 [template = i32] -// CHECK:STDOUT: %.loc11_19.6: type = converted %.loc11_19.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc12_16 +// CHECK:STDOUT: %a.ref.loc13: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc13: i32 = int_literal 9 [template = constants.%.3] +// CHECK:STDOUT: assign %a.ref.loc13, %.loc13 +// CHECK:STDOUT: %int.make_type_32.loc15_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_19.1: (type, type) = tuple_literal (%int.make_type_32.loc15_11, %int.make_type_32.loc15_16) +// CHECK:STDOUT: %.loc15_19.2: type = value_of_initializer %int.make_type_32.loc15_11 [template = i32] +// CHECK:STDOUT: %.loc15_19.3: type = converted %int.make_type_32.loc15_11, %.loc15_19.2 [template = i32] +// CHECK:STDOUT: %.loc15_19.4: type = value_of_initializer %int.make_type_32.loc15_16 [template = i32] +// CHECK:STDOUT: %.loc15_19.5: type = converted %int.make_type_32.loc15_16, %.loc15_19.4 [template = i32] +// CHECK:STDOUT: %.loc15_19.6: type = converted %.loc15_19.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %b.var: ref (i32, i32) = var b // CHECK:STDOUT: %b: ref (i32, i32) = bind_name b, %b.var -// CHECK:STDOUT: %.loc11_24: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_27: i32 = int_literal 2 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_28.1: (i32, i32) = tuple_literal (%.loc11_24, %.loc11_27) -// CHECK:STDOUT: %.loc11_28.2: ref i32 = tuple_access %b.var, element0 -// CHECK:STDOUT: %.loc11_28.3: init i32 = initialize_from %.loc11_24 to %.loc11_28.2 [template = constants.%.7] -// CHECK:STDOUT: %.loc11_28.4: ref i32 = tuple_access %b.var, element1 -// CHECK:STDOUT: %.loc11_28.5: init i32 = initialize_from %.loc11_27 to %.loc11_28.4 [template = constants.%.8] -// CHECK:STDOUT: %.loc11_28.6: init (i32, i32) = tuple_init (%.loc11_28.3, %.loc11_28.5) to %b.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_29: init (i32, i32) = converted %.loc11_28.1, %.loc11_28.6 [template = constants.%tuple] -// CHECK:STDOUT: assign %b.var, %.loc11_29 -// CHECK:STDOUT: %b.ref.loc12: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc12_5: i32 = int_literal 0 [template = constants.%.9] -// CHECK:STDOUT: %.loc12_6: ref i32 = tuple_index %b.ref.loc12, %.loc12_5 -// CHECK:STDOUT: %.loc12_10: i32 = int_literal 3 [template = constants.%.10] -// CHECK:STDOUT: assign %.loc12_6, %.loc12_10 -// CHECK:STDOUT: %b.ref.loc13: ref (i32, i32) = name_ref b, %b -// CHECK:STDOUT: %.loc13_5: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc13_6: ref i32 = tuple_index %b.ref.loc13, %.loc13_5 -// CHECK:STDOUT: %.loc13_10: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: assign %.loc13_6, %.loc13_10 -// CHECK:STDOUT: %int.make_type_32.loc15_15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %int.make_type_32.loc15_15 [template = i32] -// CHECK:STDOUT: %.loc15_15.2: type = converted %int.make_type_32.loc15_15, %.loc15_15.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc15_24: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %int.make_type_32.loc15_24 [template = i32] -// CHECK:STDOUT: %.loc15_24.2: type = converted %int.make_type_32.loc15_24, %.loc15_24.1 [template = i32] -// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.12] +// CHECK:STDOUT: %.loc15_24: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_27: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc15_28.1: (i32, i32) = tuple_literal (%.loc15_24, %.loc15_27) +// CHECK:STDOUT: %.loc15_28.2: ref i32 = tuple_access %b.var, element0 +// CHECK:STDOUT: %.loc15_28.3: init i32 = initialize_from %.loc15_24 to %.loc15_28.2 [template = constants.%.7] +// CHECK:STDOUT: %.loc15_28.4: ref i32 = tuple_access %b.var, element1 +// CHECK:STDOUT: %.loc15_28.5: init i32 = initialize_from %.loc15_27 to %.loc15_28.4 [template = constants.%.8] +// CHECK:STDOUT: %.loc15_28.6: init (i32, i32) = tuple_init (%.loc15_28.3, %.loc15_28.5) to %b.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc15_29: init (i32, i32) = converted %.loc15_28.1, %.loc15_28.6 [template = constants.%tuple] +// CHECK:STDOUT: assign %b.var, %.loc15_29 +// CHECK:STDOUT: %b.ref.loc16: ref (i32, i32) = name_ref b, %b +// CHECK:STDOUT: %.loc16_5: i32 = int_literal 0 [template = constants.%.9] +// CHECK:STDOUT: %.loc16_6: ref i32 = tuple_index %b.ref.loc16, %.loc16_5 +// CHECK:STDOUT: %.loc16_10: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: assign %.loc16_6, %.loc16_10 +// CHECK:STDOUT: %b.ref.loc17: ref (i32, i32) = name_ref b, %b +// CHECK:STDOUT: %.loc17_5: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc17_6: ref i32 = tuple_index %b.ref.loc17, %.loc17_5 +// CHECK:STDOUT: %.loc17_10: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: assign %.loc17_6, %.loc17_10 +// CHECK:STDOUT: %int.make_type_32.loc19_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_15.1: type = value_of_initializer %int.make_type_32.loc19_15 [template = i32] +// CHECK:STDOUT: %.loc19_15.2: type = converted %int.make_type_32.loc19_15, %.loc19_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc19_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_24.1: type = value_of_initializer %int.make_type_32.loc19_24 [template = i32] +// CHECK:STDOUT: %.loc19_24.2: type = converted %int.make_type_32.loc19_24, %.loc19_24.1 [template = i32] +// CHECK:STDOUT: %.loc19_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.12] // CHECK:STDOUT: %c.var: ref {.a: i32, .b: i32} = var c // CHECK:STDOUT: %c: ref {.a: i32, .b: i32} = bind_name c, %c.var -// CHECK:STDOUT: %.loc15_37: i32 = int_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_45: i32 = int_literal 2 [template = constants.%.8] -// CHECK:STDOUT: %.loc15_46.1: {.a: i32, .b: i32} = struct_literal (%.loc15_37, %.loc15_45) -// CHECK:STDOUT: %.loc15_46.2: ref i32 = struct_access %c.var, element0 -// CHECK:STDOUT: %.loc15_46.3: init i32 = initialize_from %.loc15_37 to %.loc15_46.2 [template = constants.%.7] -// CHECK:STDOUT: %.loc15_46.4: ref i32 = struct_access %c.var, element1 -// CHECK:STDOUT: %.loc15_46.5: init i32 = initialize_from %.loc15_45 to %.loc15_46.4 [template = constants.%.8] -// CHECK:STDOUT: %.loc15_46.6: init {.a: i32, .b: i32} = struct_init (%.loc15_46.3, %.loc15_46.5) to %c.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_47: init {.a: i32, .b: i32} = converted %.loc15_46.1, %.loc15_46.6 [template = constants.%struct.3] -// CHECK:STDOUT: assign %c.var, %.loc15_47 -// CHECK:STDOUT: %c.ref.loc16: ref {.a: i32, .b: i32} = name_ref c, %c -// CHECK:STDOUT: %.loc16_4: ref i32 = struct_access %c.ref.loc16, element0 -// CHECK:STDOUT: %.loc16_9: i32 = int_literal 3 [template = constants.%.10] -// CHECK:STDOUT: assign %.loc16_4, %.loc16_9 -// CHECK:STDOUT: %c.ref.loc17: ref {.a: i32, .b: i32} = name_ref c, %c -// CHECK:STDOUT: %.loc17_4: ref i32 = struct_access %c.ref.loc17, element1 -// CHECK:STDOUT: %.loc17_9: i32 = int_literal 4 [template = constants.%.11] -// CHECK:STDOUT: assign %.loc17_4, %.loc17_9 -// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc19_13.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] -// CHECK:STDOUT: %.loc19_13.2: type = converted %int.make_type_32.loc19, %.loc19_13.1 [template = i32] -// CHECK:STDOUT: %.loc19_13.3: type = ptr_type i32 [template = constants.%.14] +// CHECK:STDOUT: %.loc19_37: i32 = int_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_45: i32 = int_literal 2 [template = constants.%.8] +// CHECK:STDOUT: %.loc19_46.1: {.a: i32, .b: i32} = struct_literal (%.loc19_37, %.loc19_45) +// CHECK:STDOUT: %.loc19_46.2: ref i32 = struct_access %c.var, element0 +// CHECK:STDOUT: %.loc19_46.3: init i32 = initialize_from %.loc19_37 to %.loc19_46.2 [template = constants.%.7] +// CHECK:STDOUT: %.loc19_46.4: ref i32 = struct_access %c.var, element1 +// CHECK:STDOUT: %.loc19_46.5: init i32 = initialize_from %.loc19_45 to %.loc19_46.4 [template = constants.%.8] +// CHECK:STDOUT: %.loc19_46.6: init {.a: i32, .b: i32} = struct_init (%.loc19_46.3, %.loc19_46.5) to %c.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_47: init {.a: i32, .b: i32} = converted %.loc19_46.1, %.loc19_46.6 [template = constants.%struct.3] +// CHECK:STDOUT: assign %c.var, %.loc19_47 +// CHECK:STDOUT: %c.ref.loc20: ref {.a: i32, .b: i32} = name_ref c, %c +// CHECK:STDOUT: %.loc20_4: ref i32 = struct_access %c.ref.loc20, element0 +// CHECK:STDOUT: %.loc20_9: i32 = int_literal 3 [template = constants.%.10] +// CHECK:STDOUT: assign %.loc20_4, %.loc20_9 +// CHECK:STDOUT: %c.ref.loc21: ref {.a: i32, .b: i32} = name_ref c, %c +// CHECK:STDOUT: %.loc21_4: ref i32 = struct_access %c.ref.loc21, element1 +// CHECK:STDOUT: %.loc21_9: i32 = int_literal 4 [template = constants.%.11] +// CHECK:STDOUT: assign %.loc21_4, %.loc21_9 +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc23_13.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_13.2: type = converted %int.make_type_32.loc23, %.loc23_13.1 [template = i32] +// CHECK:STDOUT: %.loc23_13.3: type = ptr_type i32 [template = constants.%.14] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var -// CHECK:STDOUT: %a.ref.loc19: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc19_17: i32* = addr_of %a.ref.loc19 -// CHECK:STDOUT: assign %p.var, %.loc19_17 -// CHECK:STDOUT: %p.ref.loc20: ref i32* = name_ref p, %p -// CHECK:STDOUT: %.loc20_4: i32* = bind_value %p.ref.loc20 -// CHECK:STDOUT: %.loc20_3: ref i32 = deref %.loc20_4 -// CHECK:STDOUT: %.loc20_8: i32 = int_literal 5 [template = constants.%.15] -// CHECK:STDOUT: assign %.loc20_3, %.loc20_8 -// CHECK:STDOUT: %.loc22_8: bool = bool_literal true [template = constants.%.16] -// CHECK:STDOUT: if %.loc22_8 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %a.ref.loc23: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc23_17: i32* = addr_of %a.ref.loc23 +// CHECK:STDOUT: assign %p.var, %.loc23_17 +// CHECK:STDOUT: %p.ref.loc24: ref i32* = name_ref p, %p +// CHECK:STDOUT: %.loc24_4: i32* = bind_value %p.ref.loc24 +// CHECK:STDOUT: %.loc24_3: ref i32 = deref %.loc24_4 +// CHECK:STDOUT: %.loc24_8: i32 = int_literal 5 [template = constants.%.15] +// CHECK:STDOUT: assign %.loc24_3, %.loc24_8 +// CHECK:STDOUT: %.loc26_8: bool = bool_literal true [template = constants.%.16] +// CHECK:STDOUT: if %.loc26_8 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: -// CHECK:STDOUT: %p.ref.loc22: ref i32* = name_ref p, %p -// CHECK:STDOUT: %.loc22_18: i32* = bind_value %p.ref.loc22 -// CHECK:STDOUT: br !if.expr.result(%.loc22_18) +// CHECK:STDOUT: %p.ref.loc26: ref i32* = name_ref p, %p +// CHECK:STDOUT: %.loc26_18: i32* = bind_value %p.ref.loc26 +// CHECK:STDOUT: br !if.expr.result(%.loc26_18) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %a.ref.loc22: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc22_25: i32* = addr_of %a.ref.loc22 -// CHECK:STDOUT: br !if.expr.result(%.loc22_25) +// CHECK:STDOUT: %a.ref.loc26: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc26_25: i32* = addr_of %a.ref.loc26 +// CHECK:STDOUT: br !if.expr.result(%.loc26_25) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc22_5: i32* = block_arg !if.expr.result -// CHECK:STDOUT: %.loc22_3: ref i32 = deref %.loc22_5 -// CHECK:STDOUT: %.loc22_31: i32 = int_literal 10 [template = constants.%.17] -// CHECK:STDOUT: assign %.loc22_3, %.loc22_31 +// CHECK:STDOUT: %.loc26_5: i32* = block_arg !if.expr.result +// CHECK:STDOUT: %.loc26_3: ref i32 = deref %.loc26_5 +// CHECK:STDOUT: %.loc26_31: i32 = int_literal 10 [template = constants.%.17] +// CHECK:STDOUT: assign %.loc26_3, %.loc26_31 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon index 264910c69c46..e2ce21bf786e 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon // TODO: Make this a compile-time function. fn F(b: bool) -> type { @@ -55,10 +59,10 @@ var or_: F(true or true); // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: file { -// CHECK:STDOUT: %.loc38_17: bool = block_arg [template = constants.%.3] -// CHECK:STDOUT: %F.call: init type = call (%.loc38_17) -// CHECK:STDOUT: %.loc38_24.1: type = value_of_initializer %F.call -// CHECK:STDOUT: %.loc38_24.2: type = converted %F.call, %.loc38_24.1 +// CHECK:STDOUT: %.loc42_17: bool = block_arg [template = constants.%.3] +// CHECK:STDOUT: %F.call: init type = call (%.loc42_17) +// CHECK:STDOUT: %.loc42_24.1: type = value_of_initializer %F.call +// CHECK:STDOUT: %.loc42_24.2: type = converted %F.call, %.loc42_24.1 // CHECK:STDOUT: %or_.var: ref = var or_ // CHECK:STDOUT: %or_: ref = bind_name or_, %or_.var // CHECK:STDOUT: } @@ -72,20 +76,20 @@ var or_: F(true or true); // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc9_20.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_20.2: type = converted %int.make_type_32, %.loc9_20.1 [template = i32] -// CHECK:STDOUT: br !if.expr.result(%.loc9_20.2) +// CHECK:STDOUT: %.loc13_20.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_20.2: type = converted %int.make_type_32, %.loc13_20.1 [template = i32] +// CHECK:STDOUT: br !if.expr.result(%.loc13_20.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %.loc9_29: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.4(%.loc9_29) [template = f64] -// CHECK:STDOUT: %.loc9_24.1: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc9_24.2: type = converted %float.make_type, %.loc9_24.1 [template = f64] -// CHECK:STDOUT: br !if.expr.result(%.loc9_24.2) +// CHECK:STDOUT: %.loc13_29: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.4(%.loc13_29) [template = f64] +// CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc13_24.2: type = converted %float.make_type, %.loc13_24.1 [template = f64] +// CHECK:STDOUT: br !if.expr.result(%.loc13_24.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc9_10: type = block_arg !if.expr.result -// CHECK:STDOUT: return %.loc9_10 +// CHECK:STDOUT: %.loc13_10: type = block_arg !if.expr.result +// CHECK:STDOUT: return %.loc13_10 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; diff --git a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon index 7335baa0c221..80eeb6a6617a 100644 --- a/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon // --- fail_non_constant_result.carbon diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon index 874aa7b1c814..69b1b312fab5 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon fn Main() { // CHECK:STDERR: fail_assignment_to_error.carbon:[[@LINE+4]]:3: ERROR: Name `undeclared` not found. @@ -37,12 +41,12 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %undeclared.ref: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc12: i32 = int_literal 42 [template = constants.%.2] +// CHECK:STDOUT: %.loc16: i32 = int_literal 42 [template = constants.%.2] // CHECK:STDOUT: assign %undeclared.ref, // CHECK:STDOUT: %also_undeclared.ref: = name_ref also_undeclared, [template = ] -// CHECK:STDOUT: %.loc16_3: ref = deref -// CHECK:STDOUT: %.loc16_22: i32 = int_literal 42 [template = constants.%.2] -// CHECK:STDOUT: assign %.loc16_3, +// CHECK:STDOUT: %.loc20_3: ref = deref +// CHECK:STDOUT: %.loc20_22: i32 = int_literal 42 [template = constants.%.2] +// CHECK:STDOUT: assign %.loc20_3, // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon index 34437c304976..fd27f0400a18 100644 --- a/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon fn F() -> i32; @@ -90,8 +94,8 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} @@ -107,110 +111,110 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_3: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc14_7: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: assign %.loc14_3, %.loc14_7 +// CHECK:STDOUT: %.loc18_3: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc18_7: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: assign %.loc18_3, %.loc18_7 // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: %.loc19: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: assign %F.call, %.loc19 -// CHECK:STDOUT: %.loc24_4: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc24_7: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc24_8.1: (i32, i32) = tuple_literal (%.loc24_4, %.loc24_7) -// CHECK:STDOUT: %.loc24_13: i32 = int_literal 3 [template = constants.%.5] -// CHECK:STDOUT: %.loc24_16: i32 = int_literal 4 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_17.1: (i32, i32) = tuple_literal (%.loc24_13, %.loc24_16) -// CHECK:STDOUT: %.loc24_17.2: i32 = tuple_access %.loc24_8.1, element0 -// CHECK:STDOUT: %.loc24_17.3: init i32 = initialize_from %.loc24_13 to %.loc24_17.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc24_17.4: i32 = tuple_access %.loc24_8.1, element1 -// CHECK:STDOUT: %.loc24_17.5: init i32 = initialize_from %.loc24_16 to %.loc24_17.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc24_17.6: init (i32, i32) = tuple_init (%.loc24_17.3, %.loc24_17.5) to %.loc24_8.1 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc24_10: init (i32, i32) = converted %.loc24_17.1, %.loc24_17.6 [template = constants.%tuple.1] -// CHECK:STDOUT: assign %.loc24_8.1, %.loc24_10 -// CHECK:STDOUT: %tuple.loc24: (i32, i32) = tuple_value (%.loc24_4, %.loc24_7) [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc24_8.2: (i32, i32) = converted %.loc24_8.1, %tuple.loc24 [template = constants.%tuple.2] -// CHECK:STDOUT: %int.make_type_32.loc25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc25_10.1: type = value_of_initializer %int.make_type_32.loc25 [template = i32] -// CHECK:STDOUT: %.loc25_10.2: type = converted %int.make_type_32.loc25, %.loc25_10.1 [template = i32] +// CHECK:STDOUT: %.loc23: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: assign %F.call, %.loc23 +// CHECK:STDOUT: %.loc28_4: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc28_7: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc28_8.1: (i32, i32) = tuple_literal (%.loc28_4, %.loc28_7) +// CHECK:STDOUT: %.loc28_13: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc28_16: i32 = int_literal 4 [template = constants.%.6] +// CHECK:STDOUT: %.loc28_17.1: (i32, i32) = tuple_literal (%.loc28_13, %.loc28_16) +// CHECK:STDOUT: %.loc28_17.2: i32 = tuple_access %.loc28_8.1, element0 +// CHECK:STDOUT: %.loc28_17.3: init i32 = initialize_from %.loc28_13 to %.loc28_17.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc28_17.4: i32 = tuple_access %.loc28_8.1, element1 +// CHECK:STDOUT: %.loc28_17.5: init i32 = initialize_from %.loc28_16 to %.loc28_17.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc28_17.6: init (i32, i32) = tuple_init (%.loc28_17.3, %.loc28_17.5) to %.loc28_8.1 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc28_10: init (i32, i32) = converted %.loc28_17.1, %.loc28_17.6 [template = constants.%tuple.1] +// CHECK:STDOUT: assign %.loc28_8.1, %.loc28_10 +// CHECK:STDOUT: %tuple.loc28: (i32, i32) = tuple_value (%.loc28_4, %.loc28_7) [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc28_8.2: (i32, i32) = converted %.loc28_8.1, %tuple.loc28 [template = constants.%tuple.2] +// CHECK:STDOUT: %int.make_type_32.loc29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc29_10.1: type = value_of_initializer %int.make_type_32.loc29 [template = i32] +// CHECK:STDOUT: %.loc29_10.2: type = converted %int.make_type_32.loc29, %.loc29_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc25_16: i32 = int_literal 0 [template = constants.%.8] -// CHECK:STDOUT: assign %n.var, %.loc25_16 -// CHECK:STDOUT: %n.ref.loc30_4: ref i32 = name_ref n, %n -// CHECK:STDOUT: %n.ref.loc30_7: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc30_8.1: (i32, i32) = tuple_literal (%n.ref.loc30_4, %n.ref.loc30_7) -// CHECK:STDOUT: %.loc30_13: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_16: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc30_17.1: (i32, i32) = tuple_literal (%.loc30_13, %.loc30_16) -// CHECK:STDOUT: %.loc30_17.2: i32 = tuple_access %.loc30_8.1, element0 -// CHECK:STDOUT: %.loc30_17.3: init i32 = initialize_from %.loc30_13 to %.loc30_17.2 [template = constants.%.2] -// CHECK:STDOUT: %.loc30_17.4: i32 = tuple_access %.loc30_8.1, element1 -// CHECK:STDOUT: %.loc30_17.5: init i32 = initialize_from %.loc30_16 to %.loc30_17.4 [template = constants.%.3] -// CHECK:STDOUT: %.loc30_17.6: init (i32, i32) = tuple_init (%.loc30_17.3, %.loc30_17.5) to %.loc30_8.1 [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc30_10: init (i32, i32) = converted %.loc30_17.1, %.loc30_17.6 [template = constants.%tuple.2] -// CHECK:STDOUT: assign %.loc30_8.1, %.loc30_10 -// CHECK:STDOUT: %.loc30_4: i32 = bind_value %n.ref.loc30_4 -// CHECK:STDOUT: %.loc30_7: i32 = bind_value %n.ref.loc30_7 -// CHECK:STDOUT: %tuple.loc30: (i32, i32) = tuple_value (%.loc30_4, %.loc30_7) -// CHECK:STDOUT: %.loc30_8.2: (i32, i32) = converted %.loc30_8.1, %tuple.loc30 -// CHECK:STDOUT: %int.make_type_32.loc35_3: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc35_9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc35_12.1: type = value_of_initializer %int.make_type_32.loc35_9 [template = i32] -// CHECK:STDOUT: %.loc35_12.2: type = converted %int.make_type_32.loc35_9, %.loc35_12.1 [template = i32] -// CHECK:STDOUT: %.loc35_12.3: type = ptr_type i32 [template = constants.%.9] -// CHECK:STDOUT: assign %int.make_type_32.loc35_3, %.loc35_12.3 -// CHECK:STDOUT: %.loc40_9: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc40_17: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: %.loc40_18.1: {.x: i32, .y: i32} = struct_literal (%.loc40_9, %.loc40_17) -// CHECK:STDOUT: %.loc40_28: i32 = int_literal 3 [template = constants.%.5] -// CHECK:STDOUT: %.loc40_36: i32 = int_literal 4 [template = constants.%.6] -// CHECK:STDOUT: %.loc40_37.1: {.x: i32, .y: i32} = struct_literal (%.loc40_28, %.loc40_36) -// CHECK:STDOUT: %.loc40_37.2: i32 = struct_access %.loc40_18.1, element0 -// CHECK:STDOUT: %.loc40_37.3: init i32 = initialize_from %.loc40_28 to %.loc40_37.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc40_37.4: i32 = struct_access %.loc40_18.1, element1 -// CHECK:STDOUT: %.loc40_37.5: init i32 = initialize_from %.loc40_36 to %.loc40_37.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc40_37.6: init {.x: i32, .y: i32} = struct_init (%.loc40_37.3, %.loc40_37.5) to %.loc40_18.1 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc40_20: init {.x: i32, .y: i32} = converted %.loc40_37.1, %.loc40_37.6 [template = constants.%struct.4] -// CHECK:STDOUT: assign %.loc40_18.1, %.loc40_20 -// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc40_9, %.loc40_17) [template = constants.%struct.5] -// CHECK:STDOUT: %.loc40_18.2: {.x: i32, .y: i32} = converted %.loc40_18.1, %struct [template = constants.%struct.5] -// CHECK:STDOUT: %.loc45_7: bool = bool_literal true [template = constants.%.12] -// CHECK:STDOUT: if %.loc45_7 br !if.expr.then.loc45 else br !if.expr.else.loc45 +// CHECK:STDOUT: %.loc29_16: i32 = int_literal 0 [template = constants.%.8] +// CHECK:STDOUT: assign %n.var, %.loc29_16 +// CHECK:STDOUT: %n.ref.loc34_4: ref i32 = name_ref n, %n +// CHECK:STDOUT: %n.ref.loc34_7: ref i32 = name_ref n, %n +// CHECK:STDOUT: %.loc34_8.1: (i32, i32) = tuple_literal (%n.ref.loc34_4, %n.ref.loc34_7) +// CHECK:STDOUT: %.loc34_13: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc34_16: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc34_17.1: (i32, i32) = tuple_literal (%.loc34_13, %.loc34_16) +// CHECK:STDOUT: %.loc34_17.2: i32 = tuple_access %.loc34_8.1, element0 +// CHECK:STDOUT: %.loc34_17.3: init i32 = initialize_from %.loc34_13 to %.loc34_17.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc34_17.4: i32 = tuple_access %.loc34_8.1, element1 +// CHECK:STDOUT: %.loc34_17.5: init i32 = initialize_from %.loc34_16 to %.loc34_17.4 [template = constants.%.3] +// CHECK:STDOUT: %.loc34_17.6: init (i32, i32) = tuple_init (%.loc34_17.3, %.loc34_17.5) to %.loc34_8.1 [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc34_10: init (i32, i32) = converted %.loc34_17.1, %.loc34_17.6 [template = constants.%tuple.2] +// CHECK:STDOUT: assign %.loc34_8.1, %.loc34_10 +// CHECK:STDOUT: %.loc34_4: i32 = bind_value %n.ref.loc34_4 +// CHECK:STDOUT: %.loc34_7: i32 = bind_value %n.ref.loc34_7 +// CHECK:STDOUT: %tuple.loc34: (i32, i32) = tuple_value (%.loc34_4, %.loc34_7) +// CHECK:STDOUT: %.loc34_8.2: (i32, i32) = converted %.loc34_8.1, %tuple.loc34 +// CHECK:STDOUT: %int.make_type_32.loc39_3: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc39_9: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc39_12.1: type = value_of_initializer %int.make_type_32.loc39_9 [template = i32] +// CHECK:STDOUT: %.loc39_12.2: type = converted %int.make_type_32.loc39_9, %.loc39_12.1 [template = i32] +// CHECK:STDOUT: %.loc39_12.3: type = ptr_type i32 [template = constants.%.9] +// CHECK:STDOUT: assign %int.make_type_32.loc39_3, %.loc39_12.3 +// CHECK:STDOUT: %.loc44_9: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc44_17: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: %.loc44_18.1: {.x: i32, .y: i32} = struct_literal (%.loc44_9, %.loc44_17) +// CHECK:STDOUT: %.loc44_28: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc44_36: i32 = int_literal 4 [template = constants.%.6] +// CHECK:STDOUT: %.loc44_37.1: {.x: i32, .y: i32} = struct_literal (%.loc44_28, %.loc44_36) +// CHECK:STDOUT: %.loc44_37.2: i32 = struct_access %.loc44_18.1, element0 +// CHECK:STDOUT: %.loc44_37.3: init i32 = initialize_from %.loc44_28 to %.loc44_37.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc44_37.4: i32 = struct_access %.loc44_18.1, element1 +// CHECK:STDOUT: %.loc44_37.5: init i32 = initialize_from %.loc44_36 to %.loc44_37.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc44_37.6: init {.x: i32, .y: i32} = struct_init (%.loc44_37.3, %.loc44_37.5) to %.loc44_18.1 [template = constants.%struct.4] +// CHECK:STDOUT: %.loc44_20: init {.x: i32, .y: i32} = converted %.loc44_37.1, %.loc44_37.6 [template = constants.%struct.4] +// CHECK:STDOUT: assign %.loc44_18.1, %.loc44_20 +// CHECK:STDOUT: %struct: {.x: i32, .y: i32} = struct_value (%.loc44_9, %.loc44_17) [template = constants.%struct.5] +// CHECK:STDOUT: %.loc44_18.2: {.x: i32, .y: i32} = converted %.loc44_18.1, %struct [template = constants.%struct.5] +// CHECK:STDOUT: %.loc49_7: bool = bool_literal true [template = constants.%.12] +// CHECK:STDOUT: if %.loc49_7 br !if.expr.then.loc49 else br !if.expr.else.loc49 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc45: -// CHECK:STDOUT: %.loc45_17: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_17) +// CHECK:STDOUT: !if.expr.then.loc49: +// CHECK:STDOUT: %.loc49_17: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_17) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc45: -// CHECK:STDOUT: %.loc45_24: i32 = int_literal 2 [template = constants.%.3] -// CHECK:STDOUT: br !if.expr.result.loc45(%.loc45_24) +// CHECK:STDOUT: !if.expr.else.loc49: +// CHECK:STDOUT: %.loc49_24: i32 = int_literal 2 [template = constants.%.3] +// CHECK:STDOUT: br !if.expr.result.loc49(%.loc49_24) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc45: -// CHECK:STDOUT: %.loc45_4: i32 = block_arg !if.expr.result.loc45 [template = constants.%.2] -// CHECK:STDOUT: %.loc45_29: i32 = int_literal 3 [template = constants.%.5] -// CHECK:STDOUT: assign %.loc45_4, %.loc45_29 -// CHECK:STDOUT: %int.make_type_32.loc48: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc48_10.1: type = value_of_initializer %int.make_type_32.loc48 [template = i32] -// CHECK:STDOUT: %.loc48_10.2: type = converted %int.make_type_32.loc48, %.loc48_10.1 [template = i32] +// CHECK:STDOUT: !if.expr.result.loc49: +// CHECK:STDOUT: %.loc49_4: i32 = block_arg !if.expr.result.loc49 [template = constants.%.2] +// CHECK:STDOUT: %.loc49_29: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: assign %.loc49_4, %.loc49_29 +// CHECK:STDOUT: %int.make_type_32.loc52: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc52_10.1: type = value_of_initializer %int.make_type_32.loc52 [template = i32] +// CHECK:STDOUT: %.loc52_10.2: type = converted %int.make_type_32.loc52, %.loc52_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc52_7: bool = bool_literal true [template = constants.%.12] -// CHECK:STDOUT: if %.loc52_7 br !if.expr.then.loc52 else br !if.expr.else.loc52 +// CHECK:STDOUT: %.loc56_7: bool = bool_literal true [template = constants.%.12] +// CHECK:STDOUT: if %.loc56_7 br !if.expr.then.loc56 else br !if.expr.else.loc56 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc52: -// CHECK:STDOUT: %a.ref.loc52_17: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc52_17: i32 = bind_value %a.ref.loc52_17 -// CHECK:STDOUT: br !if.expr.result.loc52(%.loc52_17) +// CHECK:STDOUT: !if.expr.then.loc56: +// CHECK:STDOUT: %a.ref.loc56_17: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc56_17: i32 = bind_value %a.ref.loc56_17 +// CHECK:STDOUT: br !if.expr.result.loc56(%.loc56_17) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc52: -// CHECK:STDOUT: %a.ref.loc52_24: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc52_24: i32 = bind_value %a.ref.loc52_24 -// CHECK:STDOUT: br !if.expr.result.loc52(%.loc52_24) +// CHECK:STDOUT: !if.expr.else.loc56: +// CHECK:STDOUT: %a.ref.loc56_24: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc56_24: i32 = bind_value %a.ref.loc56_24 +// CHECK:STDOUT: br !if.expr.result.loc56(%.loc56_24) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc52: -// CHECK:STDOUT: %.loc52_4: i32 = block_arg !if.expr.result.loc52 -// CHECK:STDOUT: %.loc52_29: i32 = int_literal 10 [template = constants.%.13] -// CHECK:STDOUT: assign %.loc52_4, %.loc52_29 +// CHECK:STDOUT: !if.expr.result.loc56: +// CHECK:STDOUT: %.loc56_4: i32 = block_arg !if.expr.result.loc56 +// CHECK:STDOUT: %.loc56_29: i32 = int_literal 10 [template = constants.%.13] +// CHECK:STDOUT: assign %.loc56_4, %.loc56_29 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon index b24a6c12fb5b..6737f0d3934a 100644 --- a/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon fn F() -> i32 { return 0; } @@ -43,8 +47,8 @@ fn Main() { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.3] {} @@ -55,29 +59,29 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_10.2: type = converted %int.make_type_32, %.loc10_10.1 [template = i32] +// CHECK:STDOUT: %.loc14_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_10.2: type = converted %int.make_type_32, %.loc14_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: assign %a.var, %.loc10_16 -// CHECK:STDOUT: %a.ref.loc15_3: ref i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc15_7: ref i32 = name_ref a, %a -// CHECK:STDOUT: %a.ref.loc15_10: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc15: i32 = bind_value %a.ref.loc15_10 -// CHECK:STDOUT: assign %a.ref.loc15_3, %.loc15 +// CHECK:STDOUT: %.loc14_16: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: assign %a.var, %.loc14_16 // CHECK:STDOUT: %a.ref.loc19_3: ref i32 = name_ref a, %a // CHECK:STDOUT: %a.ref.loc19_7: ref i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc19_10: ref i32 = name_ref a, %a +// CHECK:STDOUT: %.loc19: i32 = bind_value %a.ref.loc19_10 +// CHECK:STDOUT: assign %a.ref.loc19_3, %.loc19 +// CHECK:STDOUT: %a.ref.loc23_3: ref i32 = name_ref a, %a +// CHECK:STDOUT: %a.ref.loc23_7: ref i32 = name_ref a, %a // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init i32 = call %F.ref() -// CHECK:STDOUT: assign %a.ref.loc19_3, %F.call +// CHECK:STDOUT: assign %a.ref.loc23_3, %F.call // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon index ca65acdd5805..e0822b289dcc 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon fn Main() { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:17: ERROR: Cannot implicitly convert from `i32` to `bool`. @@ -35,12 +39,12 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.2() [template = bool] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc11_10.2: type = converted %bool.make_type, %.loc11_10.1 [template = bool] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc15_10.2: type = converted %bool.make_type, %.loc15_10.1 [template = bool] // CHECK:STDOUT: %x.var: ref bool = var x // CHECK:STDOUT: %x: ref bool = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_21: i32 = int_literal 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_17: = not [template = ] +// CHECK:STDOUT: %.loc15_21: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_17: = not [template = ] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon index ef4855e1d3ca..021b10a899f4 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon fn Main() { var a: i32 = 3; @@ -37,14 +41,14 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %a.var: ref i32 = var a // CHECK:STDOUT: %a: ref i32 = bind_name a, %a.var -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc8_16 +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 3 [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc12_16 // CHECK:STDOUT: %a.ref: ref i32 = name_ref a, %a -// CHECK:STDOUT: %.loc12: f64 = float_literal 5.6000000000000005 [template = constants.%.3] +// CHECK:STDOUT: %.loc16: f64 = float_literal 5.6000000000000005 [template = constants.%.3] // CHECK:STDOUT: assign %a.ref, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon index ddfae358fa38..366ebf9249ec 100644 --- a/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_once.carbon fn Main() -> i32 { // The following line has two mismatches, but after the first, it shouldn't @@ -44,8 +48,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: type = import_ref ir4, inst+1, loaded [template = constants.%.4] @@ -67,9 +71,9 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc17_10: i32 = int_literal 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_15: f64 = float_literal 3.4000000000000004 [template = constants.%.3] -// CHECK:STDOUT: %.loc17_21: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_10: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_15: f64 = float_literal 3.4000000000000004 [template = constants.%.3] +// CHECK:STDOUT: %.loc21_21: i32 = int_literal 12 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon index 6e9894ff11f8..b6f374b1157b 100644 --- a/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +++ b/toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/fail_unimplemented_op.carbon fn Main() -> i32 { // CHECK:STDERR: fail_unimplemented_op.carbon:[[@LINE+3]]:10: ERROR: Cannot access member of interface Add in type i32 that does not implement that interface. @@ -38,8 +42,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: type = import_ref ir4, inst+1, loaded [template = constants.%.4] @@ -60,8 +64,8 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 12 [template = constants.%.2] -// CHECK:STDOUT: %.loc11_15: i32 = int_literal 34 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 12 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_15: i32 = int_literal 34 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/or.carbon b/toolchain/check/testdata/operators/builtin/or.carbon index 7c7d45a839e6..a33b2d00b5b2 100644 --- a/toolchain/check/testdata/operators/builtin/or.carbon +++ b/toolchain/check/testdata/operators/builtin/or.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/or.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/or.carbon fn F() -> bool { return true; } fn G() -> bool { return true; } @@ -55,23 +59,23 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] -// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] { -// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] -// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_11.2: type = converted %bool.make_type.loc12, %.loc12_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Or.decl: Or = fn_decl @Or [template = constants.%struct.4] { -// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc10_12.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] -// CHECK:STDOUT: %.loc10_12.2: type = converted %bool.make_type.loc10, %.loc10_12.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_12.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_12.2: type = converted %bool.make_type.loc14, %.loc14_12.1 [template = bool] // CHECK:STDOUT: @Or.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.5] {} @@ -81,11 +85,11 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %PartialConstant.decl: PartialConstant = fn_decl @PartialConstant [template = constants.%struct.6] { -// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc21_23.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] -// CHECK:STDOUT: %.loc21_23.2: type = converted %bool.make_type.loc21, %.loc21_23.1 [template = bool] -// CHECK:STDOUT: %x.loc21_20.1: bool = param x -// CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc21_20.1 +// CHECK:STDOUT: %bool.make_type.loc25: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc25_23.1: type = value_of_initializer %bool.make_type.loc25 [template = bool] +// CHECK:STDOUT: %.loc25_23.2: type = converted %bool.make_type.loc25, %.loc25_23.1 [template = bool] +// CHECK:STDOUT: %x.loc25_20.1: bool = param x +// CHECK:STDOUT: @PartialConstant.%x: bool = bind_name x, %x.loc25_20.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: } @@ -94,197 +98,197 @@ fn PartialConstant(x: bool) { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: return %.loc7 +// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: return %.loc11 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> bool { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Or() -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] // CHECK:STDOUT: %F.call: init bool = call %F.ref() -// CHECK:STDOUT: %.loc11_14.1: bool = value_of_initializer %F.call -// CHECK:STDOUT: %.loc11_14.2: bool = converted %F.call, %.loc11_14.1 -// CHECK:STDOUT: %.loc11_14.3: bool = not %.loc11_14.2 -// CHECK:STDOUT: %.loc11_14.4: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc11_14.3 br !or.rhs else br !or.result(%.loc11_14.4) +// CHECK:STDOUT: %.loc15_14.1: bool = value_of_initializer %F.call +// CHECK:STDOUT: %.loc15_14.2: bool = converted %F.call, %.loc15_14.1 +// CHECK:STDOUT: %.loc15_14.3: bool = not %.loc15_14.2 +// CHECK:STDOUT: %.loc15_14.4: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc15_14.3 br !or.rhs else br !or.result(%.loc15_14.4) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.3] // CHECK:STDOUT: %G.call: init bool = call %G.ref() -// CHECK:STDOUT: %.loc11_14.5: bool = value_of_initializer %G.call -// CHECK:STDOUT: %.loc11_14.6: bool = converted %G.call, %.loc11_14.5 -// CHECK:STDOUT: br !or.result(%.loc11_14.6) +// CHECK:STDOUT: %.loc15_14.5: bool = value_of_initializer %G.call +// CHECK:STDOUT: %.loc15_14.6: bool = converted %G.call, %.loc15_14.5 +// CHECK:STDOUT: br !or.result(%.loc15_14.6) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc11_14.7: bool = block_arg !or.result -// CHECK:STDOUT: return %.loc11_14.7 +// CHECK:STDOUT: %.loc15_14.7: bool = block_arg !or.result +// CHECK:STDOUT: return %.loc15_14.7 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc15_18.1: bool = not %.loc15_13 [template = constants.%.3] -// CHECK:STDOUT: %.loc15_18.2: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc15_18.1 br !or.rhs.loc15 else br !or.result.loc15(%.loc15_18.2) +// CHECK:STDOUT: %.loc19_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc19_18.1: bool = not %.loc19_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc19_18.2: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc19_18.1 br !or.rhs.loc19 else br !or.result.loc19(%.loc19_18.2) // CHECK:STDOUT: -// CHECK:STDOUT: !or.rhs.loc15: -// CHECK:STDOUT: %.loc15_21: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: br !or.result.loc15(%.loc15_21) +// CHECK:STDOUT: !or.rhs.loc19: +// CHECK:STDOUT: %.loc19_21: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: br !or.result.loc19(%.loc19_21) // CHECK:STDOUT: -// CHECK:STDOUT: !or.result.loc15: -// CHECK:STDOUT: %.loc15_18.3: bool = block_arg !or.result.loc15 [template = constants.%.2] -// CHECK:STDOUT: if %.loc15_18.3 br !if.expr.then.loc15 else br !if.expr.else.loc15 +// CHECK:STDOUT: !or.result.loc19: +// CHECK:STDOUT: %.loc19_18.3: bool = block_arg !or.result.loc19 [template = constants.%.2] +// CHECK:STDOUT: if %.loc19_18.3 br !if.expr.then.loc19 else br !if.expr.else.loc19 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc15_31.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] -// CHECK:STDOUT: %.loc15_31.2: type = converted %bool.make_type.loc15, %.loc15_31.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_31.2) +// CHECK:STDOUT: !if.expr.then.loc19: +// CHECK:STDOUT: %bool.make_type.loc19: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc19_31.1: type = value_of_initializer %bool.make_type.loc19 [template = bool] +// CHECK:STDOUT: %.loc19_31.2: type = converted %bool.make_type.loc19, %.loc19_31.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_31.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc15: -// CHECK:STDOUT: %.loc15_42: () = tuple_literal () -// CHECK:STDOUT: %.loc15_36: type = converted %.loc15_42, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_36) +// CHECK:STDOUT: !if.expr.else.loc19: +// CHECK:STDOUT: %.loc19_42: () = tuple_literal () +// CHECK:STDOUT: %.loc19_36: type = converted %.loc19_42, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_36) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc15: -// CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = bool] +// CHECK:STDOUT: !if.expr.result.loc19: +// CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc15_46: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc15_46 -// CHECK:STDOUT: %.loc16_13: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc16_18.1: bool = not %.loc16_13 [template = constants.%.3] -// CHECK:STDOUT: %.loc16_18.2: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc16_18.1 br !or.rhs.loc16 else br !or.result.loc16(%.loc16_18.2) +// CHECK:STDOUT: %.loc19_46: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc19_46 +// CHECK:STDOUT: %.loc20_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc20_18.1: bool = not %.loc20_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_18.2: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc20_18.1 br !or.rhs.loc20 else br !or.result.loc20(%.loc20_18.2) // CHECK:STDOUT: -// CHECK:STDOUT: !or.rhs.loc16: -// CHECK:STDOUT: %.loc16_21: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: br !or.result.loc16(%.loc16_21) +// CHECK:STDOUT: !or.rhs.loc20: +// CHECK:STDOUT: %.loc20_21: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: br !or.result.loc20(%.loc20_21) // CHECK:STDOUT: -// CHECK:STDOUT: !or.result.loc16: -// CHECK:STDOUT: %.loc16_18.3: bool = block_arg !or.result.loc16 [template = constants.%.2] -// CHECK:STDOUT: if %.loc16_18.3 br !if.expr.then.loc16 else br !if.expr.else.loc16 +// CHECK:STDOUT: !or.result.loc20: +// CHECK:STDOUT: %.loc20_18.3: bool = block_arg !or.result.loc20 [template = constants.%.2] +// CHECK:STDOUT: if %.loc20_18.3 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc16_32.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] -// CHECK:STDOUT: %.loc16_32.2: type = converted %bool.make_type.loc16, %.loc16_32.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_32.2) +// CHECK:STDOUT: !if.expr.then.loc20: +// CHECK:STDOUT: %bool.make_type.loc20: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc20_32.1: type = value_of_initializer %bool.make_type.loc20 [template = bool] +// CHECK:STDOUT: %.loc20_32.2: type = converted %bool.make_type.loc20, %.loc20_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_32.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc16: -// CHECK:STDOUT: %.loc16_43: () = tuple_literal () -// CHECK:STDOUT: %.loc16_37: type = converted %.loc16_43, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_37) +// CHECK:STDOUT: !if.expr.else.loc20: +// CHECK:STDOUT: %.loc20_43: () = tuple_literal () +// CHECK:STDOUT: %.loc20_37: type = converted %.loc20_43, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc16: -// CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = bool] +// CHECK:STDOUT: !if.expr.result.loc20: +// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = bool] // CHECK:STDOUT: %b.var: ref bool = var b // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var -// CHECK:STDOUT: %.loc16_47: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %b.var, %.loc16_47 -// CHECK:STDOUT: %.loc17_13: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc17_19.1: bool = not %.loc17_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc17_19.2: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc17_19.1 br !or.rhs.loc17 else br !or.result.loc17(%.loc17_19.2) +// CHECK:STDOUT: %.loc20_47: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %b.var, %.loc20_47 +// CHECK:STDOUT: %.loc21_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc21_19.1: bool = not %.loc21_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc21_19.2: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc21_19.1 br !or.rhs.loc21 else br !or.result.loc21(%.loc21_19.2) // CHECK:STDOUT: -// CHECK:STDOUT: !or.rhs.loc17: -// CHECK:STDOUT: %.loc17_22: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: br !or.result.loc17(%.loc17_22) +// CHECK:STDOUT: !or.rhs.loc21: +// CHECK:STDOUT: %.loc21_22: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: br !or.result.loc21(%.loc21_22) // CHECK:STDOUT: -// CHECK:STDOUT: !or.result.loc17: -// CHECK:STDOUT: %.loc17_19.3: bool = block_arg !or.result.loc17 [template = constants.%.2] -// CHECK:STDOUT: if %.loc17_19.3 br !if.expr.then.loc17 else br !if.expr.else.loc17 +// CHECK:STDOUT: !or.result.loc21: +// CHECK:STDOUT: %.loc21_19.3: bool = block_arg !or.result.loc21 [template = constants.%.2] +// CHECK:STDOUT: if %.loc21_19.3 br !if.expr.then.loc21 else br !if.expr.else.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc17: -// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc17_32.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] -// CHECK:STDOUT: %.loc17_32.2: type = converted %bool.make_type.loc17, %.loc17_32.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_32.2) +// CHECK:STDOUT: !if.expr.then.loc21: +// CHECK:STDOUT: %bool.make_type.loc21: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc21_32.1: type = value_of_initializer %bool.make_type.loc21 [template = bool] +// CHECK:STDOUT: %.loc21_32.2: type = converted %bool.make_type.loc21, %.loc21_32.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc21(%.loc21_32.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc17: -// CHECK:STDOUT: %.loc17_43: () = tuple_literal () -// CHECK:STDOUT: %.loc17_37: type = converted %.loc17_43, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc17(%.loc17_37) +// CHECK:STDOUT: !if.expr.else.loc21: +// CHECK:STDOUT: %.loc21_43: () = tuple_literal () +// CHECK:STDOUT: %.loc21_37: type = converted %.loc21_43, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc21(%.loc21_37) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc17: -// CHECK:STDOUT: %.loc17_10: type = block_arg !if.expr.result.loc17 [template = bool] +// CHECK:STDOUT: !if.expr.result.loc21: +// CHECK:STDOUT: %.loc21_10: type = block_arg !if.expr.result.loc21 [template = bool] // CHECK:STDOUT: %c.var: ref bool = var c // CHECK:STDOUT: %c: ref bool = bind_name c, %c.var -// CHECK:STDOUT: %.loc17_47: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %c.var, %.loc17_47 -// CHECK:STDOUT: %.loc18_13: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc18_19.1: bool = not %.loc18_13 [template = constants.%.2] -// CHECK:STDOUT: %.loc18_19.2: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc18_19.1 br !or.rhs.loc18 else br !or.result.loc18(%.loc18_19.2) +// CHECK:STDOUT: %.loc21_47: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %c.var, %.loc21_47 +// CHECK:STDOUT: %.loc22_13: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc22_19.1: bool = not %.loc22_13 [template = constants.%.2] +// CHECK:STDOUT: %.loc22_19.2: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc22_19.1 br !or.rhs.loc22 else br !or.result.loc22(%.loc22_19.2) // CHECK:STDOUT: -// CHECK:STDOUT: !or.rhs.loc18: -// CHECK:STDOUT: %.loc18_22: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: br !or.result.loc18(%.loc18_22) +// CHECK:STDOUT: !or.rhs.loc22: +// CHECK:STDOUT: %.loc22_22: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: br !or.result.loc22(%.loc22_22) // CHECK:STDOUT: -// CHECK:STDOUT: !or.result.loc18: -// CHECK:STDOUT: %.loc18_19.3: bool = block_arg !or.result.loc18 [template = constants.%.3] -// CHECK:STDOUT: if %.loc18_19.3 br !if.expr.then.loc18 else br !if.expr.else.loc18 +// CHECK:STDOUT: !or.result.loc22: +// CHECK:STDOUT: %.loc22_19.3: bool = block_arg !or.result.loc22 [template = constants.%.3] +// CHECK:STDOUT: if %.loc22_19.3 br !if.expr.then.loc22 else br !if.expr.else.loc22 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc18: -// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc18_33.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] -// CHECK:STDOUT: %.loc18_33.2: type = converted %bool.make_type.loc18, %.loc18_33.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_33.2) +// CHECK:STDOUT: !if.expr.then.loc22: +// CHECK:STDOUT: %bool.make_type.loc22: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc22_33.1: type = value_of_initializer %bool.make_type.loc22 [template = bool] +// CHECK:STDOUT: %.loc22_33.2: type = converted %bool.make_type.loc22, %.loc22_33.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_33.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc18: -// CHECK:STDOUT: %.loc18_44: () = tuple_literal () -// CHECK:STDOUT: %.loc18_38: type = converted %.loc18_44, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc18(%.loc18_38) +// CHECK:STDOUT: !if.expr.else.loc22: +// CHECK:STDOUT: %.loc22_44: () = tuple_literal () +// CHECK:STDOUT: %.loc22_38: type = converted %.loc22_44, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc22(%.loc22_38) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc18: -// CHECK:STDOUT: %.loc18_10: type = block_arg !if.expr.result.loc18 [template = constants.%.1] +// CHECK:STDOUT: !if.expr.result.loc22: +// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result.loc22 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var -// CHECK:STDOUT: %.loc18_49.1: () = tuple_literal () -// CHECK:STDOUT: %.loc18_49.2: init () = tuple_init () to %d.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc18_50: init () = converted %.loc18_49.1, %.loc18_49.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %d.var, %.loc18_50 +// CHECK:STDOUT: %.loc22_49.1: () = tuple_literal () +// CHECK:STDOUT: %.loc22_49.2: init () = tuple_init () to %d.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc22_50: init () = converted %.loc22_49.1, %.loc22_49.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %d.var, %.loc22_50 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @PartialConstant(%x: bool) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc22_13: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc22_18.1: bool = not %.loc22_13 [template = constants.%.3] -// CHECK:STDOUT: %.loc22_18.2: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc22_18.1 br !or.rhs else br !or.result(%.loc22_18.2) +// CHECK:STDOUT: %.loc26_13: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc26_18.1: bool = not %.loc26_13 [template = constants.%.3] +// CHECK:STDOUT: %.loc26_18.2: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc26_18.1 br !or.rhs else br !or.result(%.loc26_18.2) // CHECK:STDOUT: // CHECK:STDOUT: !or.rhs: // CHECK:STDOUT: %x.ref: bool = name_ref x, %x // CHECK:STDOUT: br !or.result(%x.ref) // CHECK:STDOUT: // CHECK:STDOUT: !or.result: -// CHECK:STDOUT: %.loc22_18.3: bool = block_arg !or.result [template = constants.%.2] -// CHECK:STDOUT: if %.loc22_18.3 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %.loc26_18.3: bool = block_arg !or.result [template = constants.%.2] +// CHECK:STDOUT: if %.loc26_18.3 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.then: // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc22_28.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc22_28.2: type = converted %bool.make_type, %.loc22_28.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result(%.loc22_28.2) +// CHECK:STDOUT: %.loc26_28.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc26_28.2: type = converted %bool.make_type, %.loc26_28.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result(%.loc26_28.2) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.else: -// CHECK:STDOUT: %.loc22_39: () = tuple_literal () -// CHECK:STDOUT: %.loc22_33: type = converted %.loc22_39, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result(%.loc22_33) +// CHECK:STDOUT: %.loc26_39: () = tuple_literal () +// CHECK:STDOUT: %.loc26_33: type = converted %.loc26_39, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result(%.loc26_33) // CHECK:STDOUT: // CHECK:STDOUT: !if.expr.result: -// CHECK:STDOUT: %.loc22_10: type = block_arg !if.expr.result [template = bool] +// CHECK:STDOUT: %.loc26_10: type = block_arg !if.expr.result [template = bool] // CHECK:STDOUT: %a.var: ref bool = var a // CHECK:STDOUT: %a: ref bool = bind_name a, %a.var -// CHECK:STDOUT: %.loc22_43: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %a.var, %.loc22_43 +// CHECK:STDOUT: %.loc26_43: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %a.var, %.loc26_43 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/builtin/unary_op.carbon b/toolchain/check/testdata/operators/builtin/unary_op.carbon index 585eb5bf9632..cc2df6ca7ba8 100644 --- a/toolchain/check/testdata/operators/builtin/unary_op.carbon +++ b/toolchain/check/testdata/operators/builtin/unary_op.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/unary_op.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/builtin/unary_op.carbon fn Not(b: bool) -> bool { return not b; @@ -41,30 +45,30 @@ fn Constant() { // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Not.decl: Not = fn_decl @Not [template = constants.%struct.2] { -// CHECK:STDOUT: %bool.make_type.loc7_11: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7_11 [template = bool] -// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7_11, %.loc7_11.1 [template = bool] -// CHECK:STDOUT: %b.loc7_8.1: bool = param b -// CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc7_8.1 -// CHECK:STDOUT: %bool.make_type.loc7_20: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_20.1: type = value_of_initializer %bool.make_type.loc7_20 [template = bool] -// CHECK:STDOUT: %.loc7_20.2: type = converted %bool.make_type.loc7_20, %.loc7_20.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc11_11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11_11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11_11, %.loc11_11.1 [template = bool] +// CHECK:STDOUT: %b.loc11_8.1: bool = param b +// CHECK:STDOUT: @Not.%b: bool = bind_name b, %b.loc11_8.1 +// CHECK:STDOUT: %bool.make_type.loc11_20: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_20.1: type = value_of_initializer %bool.make_type.loc11_20 [template = bool] +// CHECK:STDOUT: %.loc11_20.2: type = converted %bool.make_type.loc11_20, %.loc11_20.1 [template = bool] // CHECK:STDOUT: @Not.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc11_15.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] -// CHECK:STDOUT: %.loc11_15.2: type = converted %bool.make_type.loc11, %.loc11_15.1 [template = bool] -// CHECK:STDOUT: %.loc11_26: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc11_22: bool = not %.loc11_26 [template = constants.%.3] -// CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc11_22 +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_15.2: type = converted %bool.make_type.loc15, %.loc15_15.1 [template = bool] +// CHECK:STDOUT: %.loc15_26: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc15_22: bool = not %.loc15_26 [template = constants.%.3] +// CHECK:STDOUT: %not_true: bool = bind_name not_true, %.loc15_22 // CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc12_16.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] -// CHECK:STDOUT: %.loc12_16.2: type = converted %bool.make_type.loc12, %.loc12_16.1 [template = bool] -// CHECK:STDOUT: %.loc12_27: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc12_23: bool = not %.loc12_27 [template = constants.%.2] -// CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc12_23 +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc16_16.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_16.2: type = converted %bool.make_type.loc16, %.loc16_16.1 [template = bool] +// CHECK:STDOUT: %.loc16_27: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc16_23: bool = not %.loc16_27 [template = constants.%.2] +// CHECK:STDOUT: %not_false: bool = bind_name not_false, %.loc16_23 // CHECK:STDOUT: %Constant.decl: Constant = fn_decl @Constant [template = constants.%struct.3] {} // CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] @@ -75,56 +79,56 @@ fn Constant() { // CHECK:STDOUT: fn @Not(%b: bool) -> bool { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %b.ref: bool = name_ref b, %b -// CHECK:STDOUT: %.loc8: bool = not %b.ref -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: bool = not %b.ref +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Constant() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_17: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: %.loc15_13: bool = not %.loc15_17 [template = constants.%.3] -// CHECK:STDOUT: if %.loc15_13 br !if.expr.then.loc15 else br !if.expr.else.loc15 +// CHECK:STDOUT: %.loc19_17: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: %.loc19_13: bool = not %.loc19_17 [template = constants.%.3] +// CHECK:STDOUT: if %.loc19_13 br !if.expr.then.loc19 else br !if.expr.else.loc19 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc15: -// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc15_27.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] -// CHECK:STDOUT: %.loc15_27.2: type = converted %bool.make_type.loc15, %.loc15_27.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_27.2) +// CHECK:STDOUT: !if.expr.then.loc19: +// CHECK:STDOUT: %bool.make_type.loc19: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc19_27.1: type = value_of_initializer %bool.make_type.loc19 [template = bool] +// CHECK:STDOUT: %.loc19_27.2: type = converted %bool.make_type.loc19, %.loc19_27.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_27.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc15: -// CHECK:STDOUT: %.loc15_38: () = tuple_literal () -// CHECK:STDOUT: %.loc15_32: type = converted %.loc15_38, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc15(%.loc15_32) +// CHECK:STDOUT: !if.expr.else.loc19: +// CHECK:STDOUT: %.loc19_38: () = tuple_literal () +// CHECK:STDOUT: %.loc19_32: type = converted %.loc19_38, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc19(%.loc19_32) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc15: -// CHECK:STDOUT: %.loc15_10: type = block_arg !if.expr.result.loc15 [template = constants.%.1] +// CHECK:STDOUT: !if.expr.result.loc19: +// CHECK:STDOUT: %.loc19_10: type = block_arg !if.expr.result.loc19 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var -// CHECK:STDOUT: %.loc15_43.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_43.2: init () = tuple_init () to %a.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_44: init () = converted %.loc15_43.1, %.loc15_43.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %a.var, %.loc15_44 -// CHECK:STDOUT: %.loc16_17: bool = bool_literal false [template = constants.%.3] -// CHECK:STDOUT: %.loc16_13: bool = not %.loc16_17 [template = constants.%.2] -// CHECK:STDOUT: if %.loc16_13 br !if.expr.then.loc16 else br !if.expr.else.loc16 +// CHECK:STDOUT: %.loc19_43.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_43.2: init () = tuple_init () to %a.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc19_44: init () = converted %.loc19_43.1, %.loc19_43.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %a.var, %.loc19_44 +// CHECK:STDOUT: %.loc20_17: bool = bool_literal false [template = constants.%.3] +// CHECK:STDOUT: %.loc20_13: bool = not %.loc20_17 [template = constants.%.2] +// CHECK:STDOUT: if %.loc20_13 br !if.expr.then.loc20 else br !if.expr.else.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.then.loc16: -// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc16_28.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] -// CHECK:STDOUT: %.loc16_28.2: type = converted %bool.make_type.loc16, %.loc16_28.1 [template = bool] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_28.2) +// CHECK:STDOUT: !if.expr.then.loc20: +// CHECK:STDOUT: %bool.make_type.loc20: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc20_28.1: type = value_of_initializer %bool.make_type.loc20 [template = bool] +// CHECK:STDOUT: %.loc20_28.2: type = converted %bool.make_type.loc20, %.loc20_28.1 [template = bool] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_28.2) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.else.loc16: -// CHECK:STDOUT: %.loc16_39: () = tuple_literal () -// CHECK:STDOUT: %.loc16_33: type = converted %.loc16_39, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: br !if.expr.result.loc16(%.loc16_33) +// CHECK:STDOUT: !if.expr.else.loc20: +// CHECK:STDOUT: %.loc20_39: () = tuple_literal () +// CHECK:STDOUT: %.loc20_33: type = converted %.loc20_39, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: br !if.expr.result.loc20(%.loc20_33) // CHECK:STDOUT: -// CHECK:STDOUT: !if.expr.result.loc16: -// CHECK:STDOUT: %.loc16_10: type = block_arg !if.expr.result.loc16 [template = bool] +// CHECK:STDOUT: !if.expr.result.loc20: +// CHECK:STDOUT: %.loc20_10: type = block_arg !if.expr.result.loc20 [template = bool] // CHECK:STDOUT: %b.var: ref bool = var b // CHECK:STDOUT: %b: ref bool = bind_name b, %b.var -// CHECK:STDOUT: %.loc16_43: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: assign %b.var, %.loc16_43 +// CHECK:STDOUT: %.loc20_43: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: assign %b.var, %.loc20_43 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/add.carbon b/toolchain/check/testdata/operators/overloaded/add.carbon index 3f568941fcbe..8a963f0a839c 100644 --- a/toolchain/check/testdata/operators/overloaded/add.carbon +++ b/toolchain/check/testdata/operators/overloaded/add.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/add.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/add.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+24, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+19, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+26, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+47, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+43, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+1, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+19, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+26, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+43, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Add { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_and.carbon b/toolchain/check/testdata/operators/overloaded/bit_and.carbon index 833a446d4961..071315708023 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_and.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_and.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/bit_and.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/bit_and.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+43, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+39, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitAnd.ref: type = name_ref BitAnd, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+45, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir5, inst+66, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir5, inst+62, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitAndAssign.ref: type = name_ref BitAndAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir5, inst+21, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir5, inst+39, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir5, inst+45, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir5, inst+62, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitAnd { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitAndAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon index c4f7f3692800..70afa5c08caf 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_complement.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_complement.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/bit_complement.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/bit_complement.carbon // This file was generated from unary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -54,15 +58,15 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+19, loaded [template = constants.%.7] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+14, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitComplement.ref: type = name_ref BitComplement, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc19_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc19_11.1 -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc23_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc23_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc23_11.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+1, loaded [template = constants.%.2] @@ -78,10 +82,10 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as BitComplement { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_23: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -96,12 +100,12 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.%self.loc14_9.2: C]() -> @impl.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.%self.loc18_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self]() -> Self; @@ -110,9 +114,9 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc20: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc19: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc20(%a.ref) to %.loc19 +// CHECK:STDOUT: %.loc24: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc23: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc24(%a.ref) to %.loc23 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_or.carbon b/toolchain/check/testdata/operators/overloaded/bit_or.carbon index 273cce907563..f021e96361f0 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_or.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_or.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/bit_or.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/bit_or.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+90, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+86, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitOr.ref: type = name_ref BitOr, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+92, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir5, inst+113, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir5, inst+109, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitOrAssign.ref: type = name_ref BitOrAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir5, inst+68, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir5, inst+86, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir5, inst+92, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir5, inst+109, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitOr { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitOrAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon index 195a08d1834b..8b218962eceb 100644 --- a/toolchain/check/testdata/operators/overloaded/bit_xor.carbon +++ b/toolchain/check/testdata/operators/overloaded/bit_xor.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/bit_xor.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/bit_xor.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+137, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+133, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitXor.ref: type = name_ref BitXor, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+139, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir5, inst+160, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir5, inst+156, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %BitXorAssign.ref: type = name_ref BitXorAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir5, inst+115, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir5, inst+133, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir5, inst+139, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir5, inst+156, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as BitXor { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as BitXorAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/dec.carbon b/toolchain/check/testdata/operators/overloaded/dec.carbon index 247c8295f80f..fb297990991d 100644 --- a/toolchain/check/testdata/operators/overloaded/dec.carbon +++ b/toolchain/check/testdata/operators/overloaded/dec.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/dec.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/dec.carbon // This file was generated from unary_stmt.carbon.tmpl. Run make_tests.sh to regenerate. @@ -74,10 +78,10 @@ fn TestOp() { // CHECK:STDOUT: impl @impl: C as Dec { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.3] -// CHECK:STDOUT: %self.loc14_14.1: C* = param self -// CHECK:STDOUT: %self.loc14_14.3: C* = bind_name self, %self.loc14_14.1 -// CHECK:STDOUT: %.loc14_9: C* = addr_pattern %self.loc14_14.3 +// CHECK:STDOUT: %.loc18_21: type = ptr_type C [template = constants.%.3] +// CHECK:STDOUT: %self.loc18_14.1: C* = param self +// CHECK:STDOUT: %self.loc18_14.3: C* = bind_name self, %self.loc18_14.1 +// CHECK:STDOUT: %.loc18_9: C* = addr_pattern %self.loc18_14.3 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: @@ -91,7 +95,7 @@ fn TestOp() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[addr @impl.%self.loc14_14.3: C*](); +// CHECK:STDOUT: fn @Op.1[addr @impl.%self.loc18_14.3: C*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[addr %self: Self*](); // CHECK:STDOUT: @@ -100,15 +104,15 @@ fn TestOp() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc18_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc18_15.2: init C = class_init (), %c.var [template = constants.%struct.4] -// CHECK:STDOUT: %.loc18_16: init C = converted %.loc18_15.1, %.loc18_15.2 [template = constants.%struct.4] -// CHECK:STDOUT: assign %c.var, %.loc18_16 +// CHECK:STDOUT: %.loc22_15.1: {} = struct_literal () +// CHECK:STDOUT: %.loc22_15.2: init C = class_init (), %c.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_16: init C = converted %.loc22_15.1, %.loc22_15.2 [template = constants.%struct.4] +// CHECK:STDOUT: assign %c.var, %.loc22_16 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc19_3: = bound_method %c.ref, %.1 -// CHECK:STDOUT: %.loc19_5: C* = addr_of %c.ref -// CHECK:STDOUT: %Op.call: init () = call %.loc19_3(%.loc19_5) +// CHECK:STDOUT: %.loc23_3: = bound_method %c.ref, %.1 +// CHECK:STDOUT: %.loc23_5: C* = addr_of %c.ref +// CHECK:STDOUT: %Op.call: init () = call %.loc23_3(%.loc23_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/div.carbon b/toolchain/check/testdata/operators/overloaded/div.carbon index 6b173cfaee86..97cad977624e 100644 --- a/toolchain/check/testdata/operators/overloaded/div.carbon +++ b/toolchain/check/testdata/operators/overloaded/div.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/div.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/div.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+220, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+216, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Div.ref: type = name_ref Div, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+222, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+243, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+239, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %DivAssign.ref: type = name_ref DivAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+198, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+216, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+222, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+239, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Div { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as DivAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/eq.carbon b/toolchain/check/testdata/operators/overloaded/eq.carbon index b8158d17ba59..15e3a7eca9f5 100644 --- a/toolchain/check/testdata/operators/overloaded/eq.carbon +++ b/toolchain/check/testdata/operators/overloaded/eq.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/eq.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/eq.carbon // --- user.carbon diff --git a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon index a602585122e0..f811369ba3f2 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/fail_assign_non_ref.carbon package User; @@ -84,8 +88,8 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+65, loaded [template = constants.%.12] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+61, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc11: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc11: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc15: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Inc.ref: type = name_ref Inc, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+26, loaded [template = constants.%.7] @@ -93,24 +97,24 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+47, loaded [template = constants.%.14] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+43, loaded [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc14: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.7] // CHECK:STDOUT: } // CHECK:STDOUT: %TestIncNonRef.decl: TestIncNonRef = fn_decl @TestIncNonRef [template = constants.%struct.5] { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc18_18.1: C = param a -// CHECK:STDOUT: @TestIncNonRef.%a: C = bind_name a, %a.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc22_18.1: C = param a +// CHECK:STDOUT: @TestIncNonRef.%a: C = bind_name a, %a.loc22_18.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+49, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+61, unloaded // CHECK:STDOUT: %TestAddAssignNonRef.decl: TestAddAssignNonRef = fn_decl @TestAddAssignNonRef [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc29_27: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc29_24.1: C = param a -// CHECK:STDOUT: @TestAddAssignNonRef.%a: C = bind_name a, %a.loc29_24.1 -// CHECK:STDOUT: %C.ref.loc29_33: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc29_30.1: C = param b -// CHECK:STDOUT: @TestAddAssignNonRef.%b: C = bind_name b, %b.loc29_30.1 +// CHECK:STDOUT: %C.ref.loc33_27: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc33_24.1: C = param a +// CHECK:STDOUT: @TestAddAssignNonRef.%a: C = bind_name a, %a.loc33_24.1 +// CHECK:STDOUT: %C.ref.loc33_33: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc33_30.1: C = param b +// CHECK:STDOUT: @TestAddAssignNonRef.%b: C = bind_name b, %b.loc33_30.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+26, loaded [template = constants.%.7] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+43, unloaded @@ -133,10 +137,10 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: impl @impl.1: C as Inc { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc12_21: type = ptr_type C [template = constants.%.3] -// CHECK:STDOUT: %self.loc12_14.1: C* = param self -// CHECK:STDOUT: %self.loc12_14.3: C* = bind_name self, %self.loc12_14.1 -// CHECK:STDOUT: %.loc12_9: C* = addr_pattern %self.loc12_14.3 +// CHECK:STDOUT: %.loc16_21: type = ptr_type C [template = constants.%.3] +// CHECK:STDOUT: %self.loc16_14.1: C* = param self +// CHECK:STDOUT: %self.loc16_14.3: C* = bind_name self, %self.loc16_14.1 +// CHECK:STDOUT: %.loc16_9: C* = addr_pattern %self.loc16_14.3 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: @@ -147,14 +151,14 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.3] { -// CHECK:STDOUT: %C.ref.loc15_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc15_21: type = ptr_type C [template = constants.%.3] -// CHECK:STDOUT: %self.loc15_14.1: C* = param self -// CHECK:STDOUT: %self.loc15_14.3: C* = bind_name self, %self.loc15_14.1 -// CHECK:STDOUT: %.loc15_9: C* = addr_pattern %self.loc15_14.3 -// CHECK:STDOUT: %C.ref.loc15_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc15_24.1: C = param other -// CHECK:STDOUT: %other.loc15_24.2: C = bind_name other, %other.loc15_24.1 +// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.3] +// CHECK:STDOUT: %self.loc19_14.1: C* = param self +// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 +// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 +// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc19_24.1: C = param other +// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,11 +172,11 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[addr @impl.1.%self.loc12_14.3: C*](); +// CHECK:STDOUT: fn @Op.1[addr @impl.1.%self.loc16_14.3: C*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[addr %self: Self*](); // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc15_14.3: C*](@impl.2.%other.loc15_24.2: C); +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C); // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.4[addr %self: Self*](%other: Self); // CHECK:STDOUT: @@ -180,8 +184,8 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc26: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc26() [template = ] +// CHECK:STDOUT: %.loc30: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc30() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -190,8 +194,8 @@ fn TestAddAssignNonRef(a: C, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc36: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc36() [template = ] +// CHECK:STDOUT: %.loc40: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc40() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon index ada78d0724ac..06d8bb7c0c14 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/fail_no_impl.carbon package User; @@ -90,10 +94,10 @@ fn TestRef(b: C) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %TestUnary.decl: TestUnary = fn_decl @TestUnary [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc11_17: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc11_14.1: C = param a -// CHECK:STDOUT: @TestUnary.%a: C = bind_name a, %a.loc11_14.1 -// CHECK:STDOUT: %C.ref.loc11_23: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc15_17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc15_14.1: C = param a +// CHECK:STDOUT: @TestUnary.%a: C = bind_name a, %a.loc15_14.1 +// CHECK:STDOUT: %C.ref.loc15_23: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestUnary.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.1: type = import_ref ir4, inst+67, loaded [template = constants.%.4] @@ -102,13 +106,13 @@ fn TestRef(b: C) { // CHECK:STDOUT: %import_ref.4 = import_ref ir4, inst+80, unloaded // CHECK:STDOUT: %import_ref.5 = import_ref ir4, inst+80, unloaded // CHECK:STDOUT: %TestBinary.decl: TestBinary = fn_decl @TestBinary [template = constants.%struct.3] { -// CHECK:STDOUT: %C.ref.loc19_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc19_15.1: C = param a -// CHECK:STDOUT: @TestBinary.%a: C = bind_name a, %a.loc19_15.1 -// CHECK:STDOUT: %C.ref.loc19_24: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc19_21.1: C = param b -// CHECK:STDOUT: @TestBinary.%b: C = bind_name b, %b.loc19_21.1 -// CHECK:STDOUT: %C.ref.loc19_30: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc23_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc23_15.1: C = param a +// CHECK:STDOUT: @TestBinary.%a: C = bind_name a, %a.loc23_15.1 +// CHECK:STDOUT: %C.ref.loc23_24: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc23_21.1: C = param b +// CHECK:STDOUT: @TestBinary.%b: C = bind_name b, %b.loc23_21.1 +// CHECK:STDOUT: %C.ref.loc23_30: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestBinary.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: type = import_ref ir4, inst+1, loaded [template = constants.%.7] @@ -117,9 +121,9 @@ fn TestRef(b: C) { // CHECK:STDOUT: %import_ref.9 = import_ref ir4, inst+19, unloaded // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+19, unloaded // CHECK:STDOUT: %TestRef.decl: TestRef = fn_decl @TestRef [template = constants.%struct.5] { -// CHECK:STDOUT: %C.ref.loc27: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc27_12.1: C = param b -// CHECK:STDOUT: @TestRef.%b: C = bind_name b, %b.loc27_12.1 +// CHECK:STDOUT: %C.ref.loc31: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc31_12.1: C = param b +// CHECK:STDOUT: @TestRef.%b: C = bind_name b, %b.loc31_12.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+26, loaded [template = constants.%.10] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+28, unloaded @@ -188,13 +192,13 @@ fn TestRef(b: C) { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %a.var: ref C = var a // CHECK:STDOUT: %a: ref C = bind_name a, %a.var -// CHECK:STDOUT: %.loc28_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc28_15.2: init C = class_init (), %a.var [template = constants.%struct.6] -// CHECK:STDOUT: %.loc28_16: init C = converted %.loc28_15.1, %.loc28_15.2 [template = constants.%struct.6] -// CHECK:STDOUT: assign %a.var, %.loc28_16 -// CHECK:STDOUT: %a.ref.loc33: ref C = name_ref a, %a -// CHECK:STDOUT: %b.ref: C = name_ref b, %b +// CHECK:STDOUT: %.loc32_15.1: {} = struct_literal () +// CHECK:STDOUT: %.loc32_15.2: init C = class_init (), %a.var [template = constants.%struct.6] +// CHECK:STDOUT: %.loc32_16: init C = converted %.loc32_15.1, %.loc32_15.2 [template = constants.%struct.6] +// CHECK:STDOUT: assign %a.var, %.loc32_16 // CHECK:STDOUT: %a.ref.loc37: ref C = name_ref a, %a +// CHECK:STDOUT: %b.ref: C = name_ref b, %b +// CHECK:STDOUT: %a.ref.loc41: ref C = name_ref a, %a // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon index 829feb321b41..9d652715ae90 100644 --- a/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +++ b/toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/fail_no_impl_for_arg.carbon package User; @@ -89,8 +93,8 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+24, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+19, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc12: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc12: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc16: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc16: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Add.ref: type = name_ref Add, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+26, loaded [template = constants.%.5] @@ -98,26 +102,26 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+47, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+43, loaded [template = constants.%struct.4] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc15: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc15: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc19: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc19: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %AddAssign.ref: type = name_ref AddAssign, %import_ref.5 [template = constants.%.5] // CHECK:STDOUT: } // CHECK:STDOUT: %Test.decl: Test = fn_decl @Test [template = constants.%struct.5] { -// CHECK:STDOUT: %C.ref.loc19_12: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc19_9.1: C = param a -// CHECK:STDOUT: @Test.%a: C = bind_name a, %a.loc19_9.1 -// CHECK:STDOUT: %D.ref.loc19: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %b.loc19_15.1: D = param b -// CHECK:STDOUT: @Test.%b: D = bind_name b, %b.loc19_15.1 -// CHECK:STDOUT: %C.ref.loc19_24: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc23_12: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc23_9.1: C = param a +// CHECK:STDOUT: @Test.%a: C = bind_name a, %a.loc23_9.1 +// CHECK:STDOUT: %D.ref.loc23: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %b.loc23_15.1: D = param b +// CHECK:STDOUT: @Test.%b: D = bind_name b, %b.loc23_15.1 +// CHECK:STDOUT: %C.ref.loc23_24: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @Test.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+1, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+19, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.6] { -// CHECK:STDOUT: %D.ref.loc30: type = name_ref D, %D.decl [template = constants.%D] -// CHECK:STDOUT: %b.loc30_15.1: D = param b -// CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc30_15.1 +// CHECK:STDOUT: %D.ref.loc34: type = name_ref D, %D.decl [template = constants.%D] +// CHECK:STDOUT: %b.loc34_15.1: D = param b +// CHECK:STDOUT: @TestAssign.%b: D = bind_name b, %b.loc34_15.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+26, loaded [template = constants.%.5] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+43, unloaded @@ -139,13 +143,13 @@ fn TestAssign(b: D) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Add { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc13_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc13_9.1: C = param self -// CHECK:STDOUT: %self.loc13_9.2: C = bind_name self, %self.loc13_9.1 -// CHECK:STDOUT: %C.ref.loc13_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc13_18.1: C = param other -// CHECK:STDOUT: %other.loc13_18.2: C = bind_name other, %other.loc13_18.1 -// CHECK:STDOUT: %C.ref.loc13_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc17_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc17_9.1: C = param self +// CHECK:STDOUT: %self.loc17_9.2: C = bind_name self, %self.loc17_9.1 +// CHECK:STDOUT: %C.ref.loc17_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc17_18.1: C = param other +// CHECK:STDOUT: %other.loc17_18.2: C = bind_name other, %other.loc17_18.1 +// CHECK:STDOUT: %C.ref.loc17_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -157,14 +161,14 @@ fn TestAssign(b: D) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as AddAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.3] { -// CHECK:STDOUT: %C.ref.loc16_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc16_21: type = ptr_type C [template = constants.%.6] -// CHECK:STDOUT: %self.loc16_14.1: C* = param self -// CHECK:STDOUT: %self.loc16_14.3: C* = bind_name self, %self.loc16_14.1 -// CHECK:STDOUT: %.loc16_9: C* = addr_pattern %self.loc16_14.3 -// CHECK:STDOUT: %C.ref.loc16_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc16_24.1: C = param other -// CHECK:STDOUT: %other.loc16_24.2: C = bind_name other, %other.loc16_24.1 +// CHECK:STDOUT: %C.ref.loc20_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc20_21: type = ptr_type C [template = constants.%.6] +// CHECK:STDOUT: %self.loc20_14.1: C* = param self +// CHECK:STDOUT: %self.loc20_14.3: C* = bind_name self, %self.loc20_14.1 +// CHECK:STDOUT: %.loc20_9: C* = addr_pattern %self.loc20_14.3 +// CHECK:STDOUT: %C.ref.loc20_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc20_24.1: C = param other +// CHECK:STDOUT: %other.loc20_24.2: C = bind_name other, %other.loc20_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.8] // CHECK:STDOUT: @@ -183,11 +187,11 @@ fn TestAssign(b: D) { // CHECK:STDOUT: .Self = constants.%D // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc13_9.2: C](@impl.1.%other.loc13_18.2: C) -> C; +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc17_9.2: C](@impl.1.%other.loc17_18.2: C) -> C; // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc16_14.3: C*](@impl.2.%other.loc16_24.2: C); +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc20_14.3: C*](@impl.2.%other.loc20_24.2: C); // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.4[addr %self: Self*](%other: Self); // CHECK:STDOUT: @@ -196,9 +200,9 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc27_12.1: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc27_12.2: ref C = temporary_storage -// CHECK:STDOUT: %Op.call: init C = call %.loc27_12.1() [template = ] +// CHECK:STDOUT: %.loc31_12.1: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc31_12.2: ref C = temporary_storage +// CHECK:STDOUT: %Op.call: init C = call %.loc31_12.1() [template = ] // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -207,16 +211,16 @@ fn TestAssign(b: D) { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %a.var: ref C = var a // CHECK:STDOUT: %a: ref C = bind_name a, %a.var -// CHECK:STDOUT: %.loc31_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc31_15.2: init C = class_init (), %a.var [template = constants.%struct.7] -// CHECK:STDOUT: %.loc31_16: init C = converted %.loc31_15.1, %.loc31_15.2 [template = constants.%struct.7] -// CHECK:STDOUT: assign %a.var, %.loc31_16 +// CHECK:STDOUT: %.loc35_15.1: {} = struct_literal () +// CHECK:STDOUT: %.loc35_15.2: init C = class_init (), %a.var [template = constants.%struct.7] +// CHECK:STDOUT: %.loc35_16: init C = converted %.loc35_15.1, %.loc35_15.2 [template = constants.%struct.7] +// CHECK:STDOUT: assign %a.var, %.loc35_16 // CHECK:STDOUT: %a.ref: ref C = name_ref a, %a // CHECK:STDOUT: %b.ref: D = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc38_5: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc38_3: C* = addr_of %a.ref -// CHECK:STDOUT: %Op.call: init () = call %.loc38_5() [template = ] +// CHECK:STDOUT: %.loc42_5: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc42_3: C* = addr_of %a.ref +// CHECK:STDOUT: %Op.call: init () = call %.loc42_5() [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/inc.carbon b/toolchain/check/testdata/operators/overloaded/inc.carbon index 3b39b9492494..26ce2077c5cf 100644 --- a/toolchain/check/testdata/operators/overloaded/inc.carbon +++ b/toolchain/check/testdata/operators/overloaded/inc.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/inc.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/inc.carbon // This file was generated from unary_stmt.carbon.tmpl. Run make_tests.sh to regenerate. @@ -74,10 +78,10 @@ fn TestOp() { // CHECK:STDOUT: impl @impl: C as Inc { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc14_21: type = ptr_type C [template = constants.%.3] -// CHECK:STDOUT: %self.loc14_14.1: C* = param self -// CHECK:STDOUT: %self.loc14_14.3: C* = bind_name self, %self.loc14_14.1 -// CHECK:STDOUT: %.loc14_9: C* = addr_pattern %self.loc14_14.3 +// CHECK:STDOUT: %.loc18_21: type = ptr_type C [template = constants.%.3] +// CHECK:STDOUT: %self.loc18_14.1: C* = param self +// CHECK:STDOUT: %self.loc18_14.3: C* = bind_name self, %self.loc18_14.1 +// CHECK:STDOUT: %.loc18_9: C* = addr_pattern %self.loc18_14.3 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.6] // CHECK:STDOUT: @@ -91,7 +95,7 @@ fn TestOp() { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[addr @impl.%self.loc14_14.3: C*](); +// CHECK:STDOUT: fn @Op.1[addr @impl.%self.loc18_14.3: C*](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[addr %self: Self*](); // CHECK:STDOUT: @@ -100,15 +104,15 @@ fn TestOp() { // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c.var: ref C = var c // CHECK:STDOUT: %c: ref C = bind_name c, %c.var -// CHECK:STDOUT: %.loc18_15.1: {} = struct_literal () -// CHECK:STDOUT: %.loc18_15.2: init C = class_init (), %c.var [template = constants.%struct.4] -// CHECK:STDOUT: %.loc18_16: init C = converted %.loc18_15.1, %.loc18_15.2 [template = constants.%struct.4] -// CHECK:STDOUT: assign %c.var, %.loc18_16 +// CHECK:STDOUT: %.loc22_15.1: {} = struct_literal () +// CHECK:STDOUT: %.loc22_15.2: init C = class_init (), %c.var [template = constants.%struct.4] +// CHECK:STDOUT: %.loc22_16: init C = converted %.loc22_15.1, %.loc22_15.2 [template = constants.%struct.4] +// CHECK:STDOUT: assign %c.var, %.loc22_16 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc19_3: = bound_method %c.ref, %.1 -// CHECK:STDOUT: %.loc19_5: C* = addr_of %c.ref -// CHECK:STDOUT: %Op.call: init () = call %.loc19_3(%.loc19_5) +// CHECK:STDOUT: %.loc23_3: = bound_method %c.ref, %.1 +// CHECK:STDOUT: %.loc23_5: C* = addr_of %c.ref +// CHECK:STDOUT: %Op.call: init () = call %.loc23_3(%.loc23_5) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/left_shift.carbon b/toolchain/check/testdata/operators/overloaded/left_shift.carbon index 205cdd253aac..a1b2f2d749c5 100644 --- a/toolchain/check/testdata/operators/overloaded/left_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/left_shift.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/left_shift.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/left_shift.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+184, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+180, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %LeftShift.ref: type = name_ref LeftShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+186, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir5, inst+207, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir5, inst+203, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %LeftShiftAssign.ref: type = name_ref LeftShiftAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir5, inst+162, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir5, inst+180, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir5, inst+186, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir5, inst+203, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as LeftShift { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as LeftShiftAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mod.carbon b/toolchain/check/testdata/operators/overloaded/mod.carbon index 9d506ed24aee..8d6e944dd6aa 100644 --- a/toolchain/check/testdata/operators/overloaded/mod.carbon +++ b/toolchain/check/testdata/operators/overloaded/mod.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/mod.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/mod.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+267, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+263, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Mod.ref: type = name_ref Mod, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+269, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+290, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+286, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %ModAssign.ref: type = name_ref ModAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+245, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+263, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+269, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+286, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Mod { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as ModAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/mul.carbon b/toolchain/check/testdata/operators/overloaded/mul.carbon index 49b711c798c1..f05fbc5edec8 100644 --- a/toolchain/check/testdata/operators/overloaded/mul.carbon +++ b/toolchain/check/testdata/operators/overloaded/mul.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/mul.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/mul.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+173, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+169, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Mul.ref: type = name_ref Mul, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+175, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+196, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+192, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %MulAssign.ref: type = name_ref MulAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+151, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+169, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+175, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+192, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Mul { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as MulAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/negate.carbon b/toolchain/check/testdata/operators/overloaded/negate.carbon index 5dc808141e2b..a9add534841b 100644 --- a/toolchain/check/testdata/operators/overloaded/negate.carbon +++ b/toolchain/check/testdata/operators/overloaded/negate.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/negate.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/negate.carbon // This file was generated from unary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -54,15 +58,15 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+84, loaded [template = constants.%.7] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+80, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: %Core.ref: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Negate.ref: type = name_ref Negate, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc19_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc19_11.1 -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc23_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc23_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc23_11.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+67, loaded [template = constants.%.2] @@ -78,10 +82,10 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl: C as Negate { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_23: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_23: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -96,12 +100,12 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.%self.loc14_9.2: C]() -> @impl.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.%self.loc18_9.2: C]() -> @impl.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self]() -> Self; @@ -110,9 +114,9 @@ fn TestOp(a: C) -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc20: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc19: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc20(%a.ref) to %.loc19 +// CHECK:STDOUT: %.loc24: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc23: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc24(%a.ref) to %.loc23 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/ordered.carbon b/toolchain/check/testdata/operators/overloaded/ordered.carbon index 0becfa1c218a..46ff7971b64e 100644 --- a/toolchain/check/testdata/operators/overloaded/ordered.carbon +++ b/toolchain/check/testdata/operators/overloaded/ordered.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/ordered.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/ordered.carbon // --- user.carbon diff --git a/toolchain/check/testdata/operators/overloaded/right_shift.carbon b/toolchain/check/testdata/operators/overloaded/right_shift.carbon index 2fc0f2a000d8..035ff7886bc2 100644 --- a/toolchain/check/testdata/operators/overloaded/right_shift.carbon +++ b/toolchain/check/testdata/operators/overloaded/right_shift.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/right_shift.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/right_shift.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir5, inst+231, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir5, inst+227, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %RightShift.ref: type = name_ref RightShift, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir5, inst+233, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir5, inst+254, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir5, inst+250, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %RightShiftAssign.ref: type = name_ref RightShiftAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir5, inst+209, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir5, inst+227, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir5, inst+233, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir5, inst+250, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as RightShift { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as RightShiftAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/operators/overloaded/sub.carbon b/toolchain/check/testdata/operators/overloaded/sub.carbon index 08233abb7285..cb6daea60f80 100644 --- a/toolchain/check/testdata/operators/overloaded/sub.carbon +++ b/toolchain/check/testdata/operators/overloaded/sub.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/overloaded/sub.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/operators/overloaded/sub.carbon // This file was generated from binary_op.carbon.tmpl. Run make_tests.sh to regenerate. @@ -75,8 +79,8 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.3: = import_ref ir4, inst+108, loaded [template = constants.%.11] // CHECK:STDOUT: %import_ref.4: Op = import_ref ir4, inst+104, loaded [template = constants.%struct.2] // CHECK:STDOUT: impl_decl @impl.1 { -// CHECK:STDOUT: %C.ref.loc13: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc13: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc17: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc17: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %Sub.ref: type = name_ref Sub, %import_ref.1 [template = constants.%.2] // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: type = import_ref ir4, inst+110, loaded [template = constants.%.6] @@ -84,30 +88,30 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %import_ref.7: = import_ref ir4, inst+131, loaded [template = constants.%.13] // CHECK:STDOUT: %import_ref.8: Op = import_ref ir4, inst+127, loaded [template = constants.%struct.5] // CHECK:STDOUT: impl_decl @impl.2 { -// CHECK:STDOUT: %C.ref.loc18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %Core.ref.loc18: = name_ref Core, %Core [template = %Core] +// CHECK:STDOUT: %C.ref.loc22: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %Core.ref.loc22: = name_ref Core, %Core [template = %Core] // CHECK:STDOUT: %SubAssign.ref: type = name_ref SubAssign, %import_ref.5 [template = constants.%.6] // CHECK:STDOUT: } // CHECK:STDOUT: %TestOp.decl: TestOp = fn_decl @TestOp [template = constants.%struct.6] { -// CHECK:STDOUT: %C.ref.loc22_14: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %a.loc22_11.1: C = param a -// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc22_11.1 -// CHECK:STDOUT: %C.ref.loc22_20: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc22_17.1: C = param b -// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc22_17.1 -// CHECK:STDOUT: %C.ref.loc22_26: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc26_14: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %a.loc26_11.1: C = param a +// CHECK:STDOUT: @TestOp.%a: C = bind_name a, %a.loc26_11.1 +// CHECK:STDOUT: %C.ref.loc26_20: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc26_17.1: C = param b +// CHECK:STDOUT: @TestOp.%b: C = bind_name b, %b.loc26_17.1 +// CHECK:STDOUT: %C.ref.loc26_26: type = name_ref C, %C.decl [template = constants.%C] // CHECK:STDOUT: @TestOp.%return: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.9: type = import_ref ir4, inst+86, loaded [template = constants.%.2] // CHECK:STDOUT: %import_ref.10 = import_ref ir4, inst+104, unloaded // CHECK:STDOUT: %TestAssign.decl: TestAssign = fn_decl @TestAssign [template = constants.%struct.7] { -// CHECK:STDOUT: %C.ref.loc26_18: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc26: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %a.loc26_15.1: C* = param a -// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc26_15.1 -// CHECK:STDOUT: %C.ref.loc26_25: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %b.loc26_22.1: C = param b -// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc26_22.1 +// CHECK:STDOUT: %C.ref.loc30_18: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc30: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %a.loc30_15.1: C* = param a +// CHECK:STDOUT: @TestAssign.%a: C* = bind_name a, %a.loc30_15.1 +// CHECK:STDOUT: %C.ref.loc30_25: type = name_ref C, %C.decl [template = constants.%C] +// CHECK:STDOUT: %b.loc30_22.1: C = param b +// CHECK:STDOUT: @TestAssign.%b: C = bind_name b, %b.loc30_22.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.11: type = import_ref ir4, inst+110, loaded [template = constants.%.6] // CHECK:STDOUT: %import_ref.12 = import_ref ir4, inst+127, unloaded @@ -129,13 +133,13 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.1: C as Sub { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.1 [template = constants.%struct.1] { -// CHECK:STDOUT: %C.ref.loc14_15: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %self.loc14_9.1: C = param self -// CHECK:STDOUT: %self.loc14_9.2: C = bind_name self, %self.loc14_9.1 -// CHECK:STDOUT: %C.ref.loc14_25: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc14_18.1: C = param other -// CHECK:STDOUT: %other.loc14_18.2: C = bind_name other, %other.loc14_18.1 -// CHECK:STDOUT: %C.ref.loc14_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %C.ref.loc18_15: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %self.loc18_9.1: C = param self +// CHECK:STDOUT: %self.loc18_9.2: C = bind_name self, %self.loc18_9.1 +// CHECK:STDOUT: %C.ref.loc18_25: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc18_18.1: C = param other +// CHECK:STDOUT: %other.loc18_18.2: C = bind_name other, %other.loc18_18.1 +// CHECK:STDOUT: %C.ref.loc18_31: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %return.var: ref C = var // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.4] @@ -147,14 +151,14 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: // CHECK:STDOUT: impl @impl.2: C as SubAssign { // CHECK:STDOUT: %Op.decl: Op = fn_decl @Op.3 [template = constants.%struct.4] { -// CHECK:STDOUT: %C.ref.loc19_20: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc19_21: type = ptr_type C [template = constants.%.7] -// CHECK:STDOUT: %self.loc19_14.1: C* = param self -// CHECK:STDOUT: %self.loc19_14.3: C* = bind_name self, %self.loc19_14.1 -// CHECK:STDOUT: %.loc19_9: C* = addr_pattern %self.loc19_14.3 -// CHECK:STDOUT: %C.ref.loc19_31: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %other.loc19_24.1: C = param other -// CHECK:STDOUT: %other.loc19_24.2: C = bind_name other, %other.loc19_24.1 +// CHECK:STDOUT: %C.ref.loc23_20: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %.loc23_21: type = ptr_type C [template = constants.%.7] +// CHECK:STDOUT: %self.loc23_14.1: C* = param self +// CHECK:STDOUT: %self.loc23_14.3: C* = bind_name self, %self.loc23_14.1 +// CHECK:STDOUT: %.loc23_9: C* = addr_pattern %self.loc23_14.3 +// CHECK:STDOUT: %C.ref.loc23_31: type = name_ref C, file.%C.decl [template = constants.%C] +// CHECK:STDOUT: %other.loc23_24.1: C = param other +// CHECK:STDOUT: %other.loc23_24.2: C = bind_name other, %other.loc23_24.1 // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = interface_witness (%Op.decl) [template = constants.%.9] // CHECK:STDOUT: @@ -168,17 +172,17 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc14_9.2: C](@impl.1.%other.loc14_18.2: C) -> @impl.1.%return.var: C { +// CHECK:STDOUT: fn @Op.1[@impl.1.%self.loc18_9.2: C](@impl.1.%other.loc18_18.2: C) -> @impl.1.%return.var: C { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_13.1: {} = struct_literal () -// CHECK:STDOUT: %.loc15_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc15_14: init C = converted %.loc15_13.1, %.loc15_13.2 [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc15_14 to @impl.1.%return.var +// CHECK:STDOUT: %.loc19_13.1: {} = struct_literal () +// CHECK:STDOUT: %.loc19_13.2: init C = class_init (), @impl.1.%return.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc19_14: init C = converted %.loc19_13.1, %.loc19_13.2 [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc19_14 to @impl.1.%return.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Op.2[%self: Self](%other: Self) -> Self; // CHECK:STDOUT: -// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc19_14.3: C*](@impl.2.%other.loc19_24.2: C) { +// CHECK:STDOUT: fn @Op.3[addr @impl.2.%self.loc23_14.3: C*](@impl.2.%other.loc23_24.2: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: return // CHECK:STDOUT: } @@ -190,21 +194,21 @@ fn TestAssign(a: C*, b: C) { // CHECK:STDOUT: %a.ref: C = name_ref a, %a // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.1.%.1, element0 [template = constants.%struct.1] -// CHECK:STDOUT: %.loc23: = bound_method %a.ref, %.1 -// CHECK:STDOUT: %.loc22: ref C = splice_block %return {} -// CHECK:STDOUT: %Op.call: init C = call %.loc23(%a.ref, %b.ref) to %.loc22 +// CHECK:STDOUT: %.loc27: = bound_method %a.ref, %.1 +// CHECK:STDOUT: %.loc26: ref C = splice_block %return {} +// CHECK:STDOUT: %Op.call: init C = call %.loc27(%a.ref, %b.ref) to %.loc26 // CHECK:STDOUT: return %Op.call to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @TestAssign(%a: C*, %b: C) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %a.ref: C* = name_ref a, %a -// CHECK:STDOUT: %.loc27_3.1: ref C = deref %a.ref +// CHECK:STDOUT: %.loc31_3.1: ref C = deref %a.ref // CHECK:STDOUT: %b.ref: C = name_ref b, %b // CHECK:STDOUT: %.1: Op = interface_witness_access @impl.2.%.1, element0 [template = constants.%struct.4] -// CHECK:STDOUT: %.loc27_6: = bound_method %.loc27_3.1, %.1 -// CHECK:STDOUT: %.loc27_3.2: C* = addr_of %.loc27_3.1 -// CHECK:STDOUT: %Op.call: init () = call %.loc27_6(%.loc27_3.2, %b.ref) +// CHECK:STDOUT: %.loc31_6: = bound_method %.loc31_3.1, %.1 +// CHECK:STDOUT: %.loc31_3.2: C* = addr_of %.loc31_3.1 +// CHECK:STDOUT: %Op.call: init () = call %.loc31_6(%.loc31_3.2, %b.ref) // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/package_expr/fail_not_found.carbon b/toolchain/check/testdata/package_expr/fail_not_found.carbon index f783d8e0b222..3e21dd851341 100644 --- a/toolchain/check/testdata/package_expr/fail_not_found.carbon +++ b/toolchain/check/testdata/package_expr/fail_not_found.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/package_expr/fail_not_found.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/package_expr/fail_not_found.carbon fn Main() { // CHECK:STDERR: fail_not_found.carbon:[[@LINE+3]]:16: ERROR: Name `x` not found. @@ -34,8 +38,8 @@ fn Main() { // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_10.2: type = converted %int.make_type_32, %.loc11_10.1 [template = i32] +// CHECK:STDOUT: %.loc15_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_10.2: type = converted %int.make_type_32, %.loc15_10.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: %package.ref: = name_ref package, package [template = package] diff --git a/toolchain/check/testdata/package_expr/syntax.carbon b/toolchain/check/testdata/package_expr/syntax.carbon index 76bc6860bc95..0fcae096706d 100644 --- a/toolchain/check/testdata/package_expr/syntax.carbon +++ b/toolchain/check/testdata/package_expr/syntax.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/package_expr/syntax.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/package_expr/syntax.carbon // --- global.carbon diff --git a/toolchain/check/testdata/packages/explicit_imports.carbon b/toolchain/check/testdata/packages/explicit_imports.carbon index b5ee9b802be3..7d688198c4a3 100644 --- a/toolchain/check/testdata/packages/explicit_imports.carbon +++ b/toolchain/check/testdata/packages/explicit_imports.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/explicit_imports.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/explicit_imports.carbon // --- api.carbon diff --git a/toolchain/check/testdata/packages/fail_api_not_found.carbon b/toolchain/check/testdata/packages/fail_api_not_found.carbon index 439c09d126c3..70f34127b169 100644 --- a/toolchain/check/testdata/packages/fail_api_not_found.carbon +++ b/toolchain/check/testdata/packages/fail_api_not_found.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_api_not_found.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_api_not_found.carbon // --- fail_no_api.impl.carbon diff --git a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon index 5ceedba5b16b..391532538d10 100644 --- a/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +++ b/toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_conflict_no_namespaces.carbon // --- fn.carbon diff --git a/toolchain/check/testdata/packages/fail_cycle.carbon b/toolchain/check/testdata/packages/fail_cycle.carbon index 79d4447e5bf7..fb9fa2822b15 100644 --- a/toolchain/check/testdata/packages/fail_cycle.carbon +++ b/toolchain/check/testdata/packages/fail_cycle.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_cycle.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_cycle.carbon // --- fail_a.carbon diff --git a/toolchain/check/testdata/packages/fail_duplicate_api.carbon b/toolchain/check/testdata/packages/fail_duplicate_api.carbon index 669e2eb26801..857fe6e6b849 100644 --- a/toolchain/check/testdata/packages/fail_duplicate_api.carbon +++ b/toolchain/check/testdata/packages/fail_duplicate_api.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_duplicate_api.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_duplicate_api.carbon // CHECK:STDERR: fail_main2.carbon: ERROR: Main//default previously provided by `main1.carbon`. // CHECK:STDERR: diff --git a/toolchain/check/testdata/packages/fail_extension.carbon b/toolchain/check/testdata/packages/fail_extension.carbon index 184958ae318d..41f88034129c 100644 --- a/toolchain/check/testdata/packages/fail_extension.carbon +++ b/toolchain/check/testdata/packages/fail_extension.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_extension.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_extension.carbon // CHECK:STDERR: fail_main.incorrect: ERROR: File extension of `.carbon` required for `api`. // CHECK:STDERR: // CHECK:STDERR: fail_main_redundant_with_swapped_ext.impl.carbon: ERROR: Main//default previously provided by `fail_main.incorrect`. diff --git a/toolchain/check/testdata/packages/fail_import_default.carbon b/toolchain/check/testdata/packages/fail_import_default.carbon index 4ec26845b277..6798b8f0507b 100644 --- a/toolchain/check/testdata/packages/fail_import_default.carbon +++ b/toolchain/check/testdata/packages/fail_import_default.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_import_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_default.carbon // --- fail_default_api.carbon diff --git a/toolchain/check/testdata/packages/fail_import_invalid.carbon b/toolchain/check/testdata/packages/fail_import_invalid.carbon index 4b20dfde6520..f5dc5b82ad2d 100644 --- a/toolchain/check/testdata/packages/fail_import_invalid.carbon +++ b/toolchain/check/testdata/packages/fail_import_invalid.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_import_invalid.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_invalid.carbon // --- fail_main.carbon diff --git a/toolchain/check/testdata/packages/fail_import_repeat.carbon b/toolchain/check/testdata/packages/fail_import_repeat.carbon index f7fa0c9de77d..9a83364245eb 100644 --- a/toolchain/check/testdata/packages/fail_import_repeat.carbon +++ b/toolchain/check/testdata/packages/fail_import_repeat.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_import_repeat.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_repeat.carbon // --- api.carbon diff --git a/toolchain/check/testdata/packages/fail_import_type_error.carbon b/toolchain/check/testdata/packages/fail_import_type_error.carbon index 3785689dd2a9..deef4a37c107 100644 --- a/toolchain/check/testdata/packages/fail_import_type_error.carbon +++ b/toolchain/check/testdata/packages/fail_import_type_error.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_import_type_error.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_import_type_error.carbon // --- fail_implicit.carbon diff --git a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon index 37d12e47c679..6516210d1786 100644 --- a/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon +++ b/toolchain/check/testdata/packages/fail_name_with_import_failure.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_name_with_import_failure.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_name_with_import_failure.carbon // --- fail_implicit.impl.carbon diff --git a/toolchain/check/testdata/packages/fail_package_main.carbon b/toolchain/check/testdata/packages/fail_package_main.carbon index 01575ce7203a..2288ea5636fc 100644 --- a/toolchain/check/testdata/packages/fail_package_main.carbon +++ b/toolchain/check/testdata/packages/fail_package_main.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/fail_package_main.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/fail_package_main.carbon // --- fail_main.carbon diff --git a/toolchain/check/testdata/packages/implicit_imports.carbon b/toolchain/check/testdata/packages/implicit_imports.carbon index a0f255a35b75..01ce48ab9dd8 100644 --- a/toolchain/check/testdata/packages/implicit_imports.carbon +++ b/toolchain/check/testdata/packages/implicit_imports.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/implicit_imports.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/implicit_imports.carbon // --- api_only.carbon diff --git a/toolchain/check/testdata/packages/loaded_global.carbon b/toolchain/check/testdata/packages/loaded_global.carbon index 56bda55d47c4..685ad2da0b70 100644 --- a/toolchain/check/testdata/packages/loaded_global.carbon +++ b/toolchain/check/testdata/packages/loaded_global.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/loaded_global.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/loaded_global.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon b/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon index abdaec54104e..02cf4277a085 100644 --- a/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon +++ b/toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/cross_package_export.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon b/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon index 353652abe134..30fdf965276d 100644 --- a/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon +++ b/toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/cross_package_import.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/packages/no_prelude/export_import.carbon b/toolchain/check/testdata/packages/no_prelude/export_import.carbon index 0a1d5668e48b..4d7bae4b18a4 100644 --- a/toolchain/check/testdata/packages/no_prelude/export_import.carbon +++ b/toolchain/check/testdata/packages/no_prelude/export_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/export_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/export_import.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/packages/no_prelude/export_mixed.carbon b/toolchain/check/testdata/packages/no_prelude/export_mixed.carbon index 3878b28bd802..a8aec43c0d5c 100644 --- a/toolchain/check/testdata/packages/no_prelude/export_mixed.carbon +++ b/toolchain/check/testdata/packages/no_prelude/export_mixed.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/export_mixed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/export_mixed.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/packages/no_prelude/export_name.carbon b/toolchain/check/testdata/packages/no_prelude/export_name.carbon index 7ac893fc132e..d316fd802e62 100644 --- a/toolchain/check/testdata/packages/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/packages/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon b/toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon index be3f144dc704..7bd75872e845 100644 --- a/toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon +++ b/toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/fail_export_name_member.carbon // --- a.carbon diff --git a/toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon b/toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon index 89c31f1ce7ba..49160b393649 100644 --- a/toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon +++ b/toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/fail_export_name_params.carbon // --- a.carbon diff --git a/toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon index b940d52b684a..34af099b4e2c 100644 --- a/toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/fail_modifiers.carbon // --- fail_export_package.carbon diff --git a/toolchain/check/testdata/packages/unused_lazy_import.carbon b/toolchain/check/testdata/packages/unused_lazy_import.carbon index 1c0391741466..d81468e81c7e 100644 --- a/toolchain/check/testdata/packages/unused_lazy_import.carbon +++ b/toolchain/check/testdata/packages/unused_lazy_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/unused_lazy_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/unused_lazy_import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/pointer/address_of_deref.carbon b/toolchain/check/testdata/pointer/address_of_deref.carbon index 84ad7f0a14e8..0a50de5518e9 100644 --- a/toolchain/check/testdata/pointer/address_of_deref.carbon +++ b/toolchain/check/testdata/pointer/address_of_deref.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/address_of_deref.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/address_of_deref.carbon fn F() -> i32 { var n: i32 = 0; @@ -30,8 +34,8 @@ fn F() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -42,18 +46,18 @@ fn F() -> i32 { // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc8_16 +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc12_16 // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc9_13: i32* = addr_of %n.ref -// CHECK:STDOUT: %.loc9_12: ref i32 = deref %.loc9_13 -// CHECK:STDOUT: %.loc9_11: i32* = addr_of %.loc9_12 -// CHECK:STDOUT: %.loc9_10.1: ref i32 = deref %.loc9_11 -// CHECK:STDOUT: %.loc9_10.2: i32 = bind_value %.loc9_10.1 -// CHECK:STDOUT: return %.loc9_10.2 +// CHECK:STDOUT: %.loc13_13: i32* = addr_of %n.ref +// CHECK:STDOUT: %.loc13_12: ref i32 = deref %.loc13_13 +// CHECK:STDOUT: %.loc13_11: i32* = addr_of %.loc13_12 +// CHECK:STDOUT: %.loc13_10.1: ref i32 = deref %.loc13_11 +// CHECK:STDOUT: %.loc13_10.2: i32 = bind_value %.loc13_10.1 +// CHECK:STDOUT: return %.loc13_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/address_of_lvalue.carbon b/toolchain/check/testdata/pointer/address_of_lvalue.carbon index 6bb5dcfb368b..31ac075da15a 100644 --- a/toolchain/check/testdata/pointer/address_of_lvalue.carbon +++ b/toolchain/check/testdata/pointer/address_of_lvalue.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/address_of_lvalue.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/address_of_lvalue.carbon fn F() { var s: {.a: i32, .b: i32} = {.a = 1, .b = 2}; @@ -58,100 +62,100 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc8_15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_15.1: type = value_of_initializer %int.make_type_32.loc8_15 [template = i32] -// CHECK:STDOUT: %.loc8_15.2: type = converted %int.make_type_32.loc8_15, %.loc8_15.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc8_24: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_24.1: type = value_of_initializer %int.make_type_32.loc8_24 [template = i32] -// CHECK:STDOUT: %.loc8_24.2: type = converted %int.make_type_32.loc8_24, %.loc8_24.1 [template = i32] -// CHECK:STDOUT: %.loc8_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc12_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_15.1: type = value_of_initializer %int.make_type_32.loc12_15 [template = i32] +// CHECK:STDOUT: %.loc12_15.2: type = converted %int.make_type_32.loc12_15, %.loc12_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_24.1: type = value_of_initializer %int.make_type_32.loc12_24 [template = i32] +// CHECK:STDOUT: %.loc12_24.2: type = converted %int.make_type_32.loc12_24, %.loc12_24.1 [template = i32] +// CHECK:STDOUT: %.loc12_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %s.var: ref {.a: i32, .b: i32} = var s // CHECK:STDOUT: %s: ref {.a: i32, .b: i32} = bind_name s, %s.var -// CHECK:STDOUT: %.loc8_37: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_45: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_46.1: {.a: i32, .b: i32} = struct_literal (%.loc8_37, %.loc8_45) -// CHECK:STDOUT: %.loc8_46.2: ref i32 = struct_access %s.var, element0 -// CHECK:STDOUT: %.loc8_46.3: init i32 = initialize_from %.loc8_37 to %.loc8_46.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc8_46.4: ref i32 = struct_access %s.var, element1 -// CHECK:STDOUT: %.loc8_46.5: init i32 = initialize_from %.loc8_45 to %.loc8_46.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc8_46.6: init {.a: i32, .b: i32} = struct_init (%.loc8_46.3, %.loc8_46.5) to %s.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc8_47: init {.a: i32, .b: i32} = converted %.loc8_46.1, %.loc8_46.6 [template = constants.%struct.3] -// CHECK:STDOUT: assign %s.var, %.loc8_47 -// CHECK:STDOUT: %int.make_type_32.loc10_15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_15.1: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] -// CHECK:STDOUT: %.loc10_15.2: type = converted %int.make_type_32.loc10_15, %.loc10_15.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_24: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc10_24.1: type = value_of_initializer %int.make_type_32.loc10_24 [template = i32] -// CHECK:STDOUT: %.loc10_24.2: type = converted %int.make_type_32.loc10_24, %.loc10_24.1 [template = i32] -// CHECK:STDOUT: %.loc10_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] -// CHECK:STDOUT: %.loc10_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.3] +// CHECK:STDOUT: %.loc12_37: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_45: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_46.1: {.a: i32, .b: i32} = struct_literal (%.loc12_37, %.loc12_45) +// CHECK:STDOUT: %.loc12_46.2: ref i32 = struct_access %s.var, element0 +// CHECK:STDOUT: %.loc12_46.3: init i32 = initialize_from %.loc12_37 to %.loc12_46.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc12_46.4: ref i32 = struct_access %s.var, element1 +// CHECK:STDOUT: %.loc12_46.5: init i32 = initialize_from %.loc12_45 to %.loc12_46.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc12_46.6: init {.a: i32, .b: i32} = struct_init (%.loc12_46.3, %.loc12_46.5) to %s.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_47: init {.a: i32, .b: i32} = converted %.loc12_46.1, %.loc12_46.6 [template = constants.%struct.3] +// CHECK:STDOUT: assign %s.var, %.loc12_47 +// CHECK:STDOUT: %int.make_type_32.loc14_15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_15.1: type = value_of_initializer %int.make_type_32.loc14_15 [template = i32] +// CHECK:STDOUT: %.loc14_15.2: type = converted %int.make_type_32.loc14_15, %.loc14_15.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_24: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc14_24.1: type = value_of_initializer %int.make_type_32.loc14_24 [template = i32] +// CHECK:STDOUT: %.loc14_24.2: type = converted %int.make_type_32.loc14_24, %.loc14_24.1 [template = i32] +// CHECK:STDOUT: %.loc14_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_28: type = ptr_type {.a: i32, .b: i32} [template = constants.%.3] // CHECK:STDOUT: %p.var: ref {.a: i32, .b: i32}* = var p // CHECK:STDOUT: %p: ref {.a: i32, .b: i32}* = bind_name p, %p.var -// CHECK:STDOUT: %s.ref.loc10: ref {.a: i32, .b: i32} = name_ref s, %s -// CHECK:STDOUT: %.loc10_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc10 -// CHECK:STDOUT: assign %p.var, %.loc10_32 -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] -// CHECK:STDOUT: %.loc11_13.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %s.ref.loc14: ref {.a: i32, .b: i32} = name_ref s, %s +// CHECK:STDOUT: %.loc14_32: {.a: i32, .b: i32}* = addr_of %s.ref.loc14 +// CHECK:STDOUT: assign %p.var, %.loc14_32 +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_13.2: type = converted %int.make_type_32.loc15, %.loc15_13.1 [template = i32] +// CHECK:STDOUT: %.loc15_13.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %q.var: ref i32* = var q // CHECK:STDOUT: %q: ref i32* = bind_name q, %q.var -// CHECK:STDOUT: %s.ref.loc11: ref {.a: i32, .b: i32} = name_ref s, %s -// CHECK:STDOUT: %.loc11_19: ref i32 = struct_access %s.ref.loc11, element0 -// CHECK:STDOUT: %.loc11_17: i32* = addr_of %.loc11_19 -// CHECK:STDOUT: assign %q.var, %.loc11_17 -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] -// CHECK:STDOUT: %.loc12_13.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %s.ref.loc15: ref {.a: i32, .b: i32} = name_ref s, %s +// CHECK:STDOUT: %.loc15_19: ref i32 = struct_access %s.ref.loc15, element0 +// CHECK:STDOUT: %.loc15_17: i32* = addr_of %.loc15_19 +// CHECK:STDOUT: assign %q.var, %.loc15_17 +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] +// CHECK:STDOUT: %.loc16_13.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %r.var: ref i32* = var r // CHECK:STDOUT: %r: ref i32* = bind_name r, %r.var -// CHECK:STDOUT: %s.ref.loc12: ref {.a: i32, .b: i32} = name_ref s, %s -// CHECK:STDOUT: %.loc12_19: ref i32 = struct_access %s.ref.loc12, element1 -// CHECK:STDOUT: %.loc12_17: i32* = addr_of %.loc12_19 -// CHECK:STDOUT: assign %r.var, %.loc12_17 -// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc14_19.1: (type, type) = tuple_literal (%int.make_type_32.loc14_11, %int.make_type_32.loc14_16) -// CHECK:STDOUT: %.loc14_19.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] -// CHECK:STDOUT: %.loc14_19.3: type = converted %int.make_type_32.loc14_11, %.loc14_19.2 [template = i32] -// CHECK:STDOUT: %.loc14_19.4: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] -// CHECK:STDOUT: %.loc14_19.5: type = converted %int.make_type_32.loc14_16, %.loc14_19.4 [template = i32] -// CHECK:STDOUT: %.loc14_19.6: type = converted %.loc14_19.1, constants.%.8 [template = constants.%.8] +// CHECK:STDOUT: %s.ref.loc16: ref {.a: i32, .b: i32} = name_ref s, %s +// CHECK:STDOUT: %.loc16_19: ref i32 = struct_access %s.ref.loc16, element1 +// CHECK:STDOUT: %.loc16_17: i32* = addr_of %.loc16_19 +// CHECK:STDOUT: assign %r.var, %.loc16_17 +// CHECK:STDOUT: %int.make_type_32.loc18_11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_16: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc18_19.1: (type, type) = tuple_literal (%int.make_type_32.loc18_11, %int.make_type_32.loc18_16) +// CHECK:STDOUT: %.loc18_19.2: type = value_of_initializer %int.make_type_32.loc18_11 [template = i32] +// CHECK:STDOUT: %.loc18_19.3: type = converted %int.make_type_32.loc18_11, %.loc18_19.2 [template = i32] +// CHECK:STDOUT: %.loc18_19.4: type = value_of_initializer %int.make_type_32.loc18_16 [template = i32] +// CHECK:STDOUT: %.loc18_19.5: type = converted %int.make_type_32.loc18_16, %.loc18_19.4 [template = i32] +// CHECK:STDOUT: %.loc18_19.6: type = converted %.loc18_19.1, constants.%.8 [template = constants.%.8] // CHECK:STDOUT: %t.var: ref (i32, i32) = var t // CHECK:STDOUT: %t: ref (i32, i32) = bind_name t, %t.var -// CHECK:STDOUT: %.loc14_24: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_27: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_24, %.loc14_27) -// CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access %t.var, element0 -// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_24 to %.loc14_28.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc14_28.4: ref i32 = tuple_access %t.var, element1 -// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_27 to %.loc14_28.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to %t.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc14_29: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple] -// CHECK:STDOUT: assign %t.var, %.loc14_29 -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc15_14.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_14.2: type = converted %int.make_type_32.loc15, %.loc15_14.1 [template = i32] -// CHECK:STDOUT: %.loc15_14.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %.loc18_24: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_27: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_28.1: (i32, i32) = tuple_literal (%.loc18_24, %.loc18_27) +// CHECK:STDOUT: %.loc18_28.2: ref i32 = tuple_access %t.var, element0 +// CHECK:STDOUT: %.loc18_28.3: init i32 = initialize_from %.loc18_24 to %.loc18_28.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc18_28.4: ref i32 = tuple_access %t.var, element1 +// CHECK:STDOUT: %.loc18_28.5: init i32 = initialize_from %.loc18_27 to %.loc18_28.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc18_28.6: init (i32, i32) = tuple_init (%.loc18_28.3, %.loc18_28.5) to %t.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc18_29: init (i32, i32) = converted %.loc18_28.1, %.loc18_28.6 [template = constants.%tuple] +// CHECK:STDOUT: assign %t.var, %.loc18_29 +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc19_14.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_14.2: type = converted %int.make_type_32.loc19, %.loc19_14.1 [template = i32] +// CHECK:STDOUT: %.loc19_14.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t0.var: ref i32* = var t0 // CHECK:STDOUT: %t0: ref i32* = bind_name t0, %t0.var -// CHECK:STDOUT: %t.ref.loc15: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc15_21: i32 = int_literal 0 [template = constants.%.10] -// CHECK:STDOUT: %.loc15_22: ref i32 = tuple_index %t.ref.loc15, %.loc15_21 -// CHECK:STDOUT: %.loc15_18: i32* = addr_of %.loc15_22 -// CHECK:STDOUT: assign %t0.var, %.loc15_18 -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc16_14.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_14.2: type = converted %int.make_type_32.loc16, %.loc16_14.1 [template = i32] -// CHECK:STDOUT: %.loc16_14.3: type = ptr_type i32 [template = constants.%.6] +// CHECK:STDOUT: %t.ref.loc19: ref (i32, i32) = name_ref t, %t +// CHECK:STDOUT: %.loc19_21: i32 = int_literal 0 [template = constants.%.10] +// CHECK:STDOUT: %.loc19_22: ref i32 = tuple_index %t.ref.loc19, %.loc19_21 +// CHECK:STDOUT: %.loc19_18: i32* = addr_of %.loc19_22 +// CHECK:STDOUT: assign %t0.var, %.loc19_18 +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc20_14.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_14.2: type = converted %int.make_type_32.loc20, %.loc20_14.1 [template = i32] +// CHECK:STDOUT: %.loc20_14.3: type = ptr_type i32 [template = constants.%.6] // CHECK:STDOUT: %t1.var: ref i32* = var t1 // CHECK:STDOUT: %t1: ref i32* = bind_name t1, %t1.var -// CHECK:STDOUT: %t.ref.loc16: ref (i32, i32) = name_ref t, %t -// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc16_22: ref i32 = tuple_index %t.ref.loc16, %.loc16_21 -// CHECK:STDOUT: %.loc16_18: i32* = addr_of %.loc16_22 -// CHECK:STDOUT: assign %t1.var, %.loc16_18 +// CHECK:STDOUT: %t.ref.loc20: ref (i32, i32) = name_ref t, %t +// CHECK:STDOUT: %.loc20_21: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc20_22: ref i32 = tuple_index %t.ref.loc20, %.loc20_21 +// CHECK:STDOUT: %.loc20_18: i32* = addr_of %.loc20_22 +// CHECK:STDOUT: assign %t1.var, %.loc20_18 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/arrow.carbon b/toolchain/check/testdata/pointer/arrow.carbon index d03887ad1613..db10a9ebc949 100644 --- a/toolchain/check/testdata/pointer/arrow.carbon +++ b/toolchain/check/testdata/pointer/arrow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/arrow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/arrow.carbon class C { fn Member[self: Self](); @@ -44,60 +48,60 @@ fn Foo(ptr: C*) { // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.2] { // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc12: type = ptr_type C [template = constants.%.2] -// CHECK:STDOUT: %ptr.loc12_8.1: C* = param ptr -// CHECK:STDOUT: @Foo.%ptr: C* = bind_name ptr, %ptr.loc12_8.1 +// CHECK:STDOUT: %.loc16: type = ptr_type C [template = constants.%.2] +// CHECK:STDOUT: %ptr.loc16_8.1: C* = param ptr +// CHECK:STDOUT: @Foo.%ptr: C* = bind_name ptr, %ptr.loc16_8.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { // CHECK:STDOUT: %Member.decl: Member = fn_decl @Member [template = constants.%struct.1] { // CHECK:STDOUT: %Self.ref: type = name_ref Self, constants.%C [template = constants.%C] -// CHECK:STDOUT: %self.loc8_13.1: C = param self -// CHECK:STDOUT: %self.loc8_13.2: C = bind_name self, %self.loc8_13.1 +// CHECK:STDOUT: %self.loc12_13.1: C = param self +// CHECK:STDOUT: %self.loc12_13.2: C = bind_name self, %self.loc12_13.1 // CHECK:STDOUT: } // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] -// CHECK:STDOUT: %.loc9_15: type = ptr_type C [template = constants.%.2] -// CHECK:STDOUT: %.loc9_12: = field_decl field, element0 [template] +// CHECK:STDOUT: %.loc13_15: type = ptr_type C [template = constants.%.2] +// CHECK:STDOUT: %.loc13_12: = field_decl field, element0 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C // CHECK:STDOUT: .Member = %Member.decl -// CHECK:STDOUT: .field = %.loc9_12 +// CHECK:STDOUT: .field = %.loc13_12 // CHECK:STDOUT: } // CHECK:STDOUT: -// CHECK:STDOUT: fn @Member[@C.%self.loc8_13.2: C](); +// CHECK:STDOUT: fn @Member[@C.%self.loc12_13.2: C](); // CHECK:STDOUT: // CHECK:STDOUT: fn @Foo(%ptr: C*) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %ptr.ref.loc13: C* = name_ref ptr, %ptr -// CHECK:STDOUT: %.loc13_4.1: ref C = deref %ptr.ref.loc13 -// CHECK:STDOUT: %Member.ref.loc13: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc13_9: = bound_method %.loc13_4.1, %Member.ref.loc13 -// CHECK:STDOUT: %.loc13_4.2: C = bind_value %.loc13_4.1 -// CHECK:STDOUT: %Member.call.loc13: init () = call %.loc13_9(%.loc13_4.2) -// CHECK:STDOUT: %ptr.ref.loc14: C* = name_ref ptr, %ptr -// CHECK:STDOUT: %.loc14_6.1: ref C = deref %ptr.ref.loc14 -// CHECK:STDOUT: %Member.ref.loc14: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] -// CHECK:STDOUT: %.loc14_6.2: = bound_method %.loc14_6.1, %Member.ref.loc14 -// CHECK:STDOUT: %.loc14_6.3: C = bind_value %.loc14_6.1 -// CHECK:STDOUT: %Member.call.loc14: init () = call %.loc14_6.2(%.loc14_6.3) -// CHECK:STDOUT: %ptr.ref.loc16: C* = name_ref ptr, %ptr -// CHECK:STDOUT: %.loc16_4: ref C = deref %ptr.ref.loc16 -// CHECK:STDOUT: %field.ref.loc16: = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12] -// CHECK:STDOUT: %.loc16_9: ref C* = class_element_access %.loc16_4, element0 // CHECK:STDOUT: %ptr.ref.loc17: C* = name_ref ptr, %ptr -// CHECK:STDOUT: %.loc17_6.1: ref C = deref %ptr.ref.loc17 -// CHECK:STDOUT: %field.ref.loc17: = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12] -// CHECK:STDOUT: %.loc17_6.2: ref C* = class_element_access %.loc17_6.1, element0 -// CHECK:STDOUT: %ptr.ref.loc19: C* = name_ref ptr, %ptr -// CHECK:STDOUT: %.loc19_6.1: ref C = deref %ptr.ref.loc19 -// CHECK:STDOUT: %field.ref.loc19_6: = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12] -// CHECK:STDOUT: %.loc19_6.2: ref C* = class_element_access %.loc19_6.1, element0 -// CHECK:STDOUT: %.loc19_6.3: C* = bind_value %.loc19_6.2 -// CHECK:STDOUT: %.loc19_13.1: ref C = deref %.loc19_6.3 -// CHECK:STDOUT: %field.ref.loc19_13: = name_ref field, @C.%.loc9_12 [template = @C.%.loc9_12] -// CHECK:STDOUT: %.loc19_13.2: ref C* = class_element_access %.loc19_13.1, element0 +// CHECK:STDOUT: %.loc17_4.1: ref C = deref %ptr.ref.loc17 +// CHECK:STDOUT: %Member.ref.loc17: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc17_9: = bound_method %.loc17_4.1, %Member.ref.loc17 +// CHECK:STDOUT: %.loc17_4.2: C = bind_value %.loc17_4.1 +// CHECK:STDOUT: %Member.call.loc17: init () = call %.loc17_9(%.loc17_4.2) +// CHECK:STDOUT: %ptr.ref.loc18: C* = name_ref ptr, %ptr +// CHECK:STDOUT: %.loc18_6.1: ref C = deref %ptr.ref.loc18 +// CHECK:STDOUT: %Member.ref.loc18: Member = name_ref Member, @C.%Member.decl [template = constants.%struct.1] +// CHECK:STDOUT: %.loc18_6.2: = bound_method %.loc18_6.1, %Member.ref.loc18 +// CHECK:STDOUT: %.loc18_6.3: C = bind_value %.loc18_6.1 +// CHECK:STDOUT: %Member.call.loc18: init () = call %.loc18_6.2(%.loc18_6.3) +// CHECK:STDOUT: %ptr.ref.loc20: C* = name_ref ptr, %ptr +// CHECK:STDOUT: %.loc20_4: ref C = deref %ptr.ref.loc20 +// CHECK:STDOUT: %field.ref.loc20: = name_ref field, @C.%.loc13_12 [template = @C.%.loc13_12] +// CHECK:STDOUT: %.loc20_9: ref C* = class_element_access %.loc20_4, element0 +// CHECK:STDOUT: %ptr.ref.loc21: C* = name_ref ptr, %ptr +// CHECK:STDOUT: %.loc21_6.1: ref C = deref %ptr.ref.loc21 +// CHECK:STDOUT: %field.ref.loc21: = name_ref field, @C.%.loc13_12 [template = @C.%.loc13_12] +// CHECK:STDOUT: %.loc21_6.2: ref C* = class_element_access %.loc21_6.1, element0 +// CHECK:STDOUT: %ptr.ref.loc23: C* = name_ref ptr, %ptr +// CHECK:STDOUT: %.loc23_6.1: ref C = deref %ptr.ref.loc23 +// CHECK:STDOUT: %field.ref.loc23_6: = name_ref field, @C.%.loc13_12 [template = @C.%.loc13_12] +// CHECK:STDOUT: %.loc23_6.2: ref C* = class_element_access %.loc23_6.1, element0 +// CHECK:STDOUT: %.loc23_6.3: C* = bind_value %.loc23_6.2 +// CHECK:STDOUT: %.loc23_13.1: ref C = deref %.loc23_6.3 +// CHECK:STDOUT: %field.ref.loc23_13: = name_ref field, @C.%.loc13_12 [template = @C.%.loc13_12] +// CHECK:STDOUT: %.loc23_13.2: ref C* = class_element_access %.loc23_13.1, element0 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/basic.carbon b/toolchain/check/testdata/pointer/basic.carbon index 429689a92665..79eeb9bd6f3c 100644 --- a/toolchain/check/testdata/pointer/basic.carbon +++ b/toolchain/check/testdata/pointer/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/basic.carbon fn F() -> i32 { var n: i32 = 0; @@ -32,8 +36,8 @@ fn F() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -44,26 +48,26 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] // CHECK:STDOUT: %n.var: ref i32 = var n // CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %n.var, %.loc8_16 -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_13.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_13.2: type = converted %int.make_type_32.loc9, %.loc9_13.1 [template = i32] -// CHECK:STDOUT: %.loc9_13.3: type = ptr_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %n.var, %.loc12_16 +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_13.2: type = converted %int.make_type_32.loc13, %.loc13_13.1 [template = i32] +// CHECK:STDOUT: %.loc13_13.3: type = ptr_type i32 [template = constants.%.3] // CHECK:STDOUT: %p.var: ref i32* = var p // CHECK:STDOUT: %p: ref i32* = bind_name p, %p.var // CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n -// CHECK:STDOUT: %.loc9_17: i32* = addr_of %n.ref -// CHECK:STDOUT: assign %p.var, %.loc9_17 +// CHECK:STDOUT: %.loc13_17: i32* = addr_of %n.ref +// CHECK:STDOUT: assign %p.var, %.loc13_17 // CHECK:STDOUT: %p.ref: ref i32* = name_ref p, %p -// CHECK:STDOUT: %.loc11_11: i32* = bind_value %p.ref -// CHECK:STDOUT: %.loc11_10.1: ref i32 = deref %.loc11_11 -// CHECK:STDOUT: %.loc11_10.2: i32 = bind_value %.loc11_10.1 -// CHECK:STDOUT: return %.loc11_10.2 +// CHECK:STDOUT: %.loc15_11: i32* = bind_value %p.ref +// CHECK:STDOUT: %.loc15_10.1: ref i32 = deref %.loc15_11 +// CHECK:STDOUT: %.loc15_10.2: i32 = bind_value %.loc15_10.1 +// CHECK:STDOUT: return %.loc15_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_error.carbon b/toolchain/check/testdata/pointer/fail_address_of_error.carbon index 65c24dddd591..907b293092d7 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_error.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_error.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_address_of_error.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_address_of_error.carbon fn Test() { // CHECK:STDERR: fail_address_of_error.carbon:[[@LINE+4]]:4: ERROR: Name `undeclared` not found. @@ -39,11 +43,11 @@ fn Test() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Test() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %undeclared.ref.loc12: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc12: = addr_of %undeclared.ref.loc12 [template = ] -// CHECK:STDOUT: %undeclared.ref.loc20: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc20_5: = addr_of %undeclared.ref.loc20 [template = ] -// CHECK:STDOUT: %.loc20_3: = addr_of [template = ] +// CHECK:STDOUT: %undeclared.ref.loc16: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %.loc16: = addr_of %undeclared.ref.loc16 [template = ] +// CHECK:STDOUT: %undeclared.ref.loc24: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %.loc24_5: = addr_of %undeclared.ref.loc24 [template = ] +// CHECK:STDOUT: %.loc24_3: = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_address_of_value.carbon b/toolchain/check/testdata/pointer/fail_address_of_value.carbon index 3a85a2ce14cb..1133881e8feb 100644 --- a/toolchain/check/testdata/pointer/fail_address_of_value.carbon +++ b/toolchain/check/testdata/pointer/fail_address_of_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_address_of_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_address_of_value.carbon fn G() -> i32; @@ -154,17 +158,17 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32.loc7, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_16.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_16.2: type = converted %int.make_type_32.loc9, %.loc9_16.1 [template = i32] -// CHECK:STDOUT: %.loc9_19: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_16.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_16.2: type = converted %int.make_type_32.loc13, %.loc13_16.1 [template = i32] +// CHECK:STDOUT: %.loc13_19: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: @H.%return: ref {.a: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %AddressOfLiteral.decl: AddressOfLiteral = fn_decl @AddressOfLiteral [template = constants.%struct.4] {} @@ -176,11 +180,11 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: %AddressOfTupleElementValue.decl: AddressOfTupleElementValue = fn_decl @AddressOfTupleElementValue [template = constants.%struct.8] {} // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %AddressOfParam.decl: AddressOfParam = fn_decl @AddressOfParam [template = constants.%struct.9] { -// CHECK:STDOUT: %int.make_type_32.loc91: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc91_26.1: type = value_of_initializer %int.make_type_32.loc91 [template = i32] -// CHECK:STDOUT: %.loc91_26.2: type = converted %int.make_type_32.loc91, %.loc91_26.1 [template = i32] -// CHECK:STDOUT: %param.loc91_19.1: i32 = param param -// CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc91_19.1 +// CHECK:STDOUT: %int.make_type_32.loc95: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc95_26.1: type = value_of_initializer %int.make_type_32.loc95 [template = i32] +// CHECK:STDOUT: %.loc95_26.2: type = converted %int.make_type_32.loc95, %.loc95_26.1 [template = i32] +// CHECK:STDOUT: %param.loc95_19.1: i32 = param param +// CHECK:STDOUT: @AddressOfParam.%param: i32 = bind_name param, %param.loc95_19.1 // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } @@ -193,46 +197,46 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfLiteral() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc16_4: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %.loc16_3: i32* = addr_of [template = ] -// CHECK:STDOUT: %.loc21_4: bool = bool_literal true [template = constants.%.5] -// CHECK:STDOUT: %.loc21_3: bool* = addr_of [template = ] -// CHECK:STDOUT: %.loc26_4: f64 = float_literal 1 [template = constants.%.7] -// CHECK:STDOUT: %.loc26_3: f64* = addr_of [template = ] -// CHECK:STDOUT: %.loc31_4: String = string_literal "Hello" [template = constants.%.10] -// CHECK:STDOUT: %.loc31_3: String* = addr_of [template = ] -// CHECK:STDOUT: %.loc36_5: i32 = int_literal 1 [template = constants.%.11] -// CHECK:STDOUT: %.loc36_8: i32 = int_literal 2 [template = constants.%.12] -// CHECK:STDOUT: %.loc36_9: (i32, i32) = tuple_literal (%.loc36_5, %.loc36_8) -// CHECK:STDOUT: %.loc36_3: (i32, i32)* = addr_of [template = ] -// CHECK:STDOUT: %.loc41_10: i32 = int_literal 5 [template = constants.%.15] -// CHECK:STDOUT: %.loc41_11: {.a: i32} = struct_literal (%.loc41_10) -// CHECK:STDOUT: %.loc41_3: {.a: i32}* = addr_of [template = ] +// CHECK:STDOUT: %.loc20_4: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc20_3: i32* = addr_of [template = ] +// CHECK:STDOUT: %.loc25_4: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc25_3: bool* = addr_of [template = ] +// CHECK:STDOUT: %.loc30_4: f64 = float_literal 1 [template = constants.%.7] +// CHECK:STDOUT: %.loc30_3: f64* = addr_of [template = ] +// CHECK:STDOUT: %.loc35_4: String = string_literal "Hello" [template = constants.%.10] +// CHECK:STDOUT: %.loc35_3: String* = addr_of [template = ] +// CHECK:STDOUT: %.loc40_5: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc40_8: i32 = int_literal 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc40_9: (i32, i32) = tuple_literal (%.loc40_5, %.loc40_8) +// CHECK:STDOUT: %.loc40_3: (i32, i32)* = addr_of [template = ] +// CHECK:STDOUT: %.loc45_10: i32 = int_literal 5 [template = constants.%.15] +// CHECK:STDOUT: %.loc45_11: {.a: i32} = struct_literal (%.loc45_10) +// CHECK:STDOUT: %.loc45_3: {.a: i32}* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfOperator() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc49_5: bool = bool_literal true [template = constants.%.5] -// CHECK:STDOUT: %.loc49_10.1: bool = bool_literal false [template = constants.%.17] -// CHECK:STDOUT: if %.loc49_5 br !and.rhs else br !and.result(%.loc49_10.1) +// CHECK:STDOUT: %.loc53_5: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc53_10.1: bool = bool_literal false [template = constants.%.17] +// CHECK:STDOUT: if %.loc53_5 br !and.rhs else br !and.result(%.loc53_10.1) // CHECK:STDOUT: // CHECK:STDOUT: !and.rhs: -// CHECK:STDOUT: %.loc49_14: bool = bool_literal false [template = constants.%.17] -// CHECK:STDOUT: br !and.result(%.loc49_14) +// CHECK:STDOUT: %.loc53_14: bool = bool_literal false [template = constants.%.17] +// CHECK:STDOUT: br !and.result(%.loc53_14) // CHECK:STDOUT: // CHECK:STDOUT: !and.result: -// CHECK:STDOUT: %.loc49_10.2: bool = block_arg !and.result [template = constants.%.17] -// CHECK:STDOUT: %.loc49_3: bool* = addr_of [template = ] +// CHECK:STDOUT: %.loc53_10.2: bool = block_arg !and.result [template = constants.%.17] +// CHECK:STDOUT: %.loc53_3: bool* = addr_of [template = ] // CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.3] // CHECK:STDOUT: %H.call: init {.a: i32} = call %H.ref() -// CHECK:STDOUT: %.loc54_5.1: ref {.a: i32} = temporary_storage -// CHECK:STDOUT: %.loc54_5.2: ref {.a: i32} = temporary %.loc54_5.1, %H.call -// CHECK:STDOUT: %.loc54_7: ref i32 = struct_access %.loc54_5.2, element0 -// CHECK:STDOUT: %.loc54_3: i32* = addr_of [template = ] -// CHECK:STDOUT: %.loc59_9: bool = bool_literal true [template = constants.%.5] -// CHECK:STDOUT: %.loc59_5: bool = not %.loc59_9 [template = constants.%.17] -// CHECK:STDOUT: %.loc59_3: bool* = addr_of [template = ] +// CHECK:STDOUT: %.loc58_5.1: ref {.a: i32} = temporary_storage +// CHECK:STDOUT: %.loc58_5.2: ref {.a: i32} = temporary %.loc58_5.1, %H.call +// CHECK:STDOUT: %.loc58_7: ref i32 = struct_access %.loc58_5.2, element0 +// CHECK:STDOUT: %.loc58_3: i32* = addr_of [template = ] +// CHECK:STDOUT: %.loc63_9: bool = bool_literal true [template = constants.%.5] +// CHECK:STDOUT: %.loc63_5: bool = not %.loc63_9 [template = constants.%.17] +// CHECK:STDOUT: %.loc63_3: bool* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -240,47 +244,47 @@ fn AddressOfParam(param: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] // CHECK:STDOUT: %G.call: init i32 = call %G.ref() -// CHECK:STDOUT: %.loc67: i32* = addr_of [template = ] +// CHECK:STDOUT: %.loc71: i32* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfType() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc75: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc75: type* = addr_of [template = ] -// CHECK:STDOUT: %int.make_type_32.loc80: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc80_5.1: type = value_of_initializer %int.make_type_32.loc80 [template = i32] -// CHECK:STDOUT: %.loc80_5.2: type = converted %int.make_type_32.loc80, %.loc80_5.1 [template = i32] -// CHECK:STDOUT: %.loc80_5.3: type = const_type i32 [template = constants.%.19] -// CHECK:STDOUT: %.loc80_14: type = ptr_type const i32 [template = constants.%.20] -// CHECK:STDOUT: %.loc80_3: type* = addr_of [template = ] +// CHECK:STDOUT: %int.make_type_32.loc79: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc79: type* = addr_of [template = ] +// CHECK:STDOUT: %int.make_type_32.loc84: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc84_5.1: type = value_of_initializer %int.make_type_32.loc84 [template = i32] +// CHECK:STDOUT: %.loc84_5.2: type = converted %int.make_type_32.loc84, %.loc84_5.1 [template = i32] +// CHECK:STDOUT: %.loc84_5.3: type = const_type i32 [template = constants.%.19] +// CHECK:STDOUT: %.loc84_14: type = ptr_type const i32 [template = constants.%.20] +// CHECK:STDOUT: %.loc84_3: type* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfTupleElementValue() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc88_6: i32 = int_literal 1 [template = constants.%.11] -// CHECK:STDOUT: %.loc88_9: i32 = int_literal 2 [template = constants.%.12] -// CHECK:STDOUT: %.loc88_10.1: (i32, i32) = tuple_literal (%.loc88_6, %.loc88_9) -// CHECK:STDOUT: %.loc88_12: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc88_6, %.loc88_9) [template = constants.%tuple] -// CHECK:STDOUT: %.loc88_10.2: (i32, i32) = converted %.loc88_10.1, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %.loc88_13: i32 = tuple_index %.loc88_10.2, %.loc88_12 [template = constants.%.11] -// CHECK:STDOUT: %.loc88_3: i32* = addr_of [template = ] +// CHECK:STDOUT: %.loc92_6: i32 = int_literal 1 [template = constants.%.11] +// CHECK:STDOUT: %.loc92_9: i32 = int_literal 2 [template = constants.%.12] +// CHECK:STDOUT: %.loc92_10.1: (i32, i32) = tuple_literal (%.loc92_6, %.loc92_9) +// CHECK:STDOUT: %.loc92_12: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc92_6, %.loc92_9) [template = constants.%tuple] +// CHECK:STDOUT: %.loc92_10.2: (i32, i32) = converted %.loc92_10.1, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %.loc92_13: i32 = tuple_index %.loc92_10.2, %.loc92_12 [template = constants.%.11] +// CHECK:STDOUT: %.loc92_3: i32* = addr_of [template = ] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @AddressOfParam(%param: i32) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc95_22.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc95_22.2: type = converted %int.make_type_32, %.loc95_22.1 [template = i32] -// CHECK:STDOUT: %.loc95_22.3: type = ptr_type i32 [template = constants.%.4] +// CHECK:STDOUT: %.loc99_22.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc99_22.2: type = converted %int.make_type_32, %.loc99_22.1 [template = i32] +// CHECK:STDOUT: %.loc99_22.3: type = ptr_type i32 [template = constants.%.4] // CHECK:STDOUT: %param_addr.var: ref i32* = var param_addr // CHECK:STDOUT: %param_addr: ref i32* = bind_name param_addr, %param_addr.var // CHECK:STDOUT: %param.ref: i32 = name_ref param, %param -// CHECK:STDOUT: %.loc95_26: i32* = addr_of [template = ] -// CHECK:STDOUT: assign %param_addr.var, %.loc95_26 +// CHECK:STDOUT: %.loc99_26: i32* = addr_of [template = ] +// CHECK:STDOUT: assign %param_addr.var, %.loc99_26 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_error.carbon b/toolchain/check/testdata/pointer/fail_deref_error.carbon index 2d9577ee0a9a..b2e13951b0bf 100644 --- a/toolchain/check/testdata/pointer/fail_deref_error.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_error.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_deref_error.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_error.carbon // CHECK:STDERR: fail_deref_error.carbon:[[@LINE+4]]:15: ERROR: Name `undeclared` not found. // CHECK:STDERR: let n: i32 = *undeclared; @@ -28,18 +32,18 @@ let n2: i32 = undeclared->foo; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] -// CHECK:STDOUT: %undeclared.ref.loc11: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc11_14: ref = deref +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] +// CHECK:STDOUT: %undeclared.ref.loc15: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %.loc15_14: ref = deref // CHECK:STDOUT: %n: i32 = bind_name n, // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc15_9.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] -// CHECK:STDOUT: %.loc15_9.2: type = converted %int.make_type_32.loc15, %.loc15_9.1 [template = i32] -// CHECK:STDOUT: %undeclared.ref.loc15: = name_ref undeclared, [template = ] -// CHECK:STDOUT: %.loc15_25: ref = deref +// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc19_9.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] +// CHECK:STDOUT: %.loc19_9.2: type = converted %int.make_type_32.loc19, %.loc19_9.1 [template = i32] +// CHECK:STDOUT: %undeclared.ref.loc19: = name_ref undeclared, [template = ] +// CHECK:STDOUT: %.loc19_25: ref = deref // CHECK:STDOUT: %n2: i32 = bind_name n2, // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_function.carbon b/toolchain/check/testdata/pointer/fail_deref_function.carbon index 2c38a1861389..a027b3e6892e 100644 --- a/toolchain/check/testdata/pointer/fail_deref_function.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_deref_function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_function.carbon fn A() { // CHECK:STDERR: fail_deref_function.carbon:[[@LINE+4]]:4: ERROR: Expression cannot be used as a value. @@ -35,10 +39,10 @@ fn A() { // CHECK:STDOUT: // CHECK:STDOUT: fn @A() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc12: A = name_ref A, file.%A.decl [template = constants.%struct] -// CHECK:STDOUT: %.loc12: ref = deref // CHECK:STDOUT: %A.ref.loc16: A = name_ref A, file.%A.decl [template = constants.%struct] // CHECK:STDOUT: %.loc16: ref = deref +// CHECK:STDOUT: %A.ref.loc20: A = name_ref A, file.%A.decl [template = constants.%struct] +// CHECK:STDOUT: %.loc20: ref = deref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon index 8e506a77c081..8860f20f04ca 100644 --- a/toolchain/check/testdata/pointer/fail_deref_namespace.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_namespace.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_deref_namespace.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_namespace.carbon namespace A; @@ -39,10 +43,10 @@ fn F() { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %A.ref.loc14: = name_ref A, file.%A [template = file.%A] -// CHECK:STDOUT: %.loc14: ref = deref // CHECK:STDOUT: %A.ref.loc18: = name_ref A, file.%A [template = file.%A] // CHECK:STDOUT: %.loc18: ref = deref +// CHECK:STDOUT: %A.ref.loc22: = name_ref A, file.%A [template = file.%A] +// CHECK:STDOUT: %.loc22: ref = deref // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon index 41afdb2b680e..7341ef3d72aa 100644 --- a/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_not_pointer.carbon fn Deref(n: i32) { // CHECK:STDERR: fail_deref_not_pointer.carbon:[[@LINE+4]]:3: ERROR: Cannot dereference operand of non-pointer type `i32`. @@ -58,10 +62,10 @@ fn Deref(n: i32) { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Deref.decl: Deref = fn_decl @Deref [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32, %.loc7_13.1 [template = i32] -// CHECK:STDOUT: %n.loc7_10.1: i32 = param n -// CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc7_10.1 +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %n.loc11_10.1: i32 = param n +// CHECK:STDOUT: @Deref.%n: i32 = bind_name n, %n.loc11_10.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -69,26 +73,26 @@ fn Deref(n: i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Deref(%n: i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %n.ref.loc12: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc12: ref = deref %n.ref.loc12 -// CHECK:STDOUT: %n.ref.loc17: i32 = name_ref n, %n -// CHECK:STDOUT: %.loc17: ref = deref %n.ref.loc17 -// CHECK:STDOUT: %.loc22_5.1: () = tuple_literal () -// CHECK:STDOUT: %tuple.loc22: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc22_5.2: () = converted %.loc22_5.1, %tuple.loc22 [template = constants.%tuple] -// CHECK:STDOUT: %.loc22_3: ref = deref %.loc22_5.2 -// CHECK:STDOUT: %.loc27_4.1: () = tuple_literal () -// CHECK:STDOUT: %tuple.loc27: () = tuple_value () [template = constants.%tuple] -// CHECK:STDOUT: %.loc27_4.2: () = converted %.loc27_4.1, %tuple.loc27 [template = constants.%tuple] -// CHECK:STDOUT: %.loc27_5: ref = deref %.loc27_4.2 -// CHECK:STDOUT: %.loc32_5.1: {} = struct_literal () -// CHECK:STDOUT: %struct.loc32: {} = struct_value () [template = constants.%struct.3] -// CHECK:STDOUT: %.loc32_5.2: {} = converted %.loc32_5.1, %struct.loc32 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc32_3: ref = deref %.loc32_5.2 -// CHECK:STDOUT: %.loc36_4.1: {} = struct_literal () +// CHECK:STDOUT: %n.ref.loc16: i32 = name_ref n, %n +// CHECK:STDOUT: %.loc16: ref = deref %n.ref.loc16 +// CHECK:STDOUT: %n.ref.loc21: i32 = name_ref n, %n +// CHECK:STDOUT: %.loc21: ref = deref %n.ref.loc21 +// CHECK:STDOUT: %.loc26_5.1: () = tuple_literal () +// CHECK:STDOUT: %tuple.loc26: () = tuple_value () [template = constants.%tuple] +// CHECK:STDOUT: %.loc26_5.2: () = converted %.loc26_5.1, %tuple.loc26 [template = constants.%tuple] +// CHECK:STDOUT: %.loc26_3: ref = deref %.loc26_5.2 +// CHECK:STDOUT: %.loc31_4.1: () = tuple_literal () +// CHECK:STDOUT: %tuple.loc31: () = tuple_value () [template = constants.%tuple] +// CHECK:STDOUT: %.loc31_4.2: () = converted %.loc31_4.1, %tuple.loc31 [template = constants.%tuple] +// CHECK:STDOUT: %.loc31_5: ref = deref %.loc31_4.2 +// CHECK:STDOUT: %.loc36_5.1: {} = struct_literal () // CHECK:STDOUT: %struct.loc36: {} = struct_value () [template = constants.%struct.3] -// CHECK:STDOUT: %.loc36_4.2: {} = converted %.loc36_4.1, %struct.loc36 [template = constants.%struct.3] -// CHECK:STDOUT: %.loc36_5: ref = deref %.loc36_4.2 +// CHECK:STDOUT: %.loc36_5.2: {} = converted %.loc36_5.1, %struct.loc36 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc36_3: ref = deref %.loc36_5.2 +// CHECK:STDOUT: %.loc40_4.1: {} = struct_literal () +// CHECK:STDOUT: %struct.loc40: {} = struct_value () [template = constants.%struct.3] +// CHECK:STDOUT: %.loc40_4.2: {} = converted %.loc40_4.1, %struct.loc40 [template = constants.%struct.3] +// CHECK:STDOUT: %.loc40_5: ref = deref %.loc40_4.2 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/fail_deref_type.carbon b/toolchain/check/testdata/pointer/fail_deref_type.carbon index 71eee1ac7cdb..414bfda13571 100644 --- a/toolchain/check/testdata/pointer/fail_deref_type.carbon +++ b/toolchain/check/testdata/pointer/fail_deref_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_deref_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_deref_type.carbon // CHECK:STDERR: fail_deref_type.carbon:[[@LINE+7]]:8: ERROR: Cannot dereference operand of non-pointer type `type`. // CHECK:STDERR: var p: *i32; @@ -33,17 +37,17 @@ var p2: i32->foo; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc14_9.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] -// CHECK:STDOUT: %.loc14_9.2: type = converted %int.make_type_32.loc14, %.loc14_9.1 [template = i32] -// CHECK:STDOUT: %.loc14_8: ref = deref %.loc14_9.2 -// CHECK:STDOUT: %p.var: ref = var p -// CHECK:STDOUT: %p: ref = bind_name p, %p.var -// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc18: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %.loc18_9.1: type = value_of_initializer %int.make_type_32.loc18 [template = i32] // CHECK:STDOUT: %.loc18_9.2: type = converted %int.make_type_32.loc18, %.loc18_9.1 [template = i32] -// CHECK:STDOUT: %.loc18_12: ref = deref %.loc18_9.2 +// CHECK:STDOUT: %.loc18_8: ref = deref %.loc18_9.2 +// CHECK:STDOUT: %p.var: ref = var p +// CHECK:STDOUT: %p: ref = bind_name p, %p.var +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc22_9.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] +// CHECK:STDOUT: %.loc22_9.2: type = converted %int.make_type_32.loc22, %.loc22_9.1 [template = i32] +// CHECK:STDOUT: %.loc22_12: ref = deref %.loc22_9.2 // CHECK:STDOUT: %p2.var: ref = var p2 // CHECK:STDOUT: %p2: ref = bind_name p2, %p2.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon index 7f7acc5c1d3c..1a6fe94e58b2 100644 --- a/toolchain/check/testdata/pointer/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/pointer/fail_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/fail_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/fail_type_mismatch.carbon fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `const {}*` to `const ({}*)`. @@ -31,16 +35,16 @@ fn ConstMismatch(p: const {}*) -> const ({}*) { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %ConstMismatch.decl: ConstMismatch = fn_decl @ConstMismatch [template = constants.%struct] { -// CHECK:STDOUT: %.loc7_28: {} = struct_literal () -// CHECK:STDOUT: %.loc7_21.1: type = converted %.loc7_28, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_21.2: type = const_type {} [template = constants.%.2] -// CHECK:STDOUT: %.loc7_29: type = ptr_type const {} [template = constants.%.3] -// CHECK:STDOUT: %p.loc7_18.1: const {}* = param p -// CHECK:STDOUT: @ConstMismatch.%p: const {}* = bind_name p, %p.loc7_18.1 -// CHECK:STDOUT: %.loc7_43: {} = struct_literal () -// CHECK:STDOUT: %.loc7_44.1: type = converted %.loc7_43, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_44.2: type = ptr_type {} [template = constants.%.4] -// CHECK:STDOUT: %.loc7_35: type = const_type {}* [template = constants.%.5] +// CHECK:STDOUT: %.loc11_28: {} = struct_literal () +// CHECK:STDOUT: %.loc11_21.1: type = converted %.loc11_28, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_21.2: type = const_type {} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_29: type = ptr_type const {} [template = constants.%.3] +// CHECK:STDOUT: %p.loc11_18.1: const {}* = param p +// CHECK:STDOUT: @ConstMismatch.%p: const {}* = bind_name p, %p.loc11_18.1 +// CHECK:STDOUT: %.loc11_43: {} = struct_literal () +// CHECK:STDOUT: %.loc11_44.1: type = converted %.loc11_43, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_44.2: type = ptr_type {} [template = constants.%.4] +// CHECK:STDOUT: %.loc11_35: type = const_type {}* [template = constants.%.5] // CHECK:STDOUT: @ConstMismatch.%return: ref const ({}*) = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/pointer/import.carbon b/toolchain/check/testdata/pointer/import.carbon index bf440b95f9fe..894a3cefb356 100644 --- a/toolchain/check/testdata/pointer/import.carbon +++ b/toolchain/check/testdata/pointer/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/pointer/nested_const.carbon b/toolchain/check/testdata/pointer/nested_const.carbon index 8714aecdd593..a1a086f98dac 100644 --- a/toolchain/check/testdata/pointer/nested_const.carbon +++ b/toolchain/check/testdata/pointer/nested_const.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/nested_const.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/nested_const.carbon // TODO: The `const` in the return type should not be necessary. fn F(p: const (const (const i32*)*)) -> const i32 { @@ -33,20 +37,20 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8_29: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_23.1: type = value_of_initializer %int.make_type_32.loc8_29 [template = i32] -// CHECK:STDOUT: %.loc8_23.2: type = converted %int.make_type_32.loc8_29, %.loc8_23.1 [template = i32] -// CHECK:STDOUT: %.loc8_23.3: type = const_type i32 [template = constants.%.2] -// CHECK:STDOUT: %.loc8_32: type = ptr_type const i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_16: type = const_type const i32* [template = constants.%.4] -// CHECK:STDOUT: %.loc8_34: type = ptr_type const (const i32*) [template = constants.%.5] -// CHECK:STDOUT: %.loc8_9: type = const_type const (const i32*)* [template = constants.%.6] -// CHECK:STDOUT: %p.loc8_6.1: const (const (const i32*)*) = param p -// CHECK:STDOUT: @F.%p: const (const (const i32*)*) = bind_name p, %p.loc8_6.1 -// CHECK:STDOUT: %int.make_type_32.loc8_47: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_41.1: type = value_of_initializer %int.make_type_32.loc8_47 [template = i32] -// CHECK:STDOUT: %.loc8_41.2: type = converted %int.make_type_32.loc8_47, %.loc8_41.1 [template = i32] -// CHECK:STDOUT: %.loc8_41.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc12_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_23.1: type = value_of_initializer %int.make_type_32.loc12_29 [template = i32] +// CHECK:STDOUT: %.loc12_23.2: type = converted %int.make_type_32.loc12_29, %.loc12_23.1 [template = i32] +// CHECK:STDOUT: %.loc12_23.3: type = const_type i32 [template = constants.%.2] +// CHECK:STDOUT: %.loc12_32: type = ptr_type const i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_16: type = const_type const i32* [template = constants.%.4] +// CHECK:STDOUT: %.loc12_34: type = ptr_type const (const i32*) [template = constants.%.5] +// CHECK:STDOUT: %.loc12_9: type = const_type const (const i32*)* [template = constants.%.6] +// CHECK:STDOUT: %p.loc12_6.1: const (const (const i32*)*) = param p +// CHECK:STDOUT: @F.%p: const (const (const i32*)*) = bind_name p, %p.loc12_6.1 +// CHECK:STDOUT: %int.make_type_32.loc12_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_41.1: type = value_of_initializer %int.make_type_32.loc12_47 [template = i32] +// CHECK:STDOUT: %.loc12_41.2: type = converted %int.make_type_32.loc12_47, %.loc12_41.1 [template = i32] +// CHECK:STDOUT: %.loc12_41.3: type = const_type i32 [template = constants.%.2] // CHECK:STDOUT: @F.%return: ref const i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -56,10 +60,10 @@ fn F(p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: fn @F(%p: const (const (const i32*)*)) -> const i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %p.ref: const (const (const i32*)*) = name_ref p, %p -// CHECK:STDOUT: %.loc9_11.1: ref const (const i32*) = deref %p.ref -// CHECK:STDOUT: %.loc9_11.2: const (const i32*) = bind_value %.loc9_11.1 -// CHECK:STDOUT: %.loc9_10.1: ref const i32 = deref %.loc9_11.2 -// CHECK:STDOUT: %.loc9_10.2: const i32 = bind_value %.loc9_10.1 -// CHECK:STDOUT: return %.loc9_10.2 +// CHECK:STDOUT: %.loc13_11.1: ref const (const i32*) = deref %p.ref +// CHECK:STDOUT: %.loc13_11.2: const (const i32*) = bind_value %.loc13_11.1 +// CHECK:STDOUT: %.loc13_10.1: ref const i32 = deref %.loc13_11.2 +// CHECK:STDOUT: %.loc13_10.2: const i32 = bind_value %.loc13_10.1 +// CHECK:STDOUT: return %.loc13_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/pointer/types.carbon b/toolchain/check/testdata/pointer/types.carbon index 5d71653dc076..2a7825b5c04f 100644 --- a/toolchain/check/testdata/pointer/types.carbon +++ b/toolchain/check/testdata/pointer/types.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/pointer/types.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/pointer/types.carbon fn Ptr(p: i32*) -> i32* { return p; @@ -37,33 +41,33 @@ fn ConstPtr(p: const i32*) -> (const i32)* { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Ptr.decl: Ptr = fn_decl @Ptr [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32.loc7_11 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32.loc7_11, %.loc7_14.1 [template = i32] -// CHECK:STDOUT: %.loc7_14.3: type = ptr_type i32 [template = constants.%.2] -// CHECK:STDOUT: %p.loc7_8.1: i32* = param p -// CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc7_8.1 -// CHECK:STDOUT: %int.make_type_32.loc7_20: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_23.1: type = value_of_initializer %int.make_type_32.loc7_20 [template = i32] -// CHECK:STDOUT: %.loc7_23.2: type = converted %int.make_type_32.loc7_20, %.loc7_23.1 [template = i32] -// CHECK:STDOUT: %.loc7_23.3: type = ptr_type i32 [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32.loc11_11, %.loc11_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.3: type = ptr_type i32 [template = constants.%.2] +// CHECK:STDOUT: %p.loc11_8.1: i32* = param p +// CHECK:STDOUT: @Ptr.%p: i32* = bind_name p, %p.loc11_8.1 +// CHECK:STDOUT: %int.make_type_32.loc11_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_23.1: type = value_of_initializer %int.make_type_32.loc11_20 [template = i32] +// CHECK:STDOUT: %.loc11_23.2: type = converted %int.make_type_32.loc11_20, %.loc11_23.1 [template = i32] +// CHECK:STDOUT: %.loc11_23.3: type = ptr_type i32 [template = constants.%.2] // CHECK:STDOUT: @Ptr.%return: ref i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %ConstPtr.decl: ConstPtr = fn_decl @ConstPtr [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] -// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11_22, %.loc11_16.1 [template = i32] -// CHECK:STDOUT: %.loc11_16.3: type = const_type i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_25: type = ptr_type const i32 [template = constants.%.4] -// CHECK:STDOUT: %p.loc11_13.1: const i32* = param p -// CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc11_13.1 -// CHECK:STDOUT: %int.make_type_32.loc11_38: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_32.1: type = value_of_initializer %int.make_type_32.loc11_38 [template = i32] -// CHECK:STDOUT: %.loc11_32.2: type = converted %int.make_type_32.loc11_38, %.loc11_32.1 [template = i32] -// CHECK:STDOUT: %.loc11_32.3: type = const_type i32 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_42: type = ptr_type const i32 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc15_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_16.1: type = value_of_initializer %int.make_type_32.loc15_22 [template = i32] +// CHECK:STDOUT: %.loc15_16.2: type = converted %int.make_type_32.loc15_22, %.loc15_16.1 [template = i32] +// CHECK:STDOUT: %.loc15_16.3: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_25: type = ptr_type const i32 [template = constants.%.4] +// CHECK:STDOUT: %p.loc15_13.1: const i32* = param p +// CHECK:STDOUT: @ConstPtr.%p: const i32* = bind_name p, %p.loc15_13.1 +// CHECK:STDOUT: %int.make_type_32.loc15_38: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_32.1: type = value_of_initializer %int.make_type_32.loc15_38 [template = i32] +// CHECK:STDOUT: %.loc15_32.2: type = converted %int.make_type_32.loc15_38, %.loc15_32.1 [template = i32] +// CHECK:STDOUT: %.loc15_32.3: type = const_type i32 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_42: type = ptr_type const i32 [template = constants.%.4] // CHECK:STDOUT: @ConstPtr.%return: ref const i32* = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/code_after_return.carbon b/toolchain/check/testdata/return/code_after_return.carbon index 47b4fb674f57..53c17afdc360 100644 --- a/toolchain/check/testdata/return/code_after_return.carbon +++ b/toolchain/check/testdata/return/code_after_return.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/code_after_return.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/code_after_return.carbon fn Main() { return; diff --git a/toolchain/check/testdata/return/code_after_return_value.carbon b/toolchain/check/testdata/return/code_after_return_value.carbon index 67e64b63ce94..47b9d99e08b9 100644 --- a/toolchain/check/testdata/return/code_after_return_value.carbon +++ b/toolchain/check/testdata/return/code_after_return_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/code_after_return_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/code_after_return_value.carbon fn F(b: bool) -> i32 { return 0; @@ -43,13 +47,13 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_9.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_9.2: type = converted %bool.make_type, %.loc7_9.1 [template = bool] -// CHECK:STDOUT: %b.loc7_6.1: bool = param b -// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc7_6.1 +// CHECK:STDOUT: %.loc11_9.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_9.2: type = converted %bool.make_type, %.loc11_9.1 [template = bool] +// CHECK:STDOUT: %b.loc11_6.1: bool = param b +// CHECK:STDOUT: @F.%b: bool = bind_name b, %b.loc11_6.1 // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32, %.loc7_18.1 [template = i32] +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32, %.loc11_18.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] @@ -61,7 +65,7 @@ fn F(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F(%b: bool) -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_call_in_type.carbon b/toolchain/check/testdata/return/fail_call_in_type.carbon index 74a69b3a2ccb..854d1305f987 100644 --- a/toolchain/check/testdata/return/fail_call_in_type.carbon +++ b/toolchain/check/testdata/return/fail_call_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_call_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_call_in_type.carbon // TODO: Some variant of this should work, once compile-time function calls are // supported. @@ -39,8 +43,8 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.3] { // CHECK:STDOUT: %ReturnType.ref: ReturnType = name_ref ReturnType, %ReturnType.decl [template = constants.%struct.1] // CHECK:STDOUT: %ReturnType.call: init type = call %ReturnType.ref() -// CHECK:STDOUT: %.loc13_24.1: type = value_of_initializer %ReturnType.call -// CHECK:STDOUT: %.loc13_24.2: type = converted %ReturnType.call, %.loc13_24.1 +// CHECK:STDOUT: %.loc17_24.1: type = value_of_initializer %ReturnType.call +// CHECK:STDOUT: %.loc17_24.2: type = converted %ReturnType.call, %.loc17_24.1 // CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -48,16 +52,16 @@ fn Six() -> ReturnType() { return 6; } // CHECK:STDOUT: fn @ReturnType() -> type { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_37.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc9_37.2: type = converted %int.make_type_32, %.loc9_37.1 [template = i32] -// CHECK:STDOUT: return %.loc9_37.2 +// CHECK:STDOUT: %.loc13_37.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc13_37.2: type = converted %int.make_type_32, %.loc13_37.1 [template = i32] +// CHECK:STDOUT: return %.loc13_37.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc13: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc17: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_error_in_type.carbon b/toolchain/check/testdata/return/fail_error_in_type.carbon index fbd2bfa3ec71..8df3ccb6b7da 100644 --- a/toolchain/check/testdata/return/fail_error_in_type.carbon +++ b/toolchain/check/testdata/return/fail_error_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_error_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_error_in_type.carbon // CHECK:STDERR: fail_error_in_type.carbon:[[@LINE+3]]:13: ERROR: Name `x` not found. // CHECK:STDERR: fn Six() -> x; diff --git a/toolchain/check/testdata/return/fail_let_in_type.carbon b/toolchain/check/testdata/return/fail_let_in_type.carbon index 85a096b902bc..806222502311 100644 --- a/toolchain/check/testdata/return/fail_let_in_type.carbon +++ b/toolchain/check/testdata/return/fail_let_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_let_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_let_in_type.carbon let x: type = i32; // CHECK:STDERR: fail_let_in_type.carbon:[[@LINE+4]]:13: ERROR: Cannot evaluate type expression. @@ -46,13 +50,13 @@ fn FirstPerfectNumber() -> z { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc12: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc16: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @HalfDozen() -> y { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc20: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc24: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_missing_return.carbon b/toolchain/check/testdata/return/fail_missing_return.carbon index cd9e13a3c46f..a179205c7327 100644 --- a/toolchain/check/testdata/return/fail_missing_return.carbon +++ b/toolchain/check/testdata/return/fail_missing_return.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_missing_return.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return.carbon fn Main() -> i32 { // CHECK:STDERR: fail_missing_return.carbon:[[@LINE+3]]:1: ERROR: Missing `return` at end of function with declared return type. @@ -29,8 +33,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon index d20825989267..97a63bc88a6f 100644 --- a/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +++ b/toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_missing_return_empty_tuple.carbon fn F() -> () { // CHECK:STDERR: fail_missing_return_empty_tuple.carbon:[[@LINE+3]]:1: ERROR: Missing `return` at end of function with declared return type. @@ -25,8 +29,8 @@ fn F() -> () { // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { -// CHECK:STDOUT: %.loc7_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_12.2: type = converted %.loc7_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: @F.%return: ref () = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon index 6af8637d9f38..2a9b5c2da83c 100644 --- a/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_return_var_no_returned_var.carbon fn Procedure() -> i32 { // CHECK:STDERR: fail_return_var_no_returned_var.carbon:[[@LINE+3]]:3: ERROR: `return var;` with no `returned var` in scope. @@ -30,8 +34,8 @@ fn Procedure() -> i32 { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Procedure.decl: Procedure = fn_decl @Procedure [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32, %.loc11_19.1 [template = i32] // CHECK:STDOUT: @Procedure.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon index 2032cf936aad..01301ad031ea 100644 --- a/toolchain/check/testdata/return/fail_return_with_returned_var.carbon +++ b/toolchain/check/testdata/return/fail_return_with_returned_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_return_with_returned_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_return_with_returned_var.carbon fn F() -> i32 { returned var v: i32 = 0; @@ -59,8 +63,8 @@ fn G() -> C { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_11.2: type = converted %int.make_type_32, %.loc7_11.1 [template = i32] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -74,19 +78,19 @@ fn G() -> C { // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %int.make_type_32.loc19_18: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_18.1: type = value_of_initializer %int.make_type_32.loc19_18 [template = i32] -// CHECK:STDOUT: %.loc19_18.2: type = converted %int.make_type_32.loc19_18, %.loc19_18.1 [template = i32] -// CHECK:STDOUT: %.loc19_16: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc19_30: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_30.1: type = value_of_initializer %int.make_type_32.loc19_30 [template = i32] -// CHECK:STDOUT: %.loc19_30.2: type = converted %int.make_type_32.loc19_30, %.loc19_30.1 [template = i32] -// CHECK:STDOUT: %.loc19_28: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc23_18: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_18.1: type = value_of_initializer %int.make_type_32.loc23_18 [template = i32] +// CHECK:STDOUT: %.loc23_18.2: type = converted %int.make_type_32.loc23_18, %.loc23_18.1 [template = i32] +// CHECK:STDOUT: %.loc23_16: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc23_30: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_30.1: type = value_of_initializer %int.make_type_32.loc23_30 [template = i32] +// CHECK:STDOUT: %.loc23_30.2: type = converted %int.make_type_32.loc23_30, %.loc23_30.1 [template = i32] +// CHECK:STDOUT: %.loc23_28: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc19_16 -// CHECK:STDOUT: .b = %.loc19_28 +// CHECK:STDOUT: .a = %.loc23_16 +// CHECK:STDOUT: .b = %.loc23_28 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -94,13 +98,13 @@ fn G() -> C { // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc8_19.2: type = converted %int.make_type_32, %.loc8_19.1 [template = i32] +// CHECK:STDOUT: %.loc12_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc12_19.2: type = converted %int.make_type_32, %.loc12_19.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc8_25: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: assign %v.var, %.loc8_25 -// CHECK:STDOUT: %.loc16: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_25: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: assign %v.var, %.loc12_25 +// CHECK:STDOUT: %.loc20: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: @@ -108,16 +112,16 @@ fn G() -> C { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %c: ref C = bind_name c, %return -// CHECK:STDOUT: %.loc21_29: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc21_37: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_38.1: {.a: i32, .b: i32} = struct_literal (%.loc21_29, %.loc21_37) -// CHECK:STDOUT: %.loc21_38.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc21_38.3: init i32 = initialize_from %.loc21_29 to %.loc21_38.2 [template = constants.%.3] -// CHECK:STDOUT: %.loc21_38.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc21_38.5: init i32 = initialize_from %.loc21_37 to %.loc21_38.4 [template = constants.%.7] -// CHECK:STDOUT: %.loc21_38.6: init C = class_init (%.loc21_38.3, %.loc21_38.5), %return [template = constants.%struct.4] -// CHECK:STDOUT: %.loc21_39: init C = converted %.loc21_38.1, %.loc21_38.6 [template = constants.%struct.4] -// CHECK:STDOUT: assign %return, %.loc21_39 +// CHECK:STDOUT: %.loc25_29: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_37: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_38.1: {.a: i32, .b: i32} = struct_literal (%.loc25_29, %.loc25_37) +// CHECK:STDOUT: %.loc25_38.2: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc25_38.3: init i32 = initialize_from %.loc25_29 to %.loc25_38.2 [template = constants.%.3] +// CHECK:STDOUT: %.loc25_38.4: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc25_38.5: init i32 = initialize_from %.loc25_37 to %.loc25_38.4 [template = constants.%.7] +// CHECK:STDOUT: %.loc25_38.6: init C = class_init (%.loc25_38.3, %.loc25_38.5), %return [template = constants.%struct.4] +// CHECK:STDOUT: %.loc25_39: init C = converted %.loc25_38.1, %.loc25_38.6 [template = constants.%struct.4] +// CHECK:STDOUT: assign %return, %.loc25_39 // CHECK:STDOUT: %c.ref: ref C = name_ref c, %c // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon index bb61a31be04c..90225cb7d768 100644 --- a/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_no_return_type.carbon fn Procedure() { // CHECK:STDERR: fail_returned_var_no_return_type.carbon:[[@LINE+6]]:3: ERROR: Cannot declare a `returned var` in this function. @@ -34,10 +38,10 @@ fn Procedure() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Procedure() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_20.1: () = tuple_literal () -// CHECK:STDOUT: %.loc14_20.2: type = converted %.loc14_20.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_20.1: () = tuple_literal () +// CHECK:STDOUT: %.loc18_20.2: type = converted %.loc18_20.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %v: () = bind_name v, -// CHECK:STDOUT: %.loc14_25: () = tuple_literal () +// CHECK:STDOUT: %.loc18_25: () = tuple_literal () // CHECK:STDOUT: assign , // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon index 47925a48b5c5..aab4804065a6 100644 --- a/toolchain/check/testdata/return/fail_returned_var_shadow.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_shadow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_returned_var_shadow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_shadow.carbon fn SameScope() -> i32 { if (true) { @@ -59,18 +63,18 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %SameScope.decl: SameScope = fn_decl @SameScope [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32.loc7, %.loc7_19.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11, %.loc11_19.1 [template = i32] // CHECK:STDOUT: @SameScope.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %DifferentScopes.decl: DifferentScopes = fn_decl @DifferentScopes [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc22_25.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] -// CHECK:STDOUT: %.loc22_25.2: type = converted %int.make_type_32.loc22, %.loc22_25.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_25.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_25.2: type = converted %int.make_type_32.loc26, %.loc26_25.1 [template = i32] // CHECK:STDOUT: @DifferentScopes.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -81,62 +85,62 @@ fn DifferentScopes() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @SameScope() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc8 br !if.then else br !if.else +// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc12 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32.loc9, %.loc9_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_21.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9_27: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc9_27 -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_21.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_21.2: type = converted %int.make_type_32.loc17, %.loc17_21.1 [template = i32] +// CHECK:STDOUT: %.loc13_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc13_27 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_21.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_21.2: type = converted %int.make_type_32.loc21, %.loc21_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc17_27: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc17_27 +// CHECK:STDOUT: %.loc21_27: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc21_27 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %.loc19: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: return %.loc19 +// CHECK:STDOUT: %.loc23: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: return %.loc23 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @DifferentScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc23: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc23 br !if.then.loc23 else br !if.else.loc23 +// CHECK:STDOUT: %.loc27: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc27 br !if.then.loc27 else br !if.else.loc27 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc23: -// CHECK:STDOUT: %int.make_type_32.loc24: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc24_21.1: type = value_of_initializer %int.make_type_32.loc24 [template = i32] -// CHECK:STDOUT: %.loc24_21.2: type = converted %int.make_type_32.loc24, %.loc24_21.1 [template = i32] +// CHECK:STDOUT: !if.then.loc27: +// CHECK:STDOUT: %int.make_type_32.loc28: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc28_21.1: type = value_of_initializer %int.make_type_32.loc28 [template = i32] +// CHECK:STDOUT: %.loc28_21.2: type = converted %int.make_type_32.loc28, %.loc28_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc24_27: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc24_27 -// CHECK:STDOUT: %.loc25: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc25 br !if.then.loc25 else br !if.else.loc25 +// CHECK:STDOUT: %.loc28_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc28_27 +// CHECK:STDOUT: %.loc29: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc29 br !if.then.loc29 else br !if.else.loc29 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc25: -// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc32_23.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] -// CHECK:STDOUT: %.loc32_23.2: type = converted %int.make_type_32.loc32, %.loc32_23.1 [template = i32] +// CHECK:STDOUT: !if.then.loc29: +// CHECK:STDOUT: %int.make_type_32.loc36: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc36_23.1: type = value_of_initializer %int.make_type_32.loc36 [template = i32] +// CHECK:STDOUT: %.loc36_23.2: type = converted %int.make_type_32.loc36, %.loc36_23.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc32_29: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc32_29 -// CHECK:STDOUT: br !if.else.loc25 +// CHECK:STDOUT: %.loc36_29: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc36_29 +// CHECK:STDOUT: br !if.else.loc29 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc25: -// CHECK:STDOUT: br !if.else.loc23 +// CHECK:STDOUT: !if.else.loc29: +// CHECK:STDOUT: br !if.else.loc27 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc23: -// CHECK:STDOUT: %.loc35: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: return %.loc35 +// CHECK:STDOUT: !if.else.loc27: +// CHECK:STDOUT: %.loc39: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: return %.loc39 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_returned_var_type.carbon b/toolchain/check/testdata/return/fail_returned_var_type.carbon index 712fd6c00c88..8a183a8104af 100644 --- a/toolchain/check/testdata/return/fail_returned_var_type.carbon +++ b/toolchain/check/testdata/return/fail_returned_var_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_returned_var_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_returned_var_type.carbon fn Mismatch() -> i32 { // CHECK:STDERR: fail_returned_var_type.carbon:[[@LINE+6]]:19: ERROR: Type `f64` of `returned var` does not match return type of enclosing function. @@ -38,8 +42,8 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Mismatch.decl: Mismatch = fn_decl @Mismatch [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_18.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_18.2: type = converted %int.make_type_32, %.loc7_18.1 [template = i32] +// CHECK:STDOUT: %.loc11_18.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_18.2: type = converted %int.make_type_32, %.loc11_18.1 [template = i32] // CHECK:STDOUT: @Mismatch.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] @@ -49,12 +53,12 @@ fn Mismatch() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Mismatch() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14_19.1: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc14_19.1) [template = f64] -// CHECK:STDOUT: %.loc14_19.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc14_19.3: type = converted %float.make_type, %.loc14_19.2 [template = f64] +// CHECK:STDOUT: %.loc18_19.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.3(%.loc18_19.1) [template = f64] +// CHECK:STDOUT: %.loc18_19.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc18_19.3: type = converted %float.make_type, %.loc18_19.2 [template = f64] // CHECK:STDOUT: %v: f64 = bind_name v, -// CHECK:STDOUT: %.loc14_25: f64 = float_literal 0 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_25: f64 = float_literal 0 [template = constants.%.3] // CHECK:STDOUT: assign , // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_type_mismatch.carbon b/toolchain/check/testdata/return/fail_type_mismatch.carbon index cc5df8596f55..494d0992265f 100644 --- a/toolchain/check/testdata/return/fail_type_mismatch.carbon +++ b/toolchain/check/testdata/return/fail_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_type_mismatch.carbon fn Main() -> i32 { // CHECK:STDERR: fail_type_mismatch.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `f64` to `i32`. @@ -31,8 +35,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -41,7 +45,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: f64 = float_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15: f64 = float_literal 1 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_disallowed.carbon b/toolchain/check/testdata/return/fail_value_disallowed.carbon index 1c6665803f9a..634b880276bf 100644 --- a/toolchain/check/testdata/return/fail_value_disallowed.carbon +++ b/toolchain/check/testdata/return/fail_value_disallowed.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_value_disallowed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_disallowed.carbon fn Main() { // CHECK:STDERR: fail_value_disallowed.carbon:[[@LINE+6]]:3: ERROR: No return expression should be provided in this context. @@ -34,7 +38,7 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/fail_value_missing.carbon b/toolchain/check/testdata/return/fail_value_missing.carbon index 66a509a6229d..8f7376d293db 100644 --- a/toolchain/check/testdata/return/fail_value_missing.carbon +++ b/toolchain/check/testdata/return/fail_value_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_value_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_value_missing.carbon fn Main() -> i32 { // CHECK:STDERR: fail_value_missing.carbon:[[@LINE+6]]:3: ERROR: Missing return value. @@ -33,8 +37,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/return/fail_var_in_type.carbon b/toolchain/check/testdata/return/fail_var_in_type.carbon index 497cfac85b24..483abe966b31 100644 --- a/toolchain/check/testdata/return/fail_var_in_type.carbon +++ b/toolchain/check/testdata/return/fail_var_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/fail_var_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/fail_var_in_type.carbon var x: type = i32; // CHECK:STDERR: fail_var_in_type.carbon:[[@LINE+3]]:13: ERROR: Cannot evaluate type expression. @@ -33,7 +37,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Six.decl: Six = fn_decl @Six [template = constants.%struct.2] { // CHECK:STDOUT: %x.ref: ref type = name_ref x, %x -// CHECK:STDOUT: %.loc11: type = bind_value %x.ref +// CHECK:STDOUT: %.loc15: type = bind_value %x.ref // CHECK:STDOUT: @Six.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -42,7 +46,7 @@ fn Six() -> x { return 6; } // CHECK:STDOUT: // CHECK:STDOUT: fn @Six() -> { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11: i32 = int_literal 6 [template = constants.%.2] +// CHECK:STDOUT: %.loc15: i32 = int_literal 6 [template = constants.%.2] // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/missing_return_no_return_type.carbon b/toolchain/check/testdata/return/missing_return_no_return_type.carbon index ac851835cf5c..7a6422f363a9 100644 --- a/toolchain/check/testdata/return/missing_return_no_return_type.carbon +++ b/toolchain/check/testdata/return/missing_return_no_return_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/missing_return_no_return_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/missing_return_no_return_type.carbon fn F() { } diff --git a/toolchain/check/testdata/return/no_value.carbon b/toolchain/check/testdata/return/no_value.carbon index 68aba0880988..e6a3f95eec6c 100644 --- a/toolchain/check/testdata/return/no_value.carbon +++ b/toolchain/check/testdata/return/no_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/no_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/no_value.carbon fn Main() { return; diff --git a/toolchain/check/testdata/return/returned_var.carbon b/toolchain/check/testdata/return/returned_var.carbon index 77467349f06e..0767bb2cef8a 100644 --- a/toolchain/check/testdata/return/returned_var.carbon +++ b/toolchain/check/testdata/return/returned_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/returned_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/returned_var.carbon class C { var a: i32; @@ -57,27 +61,27 @@ fn G() -> i32 { // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.4] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc17_11.2: type = converted %int.make_type_32, %.loc17_11.1 [template = i32] +// CHECK:STDOUT: %.loc21_11.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc21_11.2: type = converted %int.make_type_32, %.loc21_11.1 [template = i32] // CHECK:STDOUT: @G.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: class @C { -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_10.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_10.2: type = converted %int.make_type_32.loc8, %.loc8_10.1 [template = i32] -// CHECK:STDOUT: %.loc8_8: = field_decl a, element0 [template] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_10.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_10.2: type = converted %int.make_type_32.loc9, %.loc9_10.1 [template = i32] -// CHECK:STDOUT: %.loc9_8: = field_decl b, element1 [template] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_10.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32] +// CHECK:STDOUT: %.loc12_8: = field_decl a, element0 [template] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_10.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_10.2: type = converted %int.make_type_32.loc13, %.loc13_10.1 [template = i32] +// CHECK:STDOUT: %.loc13_8: = field_decl b, element1 [template] // CHECK:STDOUT: // CHECK:STDOUT: !members: // CHECK:STDOUT: .Self = constants.%C -// CHECK:STDOUT: .a = %.loc8_8 -// CHECK:STDOUT: .b = %.loc9_8 +// CHECK:STDOUT: .a = %.loc12_8 +// CHECK:STDOUT: .b = %.loc13_8 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32"; @@ -86,29 +90,29 @@ fn G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C] // CHECK:STDOUT: %result: ref C = bind_name result, %return -// CHECK:STDOUT: %.loc13_34: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_42: i32 = int_literal 2 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_43.1: {.a: i32, .b: i32} = struct_literal (%.loc13_34, %.loc13_42) -// CHECK:STDOUT: %.loc13_43.2: ref i32 = class_element_access %return, element0 -// CHECK:STDOUT: %.loc13_43.3: init i32 = initialize_from %.loc13_34 to %.loc13_43.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc13_43.4: ref i32 = class_element_access %return, element1 -// CHECK:STDOUT: %.loc13_43.5: init i32 = initialize_from %.loc13_42 to %.loc13_43.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc13_43.6: init C = class_init (%.loc13_43.3, %.loc13_43.5), %return [template = constants.%struct.3] -// CHECK:STDOUT: %.loc13_44: init C = converted %.loc13_43.1, %.loc13_43.6 [template = constants.%struct.3] -// CHECK:STDOUT: assign %return, %.loc13_44 +// CHECK:STDOUT: %.loc17_34: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_42: i32 = int_literal 2 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_43.1: {.a: i32, .b: i32} = struct_literal (%.loc17_34, %.loc17_42) +// CHECK:STDOUT: %.loc17_43.2: ref i32 = class_element_access %return, element0 +// CHECK:STDOUT: %.loc17_43.3: init i32 = initialize_from %.loc17_34 to %.loc17_43.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc17_43.4: ref i32 = class_element_access %return, element1 +// CHECK:STDOUT: %.loc17_43.5: init i32 = initialize_from %.loc17_42 to %.loc17_43.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc17_43.6: init C = class_init (%.loc17_43.3, %.loc17_43.5), %return [template = constants.%struct.3] +// CHECK:STDOUT: %.loc17_44: init C = converted %.loc17_43.1, %.loc17_43.6 [template = constants.%struct.3] +// CHECK:STDOUT: assign %return, %.loc17_44 // CHECK:STDOUT: return %result to %return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @G() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc18_24.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc18_24.2: type = converted %int.make_type_32, %.loc18_24.1 [template = i32] +// CHECK:STDOUT: %.loc22_24.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc22_24.2: type = converted %int.make_type_32, %.loc22_24.1 [template = i32] // CHECK:STDOUT: %result.var: ref i32 = var result // CHECK:STDOUT: %result: ref i32 = bind_name result, %result.var -// CHECK:STDOUT: %.loc18_30: i32 = int_literal 0 [template = constants.%.7] -// CHECK:STDOUT: assign %result.var, %.loc18_30 -// CHECK:STDOUT: %.loc18_16: i32 = bind_value %result -// CHECK:STDOUT: return %.loc18_16 +// CHECK:STDOUT: %.loc22_30: i32 = int_literal 0 [template = constants.%.7] +// CHECK:STDOUT: assign %result.var, %.loc22_30 +// CHECK:STDOUT: %.loc22_16: i32 = bind_value %result +// CHECK:STDOUT: return %.loc22_16 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/returned_var_scope.carbon b/toolchain/check/testdata/return/returned_var_scope.carbon index 17d81a007c49..7d41b342045a 100644 --- a/toolchain/check/testdata/return/returned_var_scope.carbon +++ b/toolchain/check/testdata/return/returned_var_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/returned_var_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/returned_var_scope.carbon fn UnrelatedScopes() -> i32 { if (true) { @@ -49,9 +53,9 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %UnrelatedScopes.decl: UnrelatedScopes = fn_decl @UnrelatedScopes [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7, %.loc7_25.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_25.2: type = converted %int.make_type_32.loc11, %.loc11_25.1 [template = i32] // CHECK:STDOUT: @UnrelatedScopes.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -60,13 +64,13 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %EnclosingButAfter.decl: EnclosingButAfter = fn_decl @EnclosingButAfter [template = constants.%struct.4] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.3() [template = bool] -// CHECK:STDOUT: %.loc17_25.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc17_25.2: type = converted %bool.make_type, %.loc17_25.1 [template = bool] -// CHECK:STDOUT: %b.loc17_22.1: bool = param b -// CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc17_22.1 -// CHECK:STDOUT: %int.make_type_32.loc17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc17_34.1: type = value_of_initializer %int.make_type_32.loc17 [template = i32] -// CHECK:STDOUT: %.loc17_34.2: type = converted %int.make_type_32.loc17, %.loc17_34.1 [template = i32] +// CHECK:STDOUT: %.loc21_25.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc21_25.2: type = converted %bool.make_type, %.loc21_25.1 [template = bool] +// CHECK:STDOUT: %b.loc21_22.1: bool = param b +// CHECK:STDOUT: @EnclosingButAfter.%b: bool = bind_name b, %b.loc21_22.1 +// CHECK:STDOUT: %int.make_type_32.loc21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc21_34.1: type = value_of_initializer %int.make_type_32.loc21 [template = i32] +// CHECK:STDOUT: %.loc21_34.2: type = converted %int.make_type_32.loc21, %.loc21_34.1 [template = i32] // CHECK:STDOUT: @EnclosingButAfter.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -77,36 +81,36 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @UnrelatedScopes() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc8 br !if.then.loc8 else br !if.else.loc8 +// CHECK:STDOUT: %.loc12: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc12 br !if.then.loc12 else br !if.else.loc12 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc8: -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_21.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_21.2: type = converted %int.make_type_32.loc9, %.loc9_21.1 [template = i32] +// CHECK:STDOUT: !if.then.loc12: +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_21.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_21.2: type = converted %int.make_type_32.loc13, %.loc13_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc9_27: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc9_27 -// CHECK:STDOUT: br !if.else.loc8 +// CHECK:STDOUT: %.loc13_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc13_27 +// CHECK:STDOUT: br !if.else.loc12 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc8: -// CHECK:STDOUT: %.loc11: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc11 br !if.then.loc11 else br !if.else.loc11 +// CHECK:STDOUT: !if.else.loc12: +// CHECK:STDOUT: %.loc15: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc15 br !if.then.loc15 else br !if.else.loc15 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc11: -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_21.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_21.2: type = converted %int.make_type_32.loc12, %.loc12_21.1 [template = i32] +// CHECK:STDOUT: !if.then.loc15: +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_21.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_21.2: type = converted %int.make_type_32.loc16, %.loc16_21.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc12_27: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc12_27 -// CHECK:STDOUT: br !if.else.loc11 +// CHECK:STDOUT: %.loc16_27: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc16_27 +// CHECK:STDOUT: br !if.else.loc15 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc11: -// CHECK:STDOUT: %.loc14: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: return %.loc14 +// CHECK:STDOUT: !if.else.loc15: +// CHECK:STDOUT: %.loc18: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: return %.loc18 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Bool() -> type = "bool.make_type"; @@ -117,25 +121,25 @@ fn EnclosingButAfter(b: bool) -> i32 { // CHECK:STDOUT: if %b.ref br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %int.make_type_32.loc19: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc19_21.1: type = value_of_initializer %int.make_type_32.loc19 [template = i32] -// CHECK:STDOUT: %.loc19_21.2: type = converted %int.make_type_32.loc19, %.loc19_21.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc23_21.1: type = value_of_initializer %int.make_type_32.loc23 [template = i32] +// CHECK:STDOUT: %.loc23_21.2: type = converted %int.make_type_32.loc23, %.loc23_21.1 [template = i32] // CHECK:STDOUT: %v.var: ref i32 = var v // CHECK:STDOUT: %v: ref i32 = bind_name v, %v.var -// CHECK:STDOUT: %.loc19_27: i32 = int_literal 0 [template = constants.%.3] -// CHECK:STDOUT: assign %v.var, %.loc19_27 -// CHECK:STDOUT: %.loc19_18: i32 = bind_value %v -// CHECK:STDOUT: return %.loc19_18 +// CHECK:STDOUT: %.loc23_27: i32 = int_literal 0 [template = constants.%.3] +// CHECK:STDOUT: assign %v.var, %.loc23_27 +// CHECK:STDOUT: %.loc23_18: i32 = bind_value %v +// CHECK:STDOUT: return %.loc23_18 // CHECK:STDOUT: // CHECK:STDOUT: !if.else: -// CHECK:STDOUT: %int.make_type_32.loc22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc22_19.1: type = value_of_initializer %int.make_type_32.loc22 [template = i32] -// CHECK:STDOUT: %.loc22_19.2: type = converted %int.make_type_32.loc22, %.loc22_19.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc26_19.1: type = value_of_initializer %int.make_type_32.loc26 [template = i32] +// CHECK:STDOUT: %.loc26_19.2: type = converted %int.make_type_32.loc26, %.loc26_19.1 [template = i32] // CHECK:STDOUT: %w.var: ref i32 = var w // CHECK:STDOUT: %w: ref i32 = bind_name w, %w.var -// CHECK:STDOUT: %.loc22_25: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: assign %w.var, %.loc22_25 -// CHECK:STDOUT: %.loc22_16: i32 = bind_value %w -// CHECK:STDOUT: return %.loc22_16 +// CHECK:STDOUT: %.loc26_25: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: assign %w.var, %.loc26_25 +// CHECK:STDOUT: %.loc26_16: i32 = bind_value %w +// CHECK:STDOUT: return %.loc26_16 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/struct.carbon b/toolchain/check/testdata/return/struct.carbon index d19e75d988e1..d86db3487b4e 100644 --- a/toolchain/check/testdata/return/struct.carbon +++ b/toolchain/check/testdata/return/struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/struct.carbon fn Main() -> {.a: i32} { return {.a = 3}; @@ -30,9 +34,9 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_19.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_19.2: type = converted %int.make_type_32, %.loc7_19.1 [template = i32] -// CHECK:STDOUT: %.loc7_22: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32, %.loc11_19.1 [template = i32] +// CHECK:STDOUT: %.loc11_22: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: @Main.%return: ref {.a: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -41,10 +45,10 @@ fn Main() -> {.a: i32} { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> {.a: i32} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_16: i32 = int_literal 3 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_17: {.a: i32} = struct_literal (%.loc8_16) -// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc8_16) [template = constants.%struct.3] -// CHECK:STDOUT: %.loc8_18: {.a: i32} = converted %.loc8_17, %struct [template = constants.%struct.3] -// CHECK:STDOUT: return %.loc8_18 +// CHECK:STDOUT: %.loc12_16: i32 = int_literal 3 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_17: {.a: i32} = struct_literal (%.loc12_16) +// CHECK:STDOUT: %struct: {.a: i32} = struct_value (%.loc12_16) [template = constants.%struct.3] +// CHECK:STDOUT: %.loc12_18: {.a: i32} = converted %.loc12_17, %struct [template = constants.%struct.3] +// CHECK:STDOUT: return %.loc12_18 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/tuple.carbon b/toolchain/check/testdata/return/tuple.carbon index 26dc9644de68..85950159a157 100644 --- a/toolchain/check/testdata/return/tuple.carbon +++ b/toolchain/check/testdata/return/tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/tuple.carbon fn Main() -> (i32, i32) { @@ -34,14 +38,14 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc8_15: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc8_20: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_23.1: (type, type) = tuple_literal (%int.make_type_32.loc8_15, %int.make_type_32.loc8_20) -// CHECK:STDOUT: %.loc8_23.2: type = value_of_initializer %int.make_type_32.loc8_15 [template = i32] -// CHECK:STDOUT: %.loc8_23.3: type = converted %int.make_type_32.loc8_15, %.loc8_23.2 [template = i32] -// CHECK:STDOUT: %.loc8_23.4: type = value_of_initializer %int.make_type_32.loc8_20 [template = i32] -// CHECK:STDOUT: %.loc8_23.5: type = converted %int.make_type_32.loc8_20, %.loc8_23.4 [template = i32] -// CHECK:STDOUT: %.loc8_23.6: type = converted %.loc8_23.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12_15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_20: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_23.1: (type, type) = tuple_literal (%int.make_type_32.loc12_15, %int.make_type_32.loc12_20) +// CHECK:STDOUT: %.loc12_23.2: type = value_of_initializer %int.make_type_32.loc12_15 [template = i32] +// CHECK:STDOUT: %.loc12_23.3: type = converted %int.make_type_32.loc12_15, %.loc12_23.2 [template = i32] +// CHECK:STDOUT: %.loc12_23.4: type = value_of_initializer %int.make_type_32.loc12_20 [template = i32] +// CHECK:STDOUT: %.loc12_23.5: type = converted %int.make_type_32.loc12_20, %.loc12_23.4 [template = i32] +// CHECK:STDOUT: %.loc12_23.6: type = converted %.loc12_23.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @Main.%return: ref (i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -50,15 +54,15 @@ fn Main() -> (i32, i32) { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> %return: (i32, i32) { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_11: i32 = int_literal 15 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_15: i32 = int_literal 35 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_17.1: (i32, i32) = tuple_literal (%.loc9_11, %.loc9_15) -// CHECK:STDOUT: %.loc9_17.2: ref i32 = tuple_access %return, element0 -// CHECK:STDOUT: %.loc9_17.3: init i32 = initialize_from %.loc9_11 to %.loc9_17.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc9_17.4: ref i32 = tuple_access %return, element1 -// CHECK:STDOUT: %.loc9_17.5: init i32 = initialize_from %.loc9_15 to %.loc9_17.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc9_17.6: init (i32, i32) = tuple_init (%.loc9_17.3, %.loc9_17.5) to %return [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_18: init (i32, i32) = converted %.loc9_17.1, %.loc9_17.6 [template = constants.%tuple] -// CHECK:STDOUT: return %.loc9_18 to %return +// CHECK:STDOUT: %.loc13_11: i32 = int_literal 15 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_15: i32 = int_literal 35 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_17.1: (i32, i32) = tuple_literal (%.loc13_11, %.loc13_15) +// CHECK:STDOUT: %.loc13_17.2: ref i32 = tuple_access %return, element0 +// CHECK:STDOUT: %.loc13_17.3: init i32 = initialize_from %.loc13_11 to %.loc13_17.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc13_17.4: ref i32 = tuple_access %return, element1 +// CHECK:STDOUT: %.loc13_17.5: init i32 = initialize_from %.loc13_15 to %.loc13_17.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc13_17.6: init (i32, i32) = tuple_init (%.loc13_17.3, %.loc13_17.5) to %return [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_18: init (i32, i32) = converted %.loc13_17.1, %.loc13_17.6 [template = constants.%tuple] +// CHECK:STDOUT: return %.loc13_18 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/return/value.carbon b/toolchain/check/testdata/return/value.carbon index dda2cd6f4d5e..5dca0284b3fd 100644 --- a/toolchain/check/testdata/return/value.carbon +++ b/toolchain/check/testdata/return/value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/return/value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/return/value.carbon fn Main() -> i32 { return 0; @@ -28,8 +32,8 @@ fn Main() -> i32 { // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] { // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc11_14.2: type = converted %int.make_type_32, %.loc11_14.1 [template = i32] // CHECK:STDOUT: @Main.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -38,7 +42,7 @@ fn Main() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8: i32 = int_literal 0 [template = constants.%.2] -// CHECK:STDOUT: return %.loc8 +// CHECK:STDOUT: %.loc12: i32 = int_literal 0 [template = constants.%.2] +// CHECK:STDOUT: return %.loc12 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index 9cd732e4d65c..eeec4eb77c73 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_access_into_invalid.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_access_into_invalid.carbon // CHECK:STDERR: fail_access_into_invalid.carbon:[[@LINE+3]]:10: ERROR: Name `a` not found. diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index 52a5b320924f..47b51eedb93c 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_assign_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_empty.carbon // CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+3]]:20: ERROR: Cannot initialize struct with 1 field(s) from struct with 0 field(s). // CHECK:STDERR: var x: {.a: i32} = {}; @@ -27,9 +31,9 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %.loc14_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: } @@ -38,7 +42,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: {} = struct_literal () +// CHECK:STDOUT: %.loc14: {} = struct_literal () // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index 43e34507bf7b..3ed0f88e370f 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_assign_to_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_assign_to_empty.carbon // CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+3]]:13: ERROR: Cannot initialize struct with 0 field(s) from struct with 1 field(s). // CHECK:STDERR: var x: {} = {.a = 1}; @@ -24,16 +28,16 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_9.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_9.1: {} = struct_literal () +// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {} = var x // CHECK:STDOUT: %x: ref {} = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_19: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_20: {.a: i32} = struct_literal (%.loc10_19) +// CHECK:STDOUT: %.loc14_19: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_20: {.a: i32} = struct_literal (%.loc14_19) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index e84bd7a6c9b9..576f6a657cfc 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_duplicate_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_duplicate_name.carbon // CHECK:STDERR: fail_duplicate_name.carbon:[[@LINE+7]]:42: ERROR: Duplicated field name `abc` in struct type literal. // CHECK:STDERR: fn F() -> {.d: i32, .abc: i32, .e: i32, .abc: i32, .f: i32}; @@ -79,57 +83,57 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_16.1: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] -// CHECK:STDOUT: %.loc14_16.2: type = converted %int.make_type_32.loc14_16, %.loc14_16.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_27.1: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] -// CHECK:STDOUT: %.loc14_27.2: type = converted %int.make_type_32.loc14_27, %.loc14_27.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_36: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_36.1: type = value_of_initializer %int.make_type_32.loc14_36 [template = i32] -// CHECK:STDOUT: %.loc14_36.2: type = converted %int.make_type_32.loc14_36, %.loc14_36.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_47: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_47.1: type = value_of_initializer %int.make_type_32.loc14_47 [template = i32] -// CHECK:STDOUT: %.loc14_47.2: type = converted %int.make_type_32.loc14_47, %.loc14_47.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_56: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_56.1: type = value_of_initializer %int.make_type_32.loc14_56 [template = i32] -// CHECK:STDOUT: %.loc14_56.2: type = converted %int.make_type_32.loc14_56, %.loc14_56.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_16.1: type = value_of_initializer %int.make_type_32.loc18_16 [template = i32] +// CHECK:STDOUT: %.loc18_16.2: type = converted %int.make_type_32.loc18_16, %.loc18_16.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_27.1: type = value_of_initializer %int.make_type_32.loc18_27 [template = i32] +// CHECK:STDOUT: %.loc18_27.2: type = converted %int.make_type_32.loc18_27, %.loc18_27.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_36: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_36.1: type = value_of_initializer %int.make_type_32.loc18_36 [template = i32] +// CHECK:STDOUT: %.loc18_36.2: type = converted %int.make_type_32.loc18_36, %.loc18_36.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_47.1: type = value_of_initializer %int.make_type_32.loc18_47 [template = i32] +// CHECK:STDOUT: %.loc18_47.2: type = converted %int.make_type_32.loc18_47, %.loc18_47.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_56: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_56.1: type = value_of_initializer %int.make_type_32.loc18_56 [template = i32] +// CHECK:STDOUT: %.loc18_56.2: type = converted %int.make_type_32.loc18_56, %.loc18_56.1 [template = i32] // CHECK:STDOUT: @F.%return: ref = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc23_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc23_13.1: type = value_of_initializer %int.make_type_32.loc23_13 [template = i32] -// CHECK:STDOUT: %.loc23_13.2: type = converted %int.make_type_32.loc23_13, %.loc23_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc27_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_13.1: type = value_of_initializer %int.make_type_32.loc27_13 [template = i32] +// CHECK:STDOUT: %.loc27_13.2: type = converted %int.make_type_32.loc27_13, %.loc27_13.1 [template = i32] // CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc23_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc23_22.1: type = value_of_initializer %int.make_type_32.loc23_22 [template = i32] -// CHECK:STDOUT: %.loc23_22.2: type = converted %int.make_type_32.loc23_22, %.loc23_22.1 [template = i32] -// CHECK:STDOUT: %.loc23_35: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc23_36: {.a: i32} = struct_literal (%.loc23_35) +// CHECK:STDOUT: %int.make_type_32.loc27_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc27_22.1: type = value_of_initializer %int.make_type_32.loc27_22 [template = i32] +// CHECK:STDOUT: %.loc27_22.2: type = converted %int.make_type_32.loc27_22, %.loc27_22.1 [template = i32] +// CHECK:STDOUT: %.loc27_35: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc27_36: {.a: i32} = struct_literal (%.loc27_35) // CHECK:STDOUT: %v: = bind_name v, // CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc32: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc32_8.1: type = value_of_initializer %int.make_type_32.loc32 [template = i32] -// CHECK:STDOUT: %.loc32_8.2: type = converted %int.make_type_32.loc32, %.loc32_8.1 [template = i32] -// CHECK:STDOUT: %.loc32_22: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc32_32: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc36: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc36_8.1: type = value_of_initializer %int.make_type_32.loc36 [template = i32] +// CHECK:STDOUT: %.loc36_8.2: type = converted %int.make_type_32.loc36, %.loc36_8.1 [template = i32] +// CHECK:STDOUT: %.loc36_22: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc36_32: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: %w: i32 = bind_name w, // CHECK:STDOUT: %import_ref.9: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc41: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc41_13.1: type = value_of_initializer %int.make_type_32.loc41 [template = i32] -// CHECK:STDOUT: %.loc41_13.2: type = converted %int.make_type_32.loc41, %.loc41_13.1 [template = i32] -// CHECK:STDOUT: %.loc41_16: type = struct_type {.a: i32} [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc45: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc45_13.1: type = value_of_initializer %int.make_type_32.loc45 [template = i32] +// CHECK:STDOUT: %.loc45_13.2: type = converted %int.make_type_32.loc45, %.loc45_13.1 [template = i32] +// CHECK:STDOUT: %.loc45_16: type = struct_type {.a: i32} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.10: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc49_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc49_13.1: type = value_of_initializer %int.make_type_32.loc49_13 [template = i32] -// CHECK:STDOUT: %.loc49_13.2: type = converted %int.make_type_32.loc49_13, %.loc49_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc53_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_13.1: type = value_of_initializer %int.make_type_32.loc53_13 [template = i32] +// CHECK:STDOUT: %.loc53_13.2: type = converted %int.make_type_32.loc53_13, %.loc53_13.1 [template = i32] // CHECK:STDOUT: %import_ref.11: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc49_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc49_22.1: type = value_of_initializer %int.make_type_32.loc49_22 [template = i32] -// CHECK:STDOUT: %.loc49_22.2: type = converted %int.make_type_32.loc49_22, %.loc49_22.1 [template = i32] -// CHECK:STDOUT: %.loc49_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc53_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc53_22.1: type = value_of_initializer %int.make_type_32.loc53_22 [template = i32] +// CHECK:STDOUT: %.loc53_22.2: type = converted %int.make_type_32.loc53_22, %.loc53_22.1 [template = i32] +// CHECK:STDOUT: %.loc53_25: type = struct_type {.b: i32, .c: i32} [template = constants.%.5] // CHECK:STDOUT: %y.var: ref {.b: i32, .c: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32, .c: i32} = bind_name y, %y.var // CHECK:STDOUT: } @@ -140,11 +144,11 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc41_26: i32 = int_literal 1 [template = constants.%.2] -// CHECK:STDOUT: %.loc41_34: i32 = int_literal 2 [template = constants.%.4] +// CHECK:STDOUT: %.loc45_26: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc45_34: i32 = int_literal 2 [template = constants.%.4] // CHECK:STDOUT: assign file.%x.var, -// CHECK:STDOUT: %.loc49_35: i32 = int_literal 3 [template = constants.%.7] -// CHECK:STDOUT: %.loc49_43: i32 = int_literal 4 [template = constants.%.8] +// CHECK:STDOUT: %.loc53_35: i32 = int_literal 3 [template = constants.%.7] +// CHECK:STDOUT: %.loc53_43: i32 = int_literal 4 [template = constants.%.8] // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index a406764badc6..cebd220a1b25 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_name_mismatch.carbon // CHECK:STDERR: fail_field_name_mismatch.carbon:[[@LINE+4]]:20: ERROR: Missing value for field `a` in struct initialization. // CHECK:STDERR: var x: {.a: i32} = {.b = 1}; @@ -34,17 +38,17 @@ var y: {.b: i32} = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] -// CHECK:STDOUT: %.loc11_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_13.2: type = converted %int.make_type_32.loc15, %.loc15_13.1 [template = i32] +// CHECK:STDOUT: %.loc15_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc16_13.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] -// CHECK:STDOUT: %.loc16_13.2: type = converted %int.make_type_32.loc16, %.loc16_13.1 [template = i32] -// CHECK:STDOUT: %.loc16_16: type = struct_type {.b: i32} [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc20: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc20_13.1: type = value_of_initializer %int.make_type_32.loc20 [template = i32] +// CHECK:STDOUT: %.loc20_13.2: type = converted %int.make_type_32.loc20, %.loc20_13.1 [template = i32] +// CHECK:STDOUT: %.loc20_16: type = struct_type {.b: i32} [template = constants.%.4] // CHECK:STDOUT: %y.var: ref {.b: i32} = var y // CHECK:STDOUT: %y: ref {.b: i32} = bind_name y, %y.var // CHECK:STDOUT: } @@ -53,8 +57,8 @@ var y: {.b: i32} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_26: i32 = int_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc11_27: {.b: i32} = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc15_26: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc15_27: {.b: i32} = struct_literal (%.loc15_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index 4de00bce36c9..1407f80ed901 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_field_type_mismatch.carbon // CHECK:STDERR: fail_field_type_mismatch.carbon:[[@LINE+3]]:20: ERROR: Missing value for field `a` in struct initialization. // CHECK:STDERR: var x: {.a: i32} = {.b = 1.0}; @@ -28,9 +32,9 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %.loc14_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: } @@ -39,8 +43,8 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_26: f64 = float_literal 1 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_29: {.b: f64} = struct_literal (%.loc10_26) +// CHECK:STDOUT: %.loc14_26: f64 = float_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_29: {.b: f64} = struct_literal (%.loc14_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_keyword_name.carbon b/toolchain/check/testdata/struct/fail_keyword_name.carbon index 86c7dde40933..169b3e9b209b 100644 --- a/toolchain/check/testdata/struct/fail_keyword_name.carbon +++ b/toolchain/check/testdata/struct/fail_keyword_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_keyword_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_keyword_name.carbon // CHECK:STDERR: fail_keyword_name.carbon:[[@LINE+8]]:13: ERROR: Expected identifier after `.`. // CHECK:STDERR: fn F() -> {.class: i32}; diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index 1c9b5dde6c93..627217bd344b 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_member_access_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_access_type.carbon var x: {.a: f64} = {.a = 4.0}; // CHECK:STDERR: fail_member_access_type.carbon:[[@LINE+3]]:14: ERROR: Type `{.a: f64}` does not have a member `b`. @@ -31,18 +35,18 @@ var y: i32 = x.b; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_13.1: i32 = int_literal 64 [template = constants.%.1] // CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: f64} [template = constants.%.3] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc11_13.1) [template = f64] +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc11_13.3: type = converted %float.make_type, %.loc11_13.2 [template = f64] +// CHECK:STDOUT: %.loc11_16: type = struct_type {.a: f64} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: f64} = var x // CHECK:STDOUT: %x: ref {.a: f64} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.3] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.3() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: } @@ -53,11 +57,11 @@ var y: i32 = x.b; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26: f64 = float_literal 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_29.1: {.a: f64} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_29.2: init {.a: f64} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_30: init {.a: f64} = converted %.loc7_29.1, %.loc7_29.2 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%x.var, %.loc7_30 +// CHECK:STDOUT: %.loc11_26: f64 = float_literal 4 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_29.1: {.a: f64} = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc11_29.2: init {.a: f64} = struct_init (%.loc11_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc11_30: init {.a: f64} = converted %.loc11_29.1, %.loc11_29.2 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%x.var, %.loc11_30 // CHECK:STDOUT: %x.ref: ref {.a: f64} = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index 1fcd32d2bc12..2f6c8f39cf42 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_member_of_function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_member_of_function.carbon fn A() { // CHECK:STDERR: fail_member_of_function.carbon:[[@LINE+3]]:3: ERROR: Expression cannot be used as a value. diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index 41998cc94b25..2e4be71ef444 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_non_member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_non_member_access.carbon var x: {.a: i32} = {.a = 4}; // CHECK:STDERR: fail_non_member_access.carbon:[[@LINE+3]]:14: ERROR: Type `{.a: i32}` does not have a member `b`. @@ -29,16 +33,16 @@ var y: i32 = x.b; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7, %.loc7_13.1 [template = i32] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %.loc11_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_8.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_8.2: type = converted %int.make_type_32.loc11, %.loc11_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_8.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_8.2: type = converted %int.make_type_32.loc15, %.loc15_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: } @@ -47,11 +51,11 @@ var y: i32 = x.b; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%x.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 4 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: {.a: i32} = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: init {.a: i32} = struct_init (%.loc11_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc11_28: init {.a: i32} = converted %.loc11_27.1, %.loc11_27.2 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index c8b9a39691a2..000fc764fd5b 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_too_few_values.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_too_few_values.carbon // CHECK:STDERR: fail_too_few_values.carbon:[[@LINE+3]]:29: ERROR: Cannot initialize struct with 2 field(s) from struct with 1 field(s). // CHECK:STDERR: var x: {.a: i32, .b: i32} = {.a = 1}; @@ -28,14 +32,14 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_13: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32.loc10_13 [template = i32] -// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32.loc10_13, %.loc10_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_13: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14_13 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14_13, %.loc14_13.1 [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_22.1: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] -// CHECK:STDOUT: %.loc10_22.2: type = converted %int.make_type_32.loc10_22, %.loc10_22.1 [template = i32] -// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_22.1: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_22.2: type = converted %int.make_type_32.loc14_22, %.loc14_22.1 [template = i32] +// CHECK:STDOUT: %.loc14_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var // CHECK:STDOUT: } @@ -44,8 +48,8 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_36: {.a: i32} = struct_literal (%.loc10_35) +// CHECK:STDOUT: %.loc14_35: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_36: {.a: i32} = struct_literal (%.loc14_35) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index d84e48f19630..2387842a07cc 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_type_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_type_assign.carbon // CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:1: ERROR: Cannot implicitly convert from `type` to `{.a: i32}`. // CHECK:STDERR: var x: {.a: i32} = {.a: i32}; @@ -26,9 +30,9 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32, %.loc10_13.1 [template = i32] -// CHECK:STDOUT: %.loc10_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %.loc14_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] @@ -39,9 +43,9 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_25.1: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_25.2: type = converted %int.make_type_32, %.loc10_25.1 [template = i32] -// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_25.1: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_25.2: type = converted %int.make_type_32, %.loc14_25.1 [template = i32] +// CHECK:STDOUT: %.loc14_28: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index a12f43e3eadb..7c06e67b6d3b 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon // CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: ERROR: Cannot implicitly convert from `{.a: i32}` to `type`. // CHECK:STDERR: var x: {.a = 1}; @@ -22,8 +26,8 @@ var x: {.a = 1}; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_14: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_15: {.a: i32} = struct_literal (%.loc10_14) +// CHECK:STDOUT: %.loc14_14: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_15: {.a: i32} = struct_literal (%.loc14_14) // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 9c95b4d61764..aac58c73b6b5 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index def6c281e7b5..094fdd35ada2 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/literal_member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/literal_member_access.carbon fn G() -> {.x: i32, .y: i32, .z: i32}; @@ -40,23 +44,23 @@ fn F() -> i32 { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32] -// CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_25: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: type = value_of_initializer %int.make_type_32.loc7_25 [template = i32] -// CHECK:STDOUT: %.loc7_25.2: type = converted %int.make_type_32.loc7_25, %.loc7_25.1 [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_34: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_34.1: type = value_of_initializer %int.make_type_32.loc7_34 [template = i32] -// CHECK:STDOUT: %.loc7_34.2: type = converted %int.make_type_32.loc7_34, %.loc7_34.1 [template = i32] -// CHECK:STDOUT: %.loc7_37: type = struct_type {.x: i32, .y: i32, .z: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc11_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_16.1: type = value_of_initializer %int.make_type_32.loc11_16 [template = i32] +// CHECK:STDOUT: %.loc11_16.2: type = converted %int.make_type_32.loc11_16, %.loc11_16.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_25: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: type = value_of_initializer %int.make_type_32.loc11_25 [template = i32] +// CHECK:STDOUT: %.loc11_25.2: type = converted %int.make_type_32.loc11_25, %.loc11_25.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_34.1: type = value_of_initializer %int.make_type_32.loc11_34 [template = i32] +// CHECK:STDOUT: %.loc11_34.2: type = converted %int.make_type_32.loc11_34, %.loc11_34.1 [template = i32] +// CHECK:STDOUT: %.loc11_37: type = struct_type {.x: i32, .y: i32, .z: i32} [template = constants.%.2] // CHECK:STDOUT: @G.%return: ref {.x: i32, .y: i32, .z: i32} = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] { -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_11.2: type = converted %int.make_type_32.loc9, %.loc9_11.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_11.2: type = converted %int.make_type_32.loc13, %.loc13_11.1 [template = i32] // CHECK:STDOUT: @F.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: } @@ -67,25 +71,25 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> i32 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16: i32 = int_literal 1 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_16: i32 = int_literal 1 [template = constants.%.3] // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage -// CHECK:STDOUT: %G.call: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc10_25.1 -// CHECK:STDOUT: %.loc10_34: i32 = int_literal 3 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc10_16, %G.call, %.loc10_34) -// CHECK:STDOUT: %.loc10_25.2: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc10_25.1, %G.call -// CHECK:STDOUT: %.loc10_25.3: ref i32 = struct_access %.loc10_25.2, element0 -// CHECK:STDOUT: %.loc10_25.4: i32 = bind_value %.loc10_25.3 -// CHECK:STDOUT: %.loc10_25.5: ref i32 = struct_access %.loc10_25.2, element1 -// CHECK:STDOUT: %.loc10_25.6: i32 = bind_value %.loc10_25.5 -// CHECK:STDOUT: %.loc10_25.7: ref i32 = struct_access %.loc10_25.2, element2 -// CHECK:STDOUT: %.loc10_25.8: i32 = bind_value %.loc10_25.7 -// CHECK:STDOUT: %struct.loc10_25: {.x: i32, .y: i32, .z: i32} = struct_value (%.loc10_25.4, %.loc10_25.6, %.loc10_25.8) -// CHECK:STDOUT: %.loc10_35.2: {.x: i32, .y: i32, .z: i32} = converted %G.call, %struct.loc10_25 -// CHECK:STDOUT: %struct.loc10_35: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_value (%.loc10_16, %.loc10_35.2, %.loc10_34) -// CHECK:STDOUT: %.loc10_35.3: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = converted %.loc10_35.1, %struct.loc10_35 -// CHECK:STDOUT: %.loc10_36: {.x: i32, .y: i32, .z: i32} = struct_access %.loc10_35.3, element1 -// CHECK:STDOUT: %.loc10_38: i32 = struct_access %.loc10_36, element1 -// CHECK:STDOUT: return %.loc10_38 +// CHECK:STDOUT: %.loc14_25.1: ref {.x: i32, .y: i32, .z: i32} = temporary_storage +// CHECK:STDOUT: %G.call: init {.x: i32, .y: i32, .z: i32} = call %G.ref() to %.loc14_25.1 +// CHECK:STDOUT: %.loc14_34: i32 = int_literal 3 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_35.1: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_literal (%.loc14_16, %G.call, %.loc14_34) +// CHECK:STDOUT: %.loc14_25.2: ref {.x: i32, .y: i32, .z: i32} = temporary %.loc14_25.1, %G.call +// CHECK:STDOUT: %.loc14_25.3: ref i32 = struct_access %.loc14_25.2, element0 +// CHECK:STDOUT: %.loc14_25.4: i32 = bind_value %.loc14_25.3 +// CHECK:STDOUT: %.loc14_25.5: ref i32 = struct_access %.loc14_25.2, element1 +// CHECK:STDOUT: %.loc14_25.6: i32 = bind_value %.loc14_25.5 +// CHECK:STDOUT: %.loc14_25.7: ref i32 = struct_access %.loc14_25.2, element2 +// CHECK:STDOUT: %.loc14_25.8: i32 = bind_value %.loc14_25.7 +// CHECK:STDOUT: %struct.loc14_25: {.x: i32, .y: i32, .z: i32} = struct_value (%.loc14_25.4, %.loc14_25.6, %.loc14_25.8) +// CHECK:STDOUT: %.loc14_35.2: {.x: i32, .y: i32, .z: i32} = converted %G.call, %struct.loc14_25 +// CHECK:STDOUT: %struct.loc14_35: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = struct_value (%.loc14_16, %.loc14_35.2, %.loc14_34) +// CHECK:STDOUT: %.loc14_35.3: {.a: i32, .b: {.x: i32, .y: i32, .z: i32}, .c: i32} = converted %.loc14_35.1, %struct.loc14_35 +// CHECK:STDOUT: %.loc14_36: {.x: i32, .y: i32, .z: i32} = struct_access %.loc14_35.3, element1 +// CHECK:STDOUT: %.loc14_38: i32 = struct_access %.loc14_36, element1 +// CHECK:STDOUT: return %.loc14_38 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index 804afa418126..aaf41b4eba33 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/member_access.carbon var x: {.a: f64, .b: i32} = {.a = 0.0, .b = 1}; var y: i32 = x.b; @@ -32,28 +36,28 @@ var z: i32 = y; // CHECK:STDOUT: .z = %z // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc7_13.1: i32 = int_literal 64 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_13.1: i32 = int_literal 64 [template = constants.%.1] // CHECK:STDOUT: %import_ref.1: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc7_13.1) [template = f64] -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %float.make_type [template = f64] -// CHECK:STDOUT: %.loc7_13.3: type = converted %float.make_type, %.loc7_13.2 [template = f64] +// CHECK:STDOUT: %float.make_type: init type = call constants.%struct.1(%.loc11_13.1) [template = f64] +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %float.make_type [template = f64] +// CHECK:STDOUT: %.loc11_13.3: type = converted %float.make_type, %.loc11_13.2 [template = f64] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc7_22.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_22.2: type = converted %int.make_type_32.loc7, %.loc7_22.1 [template = i32] -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32} [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc11_22.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_22.2: type = converted %int.make_type_32.loc11, %.loc11_22.1 [template = i32] +// CHECK:STDOUT: %.loc11_25: type = struct_type {.a: f64, .b: i32} [template = constants.%.3] // CHECK:STDOUT: %x.var: ref {.a: f64, .b: i32} = var x // CHECK:STDOUT: %x: ref {.a: f64, .b: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc8_8.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_8.2: type = converted %int.make_type_32.loc8, %.loc8_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc12_8.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_8.2: type = converted %int.make_type_32.loc12, %.loc12_8.1 [template = i32] // CHECK:STDOUT: %y.var: ref i32 = var y // CHECK:STDOUT: %y: ref i32 = bind_name y, %y.var // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.2] -// CHECK:STDOUT: %int.make_type_32.loc9: init type = call constants.%struct.2() [template = i32] -// CHECK:STDOUT: %.loc9_8.1: type = value_of_initializer %int.make_type_32.loc9 [template = i32] -// CHECK:STDOUT: %.loc9_8.2: type = converted %int.make_type_32.loc9, %.loc9_8.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%struct.2() [template = i32] +// CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32] +// CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32] // CHECK:STDOUT: %z.var: ref i32 = var z // CHECK:STDOUT: %z: ref i32 = bind_name z, %z.var // CHECK:STDOUT: } @@ -64,23 +68,23 @@ var z: i32 = y; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_35: f64 = float_literal 0 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_46.1: {.a: f64, .b: i32} = struct_literal (%.loc7_35, %.loc7_45) -// CHECK:STDOUT: %.loc7_46.2: ref f64 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_46.3: init f64 = initialize_from %.loc7_35 to %.loc7_46.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_46.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc7_46.5: init i32 = initialize_from %.loc7_45 to %.loc7_46.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_46.6: init {.a: f64, .b: i32} = struct_init (%.loc7_46.3, %.loc7_46.5) to file.%x.var [template = constants.%struct.3] -// CHECK:STDOUT: %.loc7_47: init {.a: f64, .b: i32} = converted %.loc7_46.1, %.loc7_46.6 [template = constants.%struct.3] -// CHECK:STDOUT: assign file.%x.var, %.loc7_47 +// CHECK:STDOUT: %.loc11_35: f64 = float_literal 0 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_45: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_46.1: {.a: f64, .b: i32} = struct_literal (%.loc11_35, %.loc11_45) +// CHECK:STDOUT: %.loc11_46.2: ref f64 = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_46.3: init f64 = initialize_from %.loc11_35 to %.loc11_46.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_46.4: ref i32 = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_46.5: init i32 = initialize_from %.loc11_45 to %.loc11_46.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_46.6: init {.a: f64, .b: i32} = struct_init (%.loc11_46.3, %.loc11_46.5) to file.%x.var [template = constants.%struct.3] +// CHECK:STDOUT: %.loc11_47: init {.a: f64, .b: i32} = converted %.loc11_46.1, %.loc11_46.6 [template = constants.%struct.3] +// CHECK:STDOUT: assign file.%x.var, %.loc11_47 // CHECK:STDOUT: %x.ref: ref {.a: f64, .b: i32} = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_15.1: ref i32 = struct_access %x.ref, element1 -// CHECK:STDOUT: %.loc8_15.2: i32 = bind_value %.loc8_15.1 -// CHECK:STDOUT: assign file.%y.var, %.loc8_15.2 +// CHECK:STDOUT: %.loc12_15.1: ref i32 = struct_access %x.ref, element1 +// CHECK:STDOUT: %.loc12_15.2: i32 = bind_value %.loc12_15.1 +// CHECK:STDOUT: assign file.%y.var, %.loc12_15.2 // CHECK:STDOUT: %y.ref: ref i32 = name_ref y, file.%y -// CHECK:STDOUT: %.loc9: i32 = bind_value %y.ref -// CHECK:STDOUT: assign file.%z.var, %.loc9 +// CHECK:STDOUT: %.loc13: i32 = bind_value %y.ref +// CHECK:STDOUT: assign file.%z.var, %.loc13 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index ab99500cc350..6335abd88ac5 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/nested_struct_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/nested_struct_in_place.carbon fn F() -> (i32, i32, i32); @@ -39,17 +43,17 @@ fn G() { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17, %int.make_type_32.loc7_22) -// CHECK:STDOUT: %.loc7_25.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_25.3: type = converted %int.make_type_32.loc7_12, %.loc7_25.2 [template = i32] -// CHECK:STDOUT: %.loc7_25.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_25.5: type = converted %int.make_type_32.loc7_17, %.loc7_25.4 [template = i32] -// CHECK:STDOUT: %.loc7_25.6: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32] -// CHECK:STDOUT: %.loc7_25.7: type = converted %int.make_type_32.loc7_22, %.loc7_25.6 [template = i32] -// CHECK:STDOUT: %.loc7_25.8: type = converted %.loc7_25.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc11_12, %int.make_type_32.loc11_17, %int.make_type_32.loc11_22) +// CHECK:STDOUT: %.loc11_25.2: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_25.3: type = converted %int.make_type_32.loc11_12, %.loc11_25.2 [template = i32] +// CHECK:STDOUT: %.loc11_25.4: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_25.5: type = converted %int.make_type_32.loc11_17, %.loc11_25.4 [template = i32] +// CHECK:STDOUT: %.loc11_25.6: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_25.7: type = converted %int.make_type_32.loc11_22, %.loc11_25.6 [template = i32] +// CHECK:STDOUT: %.loc11_25.8: type = converted %.loc11_25.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} @@ -67,41 +71,41 @@ fn G() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10_16: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_21: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_26: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_16, %int.make_type_32.loc10_21, %int.make_type_32.loc10_26) -// CHECK:STDOUT: %.loc10_29.2: type = value_of_initializer %int.make_type_32.loc10_16 [template = i32] -// CHECK:STDOUT: %.loc10_29.3: type = converted %int.make_type_32.loc10_16, %.loc10_29.2 [template = i32] -// CHECK:STDOUT: %.loc10_29.4: type = value_of_initializer %int.make_type_32.loc10_21 [template = i32] -// CHECK:STDOUT: %.loc10_29.5: type = converted %int.make_type_32.loc10_21, %.loc10_29.4 [template = i32] -// CHECK:STDOUT: %.loc10_29.6: type = value_of_initializer %int.make_type_32.loc10_26 [template = i32] -// CHECK:STDOUT: %.loc10_29.7: type = converted %int.make_type_32.loc10_26, %.loc10_29.6 [template = i32] -// CHECK:STDOUT: %.loc10_29.8: type = converted %.loc10_29.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %int.make_type_32.loc10_37: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_42: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_47: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_50.1: (type, type, type) = tuple_literal (%int.make_type_32.loc10_37, %int.make_type_32.loc10_42, %int.make_type_32.loc10_47) -// CHECK:STDOUT: %.loc10_50.2: type = value_of_initializer %int.make_type_32.loc10_37 [template = i32] -// CHECK:STDOUT: %.loc10_50.3: type = converted %int.make_type_32.loc10_37, %.loc10_50.2 [template = i32] -// CHECK:STDOUT: %.loc10_50.4: type = value_of_initializer %int.make_type_32.loc10_42 [template = i32] -// CHECK:STDOUT: %.loc10_50.5: type = converted %int.make_type_32.loc10_42, %.loc10_50.4 [template = i32] -// CHECK:STDOUT: %.loc10_50.6: type = value_of_initializer %int.make_type_32.loc10_47 [template = i32] -// CHECK:STDOUT: %.loc10_50.7: type = converted %int.make_type_32.loc10_47, %.loc10_50.6 [template = i32] -// CHECK:STDOUT: %.loc10_50.8: type = converted %.loc10_50.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc14_16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_21: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_26: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_29.1: (type, type, type) = tuple_literal (%int.make_type_32.loc14_16, %int.make_type_32.loc14_21, %int.make_type_32.loc14_26) +// CHECK:STDOUT: %.loc14_29.2: type = value_of_initializer %int.make_type_32.loc14_16 [template = i32] +// CHECK:STDOUT: %.loc14_29.3: type = converted %int.make_type_32.loc14_16, %.loc14_29.2 [template = i32] +// CHECK:STDOUT: %.loc14_29.4: type = value_of_initializer %int.make_type_32.loc14_21 [template = i32] +// CHECK:STDOUT: %.loc14_29.5: type = converted %int.make_type_32.loc14_21, %.loc14_29.4 [template = i32] +// CHECK:STDOUT: %.loc14_29.6: type = value_of_initializer %int.make_type_32.loc14_26 [template = i32] +// CHECK:STDOUT: %.loc14_29.7: type = converted %int.make_type_32.loc14_26, %.loc14_29.6 [template = i32] +// CHECK:STDOUT: %.loc14_29.8: type = converted %.loc14_29.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14_37: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_42: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_47: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_50.1: (type, type, type) = tuple_literal (%int.make_type_32.loc14_37, %int.make_type_32.loc14_42, %int.make_type_32.loc14_47) +// CHECK:STDOUT: %.loc14_50.2: type = value_of_initializer %int.make_type_32.loc14_37 [template = i32] +// CHECK:STDOUT: %.loc14_50.3: type = converted %int.make_type_32.loc14_37, %.loc14_50.2 [template = i32] +// CHECK:STDOUT: %.loc14_50.4: type = value_of_initializer %int.make_type_32.loc14_42 [template = i32] +// CHECK:STDOUT: %.loc14_50.5: type = converted %int.make_type_32.loc14_42, %.loc14_50.4 [template = i32] +// CHECK:STDOUT: %.loc14_50.6: type = value_of_initializer %int.make_type_32.loc14_47 [template = i32] +// CHECK:STDOUT: %.loc14_50.7: type = converted %int.make_type_32.loc14_47, %.loc14_50.6 [template = i32] +// CHECK:STDOUT: %.loc14_50.8: type = converted %.loc14_50.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_51: type = struct_type {.a: (i32, i32, i32), .b: (i32, i32, i32)} [template = constants.%.4] // CHECK:STDOUT: %v.var: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = var v // CHECK:STDOUT: %v: ref {.a: (i32, i32, i32), .b: (i32, i32, i32)} = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_61: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 -// CHECK:STDOUT: %F.call.loc10_62: init (i32, i32, i32) = call %F.ref.loc10_61() to %.loc10_74.1 -// CHECK:STDOUT: %F.ref.loc10_71: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 -// CHECK:STDOUT: %F.call.loc10_72: init (i32, i32, i32) = call %F.ref.loc10_71() to %.loc10_74.2 -// CHECK:STDOUT: %.loc10_74.3: {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_literal (%F.call.loc10_62, %F.call.loc10_72) -// CHECK:STDOUT: %.loc10_74.4: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_init (%F.call.loc10_62, %F.call.loc10_72) to %v.var -// CHECK:STDOUT: %.loc10_75: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = converted %.loc10_74.3, %.loc10_74.4 -// CHECK:STDOUT: assign %v.var, %.loc10_75 +// CHECK:STDOUT: %F.ref.loc14_61: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_74.1: ref (i32, i32, i32) = struct_access %v.var, element0 +// CHECK:STDOUT: %F.call.loc14_62: init (i32, i32, i32) = call %F.ref.loc14_61() to %.loc14_74.1 +// CHECK:STDOUT: %F.ref.loc14_71: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_74.2: ref (i32, i32, i32) = struct_access %v.var, element1 +// CHECK:STDOUT: %F.call.loc14_72: init (i32, i32, i32) = call %F.ref.loc14_71() to %.loc14_74.2 +// CHECK:STDOUT: %.loc14_74.3: {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_literal (%F.call.loc14_62, %F.call.loc14_72) +// CHECK:STDOUT: %.loc14_74.4: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = struct_init (%F.call.loc14_62, %F.call.loc14_72) to %v.var +// CHECK:STDOUT: %.loc14_75: init {.a: (i32, i32, i32), .b: (i32, i32, i32)} = converted %.loc14_74.3, %.loc14_74.4 +// CHECK:STDOUT: assign %v.var, %.loc14_75 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/no_prelude/empty.carbon b/toolchain/check/testdata/struct/no_prelude/empty.carbon index b75e341ad787..200a8a93641f 100644 --- a/toolchain/check/testdata/struct/no_prelude/empty.carbon +++ b/toolchain/check/testdata/struct/no_prelude/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/no_prelude/empty.carbon var x: {} = {}; var y: {} = x; @@ -20,26 +24,26 @@ var y: {} = x; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_9.1: {} = struct_literal () -// CHECK:STDOUT: %.loc7_9.2: type = converted %.loc7_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_9.1: {} = struct_literal () +// CHECK:STDOUT: %.loc11_9.2: type = converted %.loc11_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref {} = var x // CHECK:STDOUT: %x: ref {} = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_9.1: {} = struct_literal () -// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_9.1: {} = struct_literal () +// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %y.var: ref {} = var y // CHECK:STDOUT: %y: ref {} = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_14.1: {} = struct_literal () -// CHECK:STDOUT: %.loc7_14.2: init {} = struct_init () to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_15: init {} = converted %.loc7_14.1, %.loc7_14.2 [template = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc7_15 +// CHECK:STDOUT: %.loc11_14.1: {} = struct_literal () +// CHECK:STDOUT: %.loc11_14.2: init {} = struct_init () to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_15: init {} = converted %.loc11_14.1, %.loc11_14.2 [template = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc11_15 // CHECK:STDOUT: %x.ref: ref {} = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_13: init {} = struct_init () to file.%y.var [template = constants.%struct] -// CHECK:STDOUT: %.loc8_14: init {} = converted %x.ref, %.loc8_13 [template = constants.%struct] -// CHECK:STDOUT: assign file.%y.var, %.loc8_14 +// CHECK:STDOUT: %.loc12_13: init {} = struct_init () to file.%y.var [template = constants.%struct] +// CHECK:STDOUT: %.loc12_14: init {} = converted %x.ref, %.loc12_13 [template = constants.%struct] +// CHECK:STDOUT: assign file.%y.var, %.loc12_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon b/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon index b7fc6a22c0c7..22a57364c489 100644 --- a/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon // CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+3]]:19: ERROR: Missing value for field `a` in struct initialization. // CHECK:STDERR: var x: {.a: {}} = {.b = {}}; @@ -23,17 +27,17 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_14.1: {} = struct_literal () -// CHECK:STDOUT: %.loc10_14.2: type = converted %.loc10_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_15: type = struct_type {.a: {}} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_14.1: {} = struct_literal () +// CHECK:STDOUT: %.loc14_14.2: type = converted %.loc14_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_15: type = struct_type {.a: {}} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: {}} = var x // CHECK:STDOUT: %x: ref {.a: {}} = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_26: {} = struct_literal () -// CHECK:STDOUT: %.loc10_27: {.b: {}} = struct_literal (%.loc10_26) +// CHECK:STDOUT: %.loc14_26: {} = struct_literal () +// CHECK:STDOUT: %.loc14_27: {.b: {}} = struct_literal (%.loc14_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon index d403eb1cf6ad..c69c938ad901 100644 --- a/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon class Incomplete; @@ -31,12 +35,12 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: .p = %p // CHECK:STDOUT: } // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc15: type = struct_type {.a: Incomplete} [template = constants.%.1] +// CHECK:STDOUT: %Incomplete.ref.loc19: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc19: type = struct_type {.a: Incomplete} [template = constants.%.1] // CHECK:STDOUT: %s.var: ref = var s // CHECK:STDOUT: %s: ref = bind_name s, %s.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.2] +// CHECK:STDOUT: %Incomplete.ref.loc21: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc21: type = ptr_type Incomplete [template = constants.%.2] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: } @@ -46,7 +50,7 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.ref: ref = name_ref s, file.%s -// CHECK:STDOUT: %.loc17: = addr_of [template = ] +// CHECK:STDOUT: %.loc21: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index 898a92059887..1b506c7c997d 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/one_entry.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/one_entry.carbon var x: {.a: i32} = {.a = 4}; var y: {.a: i32} = x; @@ -26,17 +30,17 @@ var y: {.a: i32} = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7, %.loc7_13.1 [template = i32] -// CHECK:STDOUT: %.loc7_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11, %.loc11_13.1 [template = i32] +// CHECK:STDOUT: %.loc11_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.a: i32} = var x // CHECK:STDOUT: %x: ref {.a: i32} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32] -// CHECK:STDOUT: %.loc8_16: type = struct_type {.a: i32} [template = constants.%.2] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12, %.loc12_13.1 [template = i32] +// CHECK:STDOUT: %.loc12_16: type = struct_type {.a: i32} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.a: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32} = bind_name y, %y.var // CHECK:STDOUT: } @@ -45,17 +49,17 @@ var y: {.a: i32} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26: i32 = int_literal 4 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_27.1: {.a: i32} = struct_literal (%.loc7_26) -// CHECK:STDOUT: %.loc7_27.2: init {.a: i32} = struct_init (%.loc7_26) to file.%x.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_28: init {.a: i32} = converted %.loc7_27.1, %.loc7_27.2 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%x.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_26: i32 = int_literal 4 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_27.1: {.a: i32} = struct_literal (%.loc11_26) +// CHECK:STDOUT: %.loc11_27.2: init {.a: i32} = struct_init (%.loc11_26) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc11_28: init {.a: i32} = converted %.loc11_27.1, %.loc11_27.2 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: %x.ref: ref {.a: i32} = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_20.1: ref i32 = struct_access %x.ref, element0 -// CHECK:STDOUT: %.loc8_20.2: i32 = bind_value %.loc8_20.1 -// CHECK:STDOUT: %.loc8_20.3: init {.a: i32} = struct_init (%.loc8_20.2) to file.%y.var -// CHECK:STDOUT: %.loc8_21: init {.a: i32} = converted %x.ref, %.loc8_20.3 -// CHECK:STDOUT: assign file.%y.var, %.loc8_21 +// CHECK:STDOUT: %.loc12_20.1: ref i32 = struct_access %x.ref, element0 +// CHECK:STDOUT: %.loc12_20.2: i32 = bind_value %.loc12_20.1 +// CHECK:STDOUT: %.loc12_20.3: init {.a: i32} = struct_init (%.loc12_20.2) to file.%y.var +// CHECK:STDOUT: %.loc12_21: init {.a: i32} = converted %x.ref, %.loc12_20.3 +// CHECK:STDOUT: assign file.%y.var, %.loc12_21 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index 6f6e572f6016..b7800bd96bec 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/reorder_fields.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/reorder_fields.carbon fn MakeI32() -> i32; fn MakeF64() -> f64; @@ -44,30 +48,30 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %MakeI32.decl: MakeI32 = fn_decl @MakeI32 [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_17.2: type = converted %int.make_type_32.loc7, %.loc7_17.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_17.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_17.2: type = converted %int.make_type_32.loc11, %.loc11_17.1 [template = i32] // CHECK:STDOUT: @MakeI32.%return: ref i32 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] // CHECK:STDOUT: %MakeF64.decl: MakeF64 = fn_decl @MakeF64 [template = constants.%struct.4] { -// CHECK:STDOUT: %.loc8_17.1: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type.loc8: init type = call constants.%struct.3(%.loc8_17.1) [template = f64] -// CHECK:STDOUT: %.loc8_17.2: type = value_of_initializer %float.make_type.loc8 [template = f64] -// CHECK:STDOUT: %.loc8_17.3: type = converted %float.make_type.loc8, %.loc8_17.2 [template = f64] +// CHECK:STDOUT: %.loc12_17.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc12: init type = call constants.%struct.3(%.loc12_17.1) [template = f64] +// CHECK:STDOUT: %.loc12_17.2: type = value_of_initializer %float.make_type.loc12 [template = f64] +// CHECK:STDOUT: %.loc12_17.3: type = converted %float.make_type.loc12, %.loc12_17.2 [template = f64] // CHECK:STDOUT: @MakeF64.%return: ref f64 = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.4: Float = import_ref ir3, inst+31, loaded [template = constants.%struct.3] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.5] { -// CHECK:STDOUT: %int.make_type_32.loc10: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_16.1: type = value_of_initializer %int.make_type_32.loc10 [template = i32] -// CHECK:STDOUT: %.loc10_16.2: type = converted %int.make_type_32.loc10, %.loc10_16.1 [template = i32] -// CHECK:STDOUT: %.loc10_25.1: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type.loc10: init type = call constants.%struct.3(%.loc10_25.1) [template = f64] -// CHECK:STDOUT: %.loc10_25.2: type = value_of_initializer %float.make_type.loc10 [template = f64] -// CHECK:STDOUT: %.loc10_25.3: type = converted %float.make_type.loc10, %.loc10_25.2 [template = f64] -// CHECK:STDOUT: %.loc10_28: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_16.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32] +// CHECK:STDOUT: %.loc14_16.2: type = converted %int.make_type_32.loc14, %.loc14_16.1 [template = i32] +// CHECK:STDOUT: %.loc14_25.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc14: init type = call constants.%struct.3(%.loc14_25.1) [template = f64] +// CHECK:STDOUT: %.loc14_25.2: type = value_of_initializer %float.make_type.loc14 [template = f64] +// CHECK:STDOUT: %.loc14_25.3: type = converted %float.make_type.loc14, %.loc14_25.2 [template = f64] +// CHECK:STDOUT: %.loc14_28: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref {.a: i32, .b: f64} = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] @@ -86,49 +90,49 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: // CHECK:STDOUT: fn @F() -> %return: {.a: i32, .b: f64} { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc11_15.1: type = value_of_initializer %int.make_type_32.loc11 [template = i32] -// CHECK:STDOUT: %.loc11_15.2: type = converted %int.make_type_32.loc11, %.loc11_15.1 [template = i32] -// CHECK:STDOUT: %.loc11_24.1: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type.loc11: init type = call constants.%struct.3(%.loc11_24.1) [template = f64] -// CHECK:STDOUT: %.loc11_24.2: type = value_of_initializer %float.make_type.loc11 [template = f64] -// CHECK:STDOUT: %.loc11_24.3: type = converted %float.make_type.loc11, %.loc11_24.2 [template = f64] -// CHECK:STDOUT: %.loc11_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc15: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_15.1: type = value_of_initializer %int.make_type_32.loc15 [template = i32] +// CHECK:STDOUT: %.loc15_15.2: type = converted %int.make_type_32.loc15, %.loc15_15.1 [template = i32] +// CHECK:STDOUT: %.loc15_24.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc15: init type = call constants.%struct.3(%.loc15_24.1) [template = f64] +// CHECK:STDOUT: %.loc15_24.2: type = value_of_initializer %float.make_type.loc15 [template = f64] +// CHECK:STDOUT: %.loc15_24.3: type = converted %float.make_type.loc15, %.loc15_24.2 [template = f64] +// CHECK:STDOUT: %.loc15_27: type = struct_type {.a: i32, .b: f64} [template = constants.%.3] // CHECK:STDOUT: %MakeF64.ref: MakeF64 = name_ref MakeF64, file.%MakeF64.decl [template = constants.%struct.4] // CHECK:STDOUT: %MakeF64.call: init f64 = call %MakeF64.ref() // CHECK:STDOUT: %MakeI32.ref: MakeI32 = name_ref MakeI32, file.%MakeI32.decl [template = constants.%struct.2] // CHECK:STDOUT: %MakeI32.call: init i32 = call %MakeI32.ref() -// CHECK:STDOUT: %.loc11_62.1: {.b: f64, .a: i32} = struct_literal (%MakeF64.call, %MakeI32.call) -// CHECK:STDOUT: %.loc11_62.2: i32 = value_of_initializer %MakeI32.call -// CHECK:STDOUT: %.loc11_62.3: i32 = converted %MakeI32.call, %.loc11_62.2 -// CHECK:STDOUT: %.loc11_62.4: f64 = value_of_initializer %MakeF64.call -// CHECK:STDOUT: %.loc11_62.5: f64 = converted %MakeF64.call, %.loc11_62.4 -// CHECK:STDOUT: %struct.loc11: {.a: i32, .b: f64} = struct_value (%.loc11_62.3, %.loc11_62.5) -// CHECK:STDOUT: %.loc11_63: {.a: i32, .b: f64} = converted %.loc11_62.1, %struct.loc11 -// CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc11_63 -// CHECK:STDOUT: %.loc12_15.1: i32 = int_literal 64 [template = constants.%.2] -// CHECK:STDOUT: %float.make_type.loc12: init type = call constants.%struct.3(%.loc12_15.1) [template = f64] -// CHECK:STDOUT: %.loc12_15.2: type = value_of_initializer %float.make_type.loc12 [template = f64] -// CHECK:STDOUT: %.loc12_15.3: type = converted %float.make_type.loc12, %.loc12_15.2 [template = f64] -// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc12_24.1: type = value_of_initializer %int.make_type_32.loc12 [template = i32] -// CHECK:STDOUT: %.loc12_24.2: type = converted %int.make_type_32.loc12, %.loc12_24.1 [template = i32] -// CHECK:STDOUT: %.loc12_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.5] +// CHECK:STDOUT: %.loc15_62.1: {.b: f64, .a: i32} = struct_literal (%MakeF64.call, %MakeI32.call) +// CHECK:STDOUT: %.loc15_62.2: i32 = value_of_initializer %MakeI32.call +// CHECK:STDOUT: %.loc15_62.3: i32 = converted %MakeI32.call, %.loc15_62.2 +// CHECK:STDOUT: %.loc15_62.4: f64 = value_of_initializer %MakeF64.call +// CHECK:STDOUT: %.loc15_62.5: f64 = converted %MakeF64.call, %.loc15_62.4 +// CHECK:STDOUT: %struct.loc15: {.a: i32, .b: f64} = struct_value (%.loc15_62.3, %.loc15_62.5) +// CHECK:STDOUT: %.loc15_63: {.a: i32, .b: f64} = converted %.loc15_62.1, %struct.loc15 +// CHECK:STDOUT: %x: {.a: i32, .b: f64} = bind_name x, %.loc15_63 +// CHECK:STDOUT: %.loc16_15.1: i32 = int_literal 64 [template = constants.%.2] +// CHECK:STDOUT: %float.make_type.loc16: init type = call constants.%struct.3(%.loc16_15.1) [template = f64] +// CHECK:STDOUT: %.loc16_15.2: type = value_of_initializer %float.make_type.loc16 [template = f64] +// CHECK:STDOUT: %.loc16_15.3: type = converted %float.make_type.loc16, %.loc16_15.2 [template = f64] +// CHECK:STDOUT: %int.make_type_32.loc16: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc16_24.1: type = value_of_initializer %int.make_type_32.loc16 [template = i32] +// CHECK:STDOUT: %.loc16_24.2: type = converted %int.make_type_32.loc16, %.loc16_24.1 [template = i32] +// CHECK:STDOUT: %.loc16_27: type = struct_type {.b: f64, .a: i32} [template = constants.%.5] // CHECK:STDOUT: %x.ref: {.a: i32, .b: f64} = name_ref x, %x -// CHECK:STDOUT: %.loc12_31.1: f64 = struct_access %x.ref, element1 -// CHECK:STDOUT: %.loc12_31.2: i32 = struct_access %x.ref, element0 -// CHECK:STDOUT: %struct.loc12: {.b: f64, .a: i32} = struct_value (%.loc12_31.1, %.loc12_31.2) -// CHECK:STDOUT: %.loc12_32: {.b: f64, .a: i32} = converted %x.ref, %struct.loc12 -// CHECK:STDOUT: %y: {.b: f64, .a: i32} = bind_name y, %.loc12_32 +// CHECK:STDOUT: %.loc16_31.1: f64 = struct_access %x.ref, element1 +// CHECK:STDOUT: %.loc16_31.2: i32 = struct_access %x.ref, element0 +// CHECK:STDOUT: %struct.loc16: {.b: f64, .a: i32} = struct_value (%.loc16_31.1, %.loc16_31.2) +// CHECK:STDOUT: %.loc16_32: {.b: f64, .a: i32} = converted %x.ref, %struct.loc16 +// CHECK:STDOUT: %y: {.b: f64, .a: i32} = bind_name y, %.loc16_32 // CHECK:STDOUT: %y.ref: {.b: f64, .a: i32} = name_ref y, %y -// CHECK:STDOUT: %.loc13_10.1: i32 = struct_access %y.ref, element1 -// CHECK:STDOUT: %.loc13_10.2: ref i32 = struct_access %return, element1 -// CHECK:STDOUT: %.loc13_10.3: init i32 = initialize_from %.loc13_10.1 to %.loc13_10.2 -// CHECK:STDOUT: %.loc13_10.4: f64 = struct_access %y.ref, element0 -// CHECK:STDOUT: %.loc13_10.5: ref f64 = struct_access %return, element0 -// CHECK:STDOUT: %.loc13_10.6: init f64 = initialize_from %.loc13_10.4 to %.loc13_10.5 -// CHECK:STDOUT: %.loc13_10.7: init {.a: i32, .b: f64} = struct_init (%.loc13_10.3, %.loc13_10.6) to %return -// CHECK:STDOUT: %.loc13_11: init {.a: i32, .b: f64} = converted %y.ref, %.loc13_10.7 -// CHECK:STDOUT: return %.loc13_11 to %return +// CHECK:STDOUT: %.loc17_10.1: i32 = struct_access %y.ref, element1 +// CHECK:STDOUT: %.loc17_10.2: ref i32 = struct_access %return, element1 +// CHECK:STDOUT: %.loc17_10.3: init i32 = initialize_from %.loc17_10.1 to %.loc17_10.2 +// CHECK:STDOUT: %.loc17_10.4: f64 = struct_access %y.ref, element0 +// CHECK:STDOUT: %.loc17_10.5: ref f64 = struct_access %return, element0 +// CHECK:STDOUT: %.loc17_10.6: init f64 = initialize_from %.loc17_10.4 to %.loc17_10.5 +// CHECK:STDOUT: %.loc17_10.7: init {.a: i32, .b: f64} = struct_init (%.loc17_10.3, %.loc17_10.6) to %return +// CHECK:STDOUT: %.loc17_11: init {.a: i32, .b: f64} = converted %y.ref, %.loc17_10.7 +// CHECK:STDOUT: return %.loc17_11 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index bcd0101623c5..158daa1b9f84 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/tuple_as_element.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/tuple_as_element.carbon var x: {.a: i32, .b: (i32,)} = {.a = 1, .b = (2,)}; var y: {.a: i32, .b: (i32,)} = x; @@ -31,29 +35,29 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7_13 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7_13, %.loc7_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11_13 [template = i32] +// CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11_13, %.loc11_13.1 [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_27.1: (type,) = tuple_literal (%int.make_type_32.loc7_23) -// CHECK:STDOUT: %.loc7_27.2: type = value_of_initializer %int.make_type_32.loc7_23 [template = i32] -// CHECK:STDOUT: %.loc7_27.3: type = converted %int.make_type_32.loc7_23, %.loc7_27.2 [template = i32] -// CHECK:STDOUT: %.loc7_27.4: type = converted %.loc7_27.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc11_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_27.1: (type,) = tuple_literal (%int.make_type_32.loc11_23) +// CHECK:STDOUT: %.loc11_27.2: type = value_of_initializer %int.make_type_32.loc11_23 [template = i32] +// CHECK:STDOUT: %.loc11_27.3: type = converted %int.make_type_32.loc11_23, %.loc11_27.2 [template = i32] +// CHECK:STDOUT: %.loc11_27.4: type = converted %.loc11_27.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] // CHECK:STDOUT: %x.var: ref {.a: i32, .b: (i32,)} = var x // CHECK:STDOUT: %x: ref {.a: i32, .b: (i32,)} = bind_name x, %x.var // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8_13 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8_13, %.loc8_13.1 [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc12_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12_13 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12_13, %.loc12_13.1 [template = i32] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8_23: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_27.1: (type,) = tuple_literal (%int.make_type_32.loc8_23) -// CHECK:STDOUT: %.loc8_27.2: type = value_of_initializer %int.make_type_32.loc8_23 [template = i32] -// CHECK:STDOUT: %.loc8_27.3: type = converted %int.make_type_32.loc8_23, %.loc8_27.2 [template = i32] -// CHECK:STDOUT: %.loc8_27.4: type = converted %.loc8_27.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] +// CHECK:STDOUT: %int.make_type_32.loc12_23: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_27.1: (type,) = tuple_literal (%int.make_type_32.loc12_23) +// CHECK:STDOUT: %.loc12_27.2: type = value_of_initializer %int.make_type_32.loc12_23 [template = i32] +// CHECK:STDOUT: %.loc12_27.3: type = converted %int.make_type_32.loc12_23, %.loc12_27.2 [template = i32] +// CHECK:STDOUT: %.loc12_27.4: type = converted %.loc12_27.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc12_28: type = struct_type {.a: i32, .b: (i32,)} [template = constants.%.4] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: (i32,)} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: (i32,)} = bind_name y, %y.var // CHECK:STDOUT: } @@ -62,34 +66,34 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_38: i32 = int_literal 1 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_47: i32 = int_literal 2 [template = constants.%.7] -// CHECK:STDOUT: %.loc7_49.1: (i32,) = tuple_literal (%.loc7_47) -// CHECK:STDOUT: %.loc7_50.1: {.a: i32, .b: (i32,)} = struct_literal (%.loc7_38, %.loc7_49.1) -// CHECK:STDOUT: %.loc7_50.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_50.3: init i32 = initialize_from %.loc7_38 to %.loc7_50.2 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_50.4: ref (i32,) = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc7_49.2: init (i32,) = tuple_init (%.loc7_47) to %.loc7_50.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_50.5: init (i32,) = converted %.loc7_49.1, %.loc7_49.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_50.6: init (i32,) = initialize_from %.loc7_50.5 to %.loc7_50.4 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_50.7: init {.a: i32, .b: (i32,)} = struct_init (%.loc7_50.3, %.loc7_50.6) to file.%x.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_51: init {.a: i32, .b: (i32,)} = converted %.loc7_50.1, %.loc7_50.7 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%x.var, %.loc7_51 +// CHECK:STDOUT: %.loc11_38: i32 = int_literal 1 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_47: i32 = int_literal 2 [template = constants.%.7] +// CHECK:STDOUT: %.loc11_49.1: (i32,) = tuple_literal (%.loc11_47) +// CHECK:STDOUT: %.loc11_50.1: {.a: i32, .b: (i32,)} = struct_literal (%.loc11_38, %.loc11_49.1) +// CHECK:STDOUT: %.loc11_50.2: ref i32 = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_50.3: init i32 = initialize_from %.loc11_38 to %.loc11_50.2 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_50.4: ref (i32,) = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_49.2: init (i32,) = tuple_init (%.loc11_47) to %.loc11_50.4 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.5: init (i32,) = converted %.loc11_49.1, %.loc11_49.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.6: init (i32,) = initialize_from %.loc11_50.5 to %.loc11_50.4 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_50.7: init {.a: i32, .b: (i32,)} = struct_init (%.loc11_50.3, %.loc11_50.6) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc11_51: init {.a: i32, .b: (i32,)} = converted %.loc11_50.1, %.loc11_50.7 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%x.var, %.loc11_51 // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: (i32,)} = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_32.1: ref i32 = struct_access %x.ref, element0 -// CHECK:STDOUT: %.loc8_32.2: i32 = bind_value %.loc8_32.1 -// CHECK:STDOUT: %.loc8_32.3: ref i32 = struct_access file.%y.var, element0 -// CHECK:STDOUT: %.loc8_32.4: init i32 = initialize_from %.loc8_32.2 to %.loc8_32.3 -// CHECK:STDOUT: %.loc8_32.5: ref (i32,) = struct_access %x.ref, element1 -// CHECK:STDOUT: %.loc8_32.6: ref i32 = tuple_access %.loc8_32.5, element0 -// CHECK:STDOUT: %.loc8_32.7: i32 = bind_value %.loc8_32.6 -// CHECK:STDOUT: %.loc8_32.8: ref (i32,) = struct_access file.%y.var, element1 -// CHECK:STDOUT: %.loc8_32.9: init (i32,) = tuple_init (%.loc8_32.7) to %.loc8_32.8 -// CHECK:STDOUT: %.loc8_32.10: init (i32,) = converted %.loc8_32.5, %.loc8_32.9 -// CHECK:STDOUT: %.loc8_32.11: init (i32,) = initialize_from %.loc8_32.10 to %.loc8_32.8 -// CHECK:STDOUT: %.loc8_32.12: init {.a: i32, .b: (i32,)} = struct_init (%.loc8_32.4, %.loc8_32.11) to file.%y.var -// CHECK:STDOUT: %.loc8_33: init {.a: i32, .b: (i32,)} = converted %x.ref, %.loc8_32.12 -// CHECK:STDOUT: assign file.%y.var, %.loc8_33 +// CHECK:STDOUT: %.loc12_32.1: ref i32 = struct_access %x.ref, element0 +// CHECK:STDOUT: %.loc12_32.2: i32 = bind_value %.loc12_32.1 +// CHECK:STDOUT: %.loc12_32.3: ref i32 = struct_access file.%y.var, element0 +// CHECK:STDOUT: %.loc12_32.4: init i32 = initialize_from %.loc12_32.2 to %.loc12_32.3 +// CHECK:STDOUT: %.loc12_32.5: ref (i32,) = struct_access %x.ref, element1 +// CHECK:STDOUT: %.loc12_32.6: ref i32 = tuple_access %.loc12_32.5, element0 +// CHECK:STDOUT: %.loc12_32.7: i32 = bind_value %.loc12_32.6 +// CHECK:STDOUT: %.loc12_32.8: ref (i32,) = struct_access file.%y.var, element1 +// CHECK:STDOUT: %.loc12_32.9: init (i32,) = tuple_init (%.loc12_32.7) to %.loc12_32.8 +// CHECK:STDOUT: %.loc12_32.10: init (i32,) = converted %.loc12_32.5, %.loc12_32.9 +// CHECK:STDOUT: %.loc12_32.11: init (i32,) = initialize_from %.loc12_32.10 to %.loc12_32.8 +// CHECK:STDOUT: %.loc12_32.12: init {.a: i32, .b: (i32,)} = struct_init (%.loc12_32.4, %.loc12_32.11) to file.%y.var +// CHECK:STDOUT: %.loc12_33: init {.a: i32, .b: (i32,)} = converted %x.ref, %.loc12_32.12 +// CHECK:STDOUT: assign file.%y.var, %.loc12_33 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index 6ed6a4eb58d8..3f435696d751 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/two_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/two_entries.carbon let v: {.a: i32, .b: i32} = {.a = 1, .b = 2}; let w: {.a: i32, .b: i32} = v; @@ -31,51 +35,51 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: type = value_of_initializer %int.make_type_32.loc7_13 [template = i32] -// CHECK:STDOUT: %.loc7_13.2: type = converted %int.make_type_32.loc7_13, %.loc7_13.1 [template = i32] -// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_22.1: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32] -// CHECK:STDOUT: %.loc7_22.2: type = converted %int.make_type_32.loc7_22, %.loc7_22.1 [template = i32] -// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] -// CHECK:STDOUT: %.loc7_35: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_43: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_44: {.a: i32, .b: i32} = struct_literal (%.loc7_35, %.loc7_43) -// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc7_35, %.loc7_43) [template = constants.%struct.2] -// CHECK:STDOUT: %.loc7_45: {.a: i32, .b: i32} = converted %.loc7_44, %struct [template = constants.%struct.2] -// CHECK:STDOUT: %v: {.a: i32, .b: i32} = bind_name v, %.loc7_45 -// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8_13 [template = i32] -// CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8_13, %.loc8_13.1 [template = i32] -// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc8_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc8_22.1: type = value_of_initializer %int.make_type_32.loc8_22 [template = i32] -// CHECK:STDOUT: %.loc8_22.2: type = converted %int.make_type_32.loc8_22, %.loc8_22.1 [template = i32] -// CHECK:STDOUT: %.loc8_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] -// CHECK:STDOUT: %v.ref: {.a: i32, .b: i32} = name_ref v, %v -// CHECK:STDOUT: %w: {.a: i32, .b: i32} = bind_name w, %v.ref -// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc10_13: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_13.1: type = value_of_initializer %int.make_type_32.loc10_13 [template = i32] -// CHECK:STDOUT: %.loc10_13.2: type = converted %int.make_type_32.loc10_13, %.loc10_13.1 [template = i32] -// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] -// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_22.1: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] -// CHECK:STDOUT: %.loc10_22.2: type = converted %int.make_type_32.loc10_22, %.loc10_22.1 [template = i32] -// CHECK:STDOUT: %.loc10_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] -// CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x -// CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var -// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32.loc11_13: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %int.make_type_32.loc11_13 [template = i32] // CHECK:STDOUT: %.loc11_13.2: type = converted %int.make_type_32.loc11_13, %.loc11_13.1 [template = i32] -// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] // CHECK:STDOUT: %.loc11_22.1: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] // CHECK:STDOUT: %.loc11_22.2: type = converted %int.make_type_32.loc11_22, %.loc11_22.1 [template = i32] // CHECK:STDOUT: %.loc11_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_35: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_43: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_44: {.a: i32, .b: i32} = struct_literal (%.loc11_35, %.loc11_43) +// CHECK:STDOUT: %struct: {.a: i32, .b: i32} = struct_value (%.loc11_35, %.loc11_43) [template = constants.%struct.2] +// CHECK:STDOUT: %.loc11_45: {.a: i32, .b: i32} = converted %.loc11_44, %struct [template = constants.%struct.2] +// CHECK:STDOUT: %v: {.a: i32, .b: i32} = bind_name v, %.loc11_45 +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc12_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32.loc12_13 [template = i32] +// CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32.loc12_13, %.loc12_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc12_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc12_22.1: type = value_of_initializer %int.make_type_32.loc12_22 [template = i32] +// CHECK:STDOUT: %.loc12_22.2: type = converted %int.make_type_32.loc12_22, %.loc12_22.1 [template = i32] +// CHECK:STDOUT: %.loc12_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %v.ref: {.a: i32, .b: i32} = name_ref v, %v +// CHECK:STDOUT: %w: {.a: i32, .b: i32} = bind_name w, %v.ref +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc14_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14_13 [template = i32] +// CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14_13, %.loc14_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_22.1: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_22.2: type = converted %int.make_type_32.loc14_22, %.loc14_22.1 [template = i32] +// CHECK:STDOUT: %.loc14_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] +// CHECK:STDOUT: %x.var: ref {.a: i32, .b: i32} = var x +// CHECK:STDOUT: %x: ref {.a: i32, .b: i32} = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15_13: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_13.1: type = value_of_initializer %int.make_type_32.loc15_13 [template = i32] +// CHECK:STDOUT: %.loc15_13.2: type = converted %int.make_type_32.loc15_13, %.loc15_13.1 [template = i32] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] +// CHECK:STDOUT: %int.make_type_32.loc15_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc15_22.1: type = value_of_initializer %int.make_type_32.loc15_22 [template = i32] +// CHECK:STDOUT: %.loc15_22.2: type = converted %int.make_type_32.loc15_22, %.loc15_22.1 [template = i32] +// CHECK:STDOUT: %.loc15_25: type = struct_type {.a: i32, .b: i32} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.a: i32, .b: i32} = var y // CHECK:STDOUT: %y: ref {.a: i32, .b: i32} = bind_name y, %y.var // CHECK:STDOUT: } @@ -84,28 +88,28 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_35: i32 = int_literal 1 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_44.1: {.a: i32, .b: i32} = struct_literal (%.loc10_35, %.loc10_43) -// CHECK:STDOUT: %.loc10_44.2: ref i32 = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_44.3: init i32 = initialize_from %.loc10_35 to %.loc10_44.2 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_44.4: ref i32 = struct_access file.%x.var, element1 -// CHECK:STDOUT: %.loc10_44.5: init i32 = initialize_from %.loc10_43 to %.loc10_44.4 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_44.6: init {.a: i32, .b: i32} = struct_init (%.loc10_44.3, %.loc10_44.5) to file.%x.var [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_45: init {.a: i32, .b: i32} = converted %.loc10_44.1, %.loc10_44.6 [template = constants.%struct.2] -// CHECK:STDOUT: assign file.%x.var, %.loc10_45 +// CHECK:STDOUT: %.loc14_35: i32 = int_literal 1 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_43: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_44.1: {.a: i32, .b: i32} = struct_literal (%.loc14_35, %.loc14_43) +// CHECK:STDOUT: %.loc14_44.2: ref i32 = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc14_44.3: init i32 = initialize_from %.loc14_35 to %.loc14_44.2 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_44.4: ref i32 = struct_access file.%x.var, element1 +// CHECK:STDOUT: %.loc14_44.5: init i32 = initialize_from %.loc14_43 to %.loc14_44.4 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_44.6: init {.a: i32, .b: i32} = struct_init (%.loc14_44.3, %.loc14_44.5) to file.%x.var [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_45: init {.a: i32, .b: i32} = converted %.loc14_44.1, %.loc14_44.6 [template = constants.%struct.2] +// CHECK:STDOUT: assign file.%x.var, %.loc14_45 // CHECK:STDOUT: %x.ref: ref {.a: i32, .b: i32} = name_ref x, file.%x -// CHECK:STDOUT: %.loc11_29.1: ref i32 = struct_access %x.ref, element0 -// CHECK:STDOUT: %.loc11_29.2: i32 = bind_value %.loc11_29.1 -// CHECK:STDOUT: %.loc11_29.3: ref i32 = struct_access file.%y.var, element0 -// CHECK:STDOUT: %.loc11_29.4: init i32 = initialize_from %.loc11_29.2 to %.loc11_29.3 -// CHECK:STDOUT: %.loc11_29.5: ref i32 = struct_access %x.ref, element1 -// CHECK:STDOUT: %.loc11_29.6: i32 = bind_value %.loc11_29.5 -// CHECK:STDOUT: %.loc11_29.7: ref i32 = struct_access file.%y.var, element1 -// CHECK:STDOUT: %.loc11_29.8: init i32 = initialize_from %.loc11_29.6 to %.loc11_29.7 -// CHECK:STDOUT: %.loc11_29.9: init {.a: i32, .b: i32} = struct_init (%.loc11_29.4, %.loc11_29.8) to file.%y.var -// CHECK:STDOUT: %.loc11_30: init {.a: i32, .b: i32} = converted %x.ref, %.loc11_29.9 -// CHECK:STDOUT: assign file.%y.var, %.loc11_30 +// CHECK:STDOUT: %.loc15_29.1: ref i32 = struct_access %x.ref, element0 +// CHECK:STDOUT: %.loc15_29.2: i32 = bind_value %.loc15_29.1 +// CHECK:STDOUT: %.loc15_29.3: ref i32 = struct_access file.%y.var, element0 +// CHECK:STDOUT: %.loc15_29.4: init i32 = initialize_from %.loc15_29.2 to %.loc15_29.3 +// CHECK:STDOUT: %.loc15_29.5: ref i32 = struct_access %x.ref, element1 +// CHECK:STDOUT: %.loc15_29.6: i32 = bind_value %.loc15_29.5 +// CHECK:STDOUT: %.loc15_29.7: ref i32 = struct_access file.%y.var, element1 +// CHECK:STDOUT: %.loc15_29.8: init i32 = initialize_from %.loc15_29.6 to %.loc15_29.7 +// CHECK:STDOUT: %.loc15_29.9: init {.a: i32, .b: i32} = struct_init (%.loc15_29.4, %.loc15_29.8) to file.%y.var +// CHECK:STDOUT: %.loc15_30: init {.a: i32, .b: i32} = converted %x.ref, %.loc15_29.9 +// CHECK:STDOUT: assign file.%y.var, %.loc15_30 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/fail_assign_nested.carbon b/toolchain/check/testdata/tuples/fail_assign_nested.carbon index 18d8f66701c8..4c922fb17208 100644 --- a/toolchain/check/testdata/tuples/fail_assign_nested.carbon +++ b/toolchain/check/testdata/tuples/fail_assign_nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_assign_nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_assign_nested.carbon // CHECK:STDERR: fail_assign_nested.carbon:[[@LINE+3]]:36: ERROR: Cannot initialize tuple of 2 element(s) from tuple with 3 element(s). // CHECK:STDERR: var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); @@ -39,27 +43,27 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_10: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_10: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_15: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_18: (type, type) = tuple_literal (%int.make_type_32.loc10_10, %int.make_type_32.loc10_15) +// CHECK:STDOUT: %int.make_type_32.loc14_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_18: (type, type) = tuple_literal (%int.make_type_32.loc14_10, %int.make_type_32.loc14_15) // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_27: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_30: (type, type) = tuple_literal (%int.make_type_32.loc10_22, %int.make_type_32.loc10_27) -// CHECK:STDOUT: %.loc10_31.1: ((type, type), (type, type)) = tuple_literal (%.loc10_18, %.loc10_30) -// CHECK:STDOUT: %.loc10_31.2: type = value_of_initializer %int.make_type_32.loc10_10 [template = i32] -// CHECK:STDOUT: %.loc10_31.3: type = converted %int.make_type_32.loc10_10, %.loc10_31.2 [template = i32] -// CHECK:STDOUT: %.loc10_31.4: type = value_of_initializer %int.make_type_32.loc10_15 [template = i32] -// CHECK:STDOUT: %.loc10_31.5: type = converted %int.make_type_32.loc10_15, %.loc10_31.4 [template = i32] -// CHECK:STDOUT: %.loc10_31.6: type = converted %.loc10_18, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_31.7: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] -// CHECK:STDOUT: %.loc10_31.8: type = converted %int.make_type_32.loc10_22, %.loc10_31.7 [template = i32] -// CHECK:STDOUT: %.loc10_31.9: type = value_of_initializer %int.make_type_32.loc10_27 [template = i32] -// CHECK:STDOUT: %.loc10_31.10: type = converted %int.make_type_32.loc10_27, %.loc10_31.9 [template = i32] -// CHECK:STDOUT: %.loc10_31.11: type = converted %.loc10_30, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc10_31.12: type = converted %.loc10_31.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_30: (type, type) = tuple_literal (%int.make_type_32.loc14_22, %int.make_type_32.loc14_27) +// CHECK:STDOUT: %.loc14_31.1: ((type, type), (type, type)) = tuple_literal (%.loc14_18, %.loc14_30) +// CHECK:STDOUT: %.loc14_31.2: type = value_of_initializer %int.make_type_32.loc14_10 [template = i32] +// CHECK:STDOUT: %.loc14_31.3: type = converted %int.make_type_32.loc14_10, %.loc14_31.2 [template = i32] +// CHECK:STDOUT: %.loc14_31.4: type = value_of_initializer %int.make_type_32.loc14_15 [template = i32] +// CHECK:STDOUT: %.loc14_31.5: type = converted %int.make_type_32.loc14_15, %.loc14_31.4 [template = i32] +// CHECK:STDOUT: %.loc14_31.6: type = converted %.loc14_18, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_31.7: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_31.8: type = converted %int.make_type_32.loc14_22, %.loc14_31.7 [template = i32] +// CHECK:STDOUT: %.loc14_31.9: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] +// CHECK:STDOUT: %.loc14_31.10: type = converted %int.make_type_32.loc14_27, %.loc14_31.9 [template = i32] +// CHECK:STDOUT: %.loc14_31.11: type = converted %.loc14_30, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc14_31.12: type = converted %.loc14_31.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %x.var: ref ((i32, i32), (i32, i32)) = var x // CHECK:STDOUT: %x: ref ((i32, i32), (i32, i32)) = bind_name x, %x.var // CHECK:STDOUT: } @@ -68,15 +72,15 @@ var x: ((i32, i32), (i32, i32)) = ((1, 2, 3), (4, 5, 6)); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_37: i32 = int_literal 1 [template = constants.%.9] -// CHECK:STDOUT: %.loc10_40: i32 = int_literal 2 [template = constants.%.10] -// CHECK:STDOUT: %.loc10_43: i32 = int_literal 3 [template = constants.%.11] -// CHECK:STDOUT: %.loc10_44: (i32, i32, i32) = tuple_literal (%.loc10_37, %.loc10_40, %.loc10_43) -// CHECK:STDOUT: %.loc10_48: i32 = int_literal 4 [template = constants.%.13] -// CHECK:STDOUT: %.loc10_51: i32 = int_literal 5 [template = constants.%.14] -// CHECK:STDOUT: %.loc10_54: i32 = int_literal 6 [template = constants.%.15] -// CHECK:STDOUT: %.loc10_55: (i32, i32, i32) = tuple_literal (%.loc10_48, %.loc10_51, %.loc10_54) -// CHECK:STDOUT: %.loc10_56: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc10_44, %.loc10_55) +// CHECK:STDOUT: %.loc14_37: i32 = int_literal 1 [template = constants.%.9] +// CHECK:STDOUT: %.loc14_40: i32 = int_literal 2 [template = constants.%.10] +// CHECK:STDOUT: %.loc14_43: i32 = int_literal 3 [template = constants.%.11] +// CHECK:STDOUT: %.loc14_44: (i32, i32, i32) = tuple_literal (%.loc14_37, %.loc14_40, %.loc14_43) +// CHECK:STDOUT: %.loc14_48: i32 = int_literal 4 [template = constants.%.13] +// CHECK:STDOUT: %.loc14_51: i32 = int_literal 5 [template = constants.%.14] +// CHECK:STDOUT: %.loc14_54: i32 = int_literal 6 [template = constants.%.15] +// CHECK:STDOUT: %.loc14_55: (i32, i32, i32) = tuple_literal (%.loc14_48, %.loc14_51, %.loc14_54) +// CHECK:STDOUT: %.loc14_56: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%.loc14_44, %.loc14_55) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon index 18e06f464f40..97830a6e00fa 100644 --- a/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon +++ b/toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_element_type_mismatch.carbon // CHECK:STDERR: fail_element_type_mismatch.carbon:[[@LINE+3]]:21: ERROR: Cannot implicitly convert from `f64` to `i32`. // CHECK:STDERR: var x: (i32, i32) = (2, 65.89); @@ -30,15 +34,15 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) -// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] -// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] -// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] -// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] -// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: (type, type) = tuple_literal (%int.make_type_32.loc14_9, %int.make_type_32.loc14_14) +// CHECK:STDOUT: %.loc14_17.2: type = value_of_initializer %int.make_type_32.loc14_9 [template = i32] +// CHECK:STDOUT: %.loc14_17.3: type = converted %int.make_type_32.loc14_9, %.loc14_17.2 [template = i32] +// CHECK:STDOUT: %.loc14_17.4: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32] +// CHECK:STDOUT: %.loc14_17.5: type = converted %int.make_type_32.loc14_14, %.loc14_17.4 [template = i32] +// CHECK:STDOUT: %.loc14_17.6: type = converted %.loc14_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var // CHECK:STDOUT: } @@ -47,11 +51,11 @@ var x: (i32, i32) = (2, 65.89); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_25: f64 = float_literal 65.890000000000001 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_30.1: (i32, f64) = tuple_literal (%.loc10_22, %.loc10_25) -// CHECK:STDOUT: %.loc10_30.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_30.3: init i32 = initialize_from %.loc10_22 to %.loc10_30.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_22: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_25: f64 = float_literal 65.890000000000001 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_30.1: (i32, f64) = tuple_literal (%.loc14_22, %.loc14_25) +// CHECK:STDOUT: %.loc14_30.2: ref i32 = tuple_access file.%x.var, element0 +// CHECK:STDOUT: %.loc14_30.3: init i32 = initialize_from %.loc14_22 to %.loc14_30.2 [template = constants.%.5] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon index faf870e880f9..e05eb05886c4 100644 --- a/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/tuples/fail_nested_incomplete.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_nested_incomplete.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_nested_incomplete.carbon class Incomplete; @@ -40,15 +44,15 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: %Incomplete.decl: type = class_decl @Incomplete [template = constants.%Incomplete] {} // CHECK:STDOUT: %import_ref: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %Incomplete.ref.loc15: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc15_24.1: (type, type) = tuple_literal (%int.make_type_32, %Incomplete.ref.loc15) -// CHECK:STDOUT: %.loc15_24.2: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc15_24.3: type = converted %int.make_type_32, %.loc15_24.2 [template = i32] -// CHECK:STDOUT: %.loc15_24.4: type = converted %.loc15_24.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %Incomplete.ref.loc19: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc19_24.1: (type, type) = tuple_literal (%int.make_type_32, %Incomplete.ref.loc19) +// CHECK:STDOUT: %.loc19_24.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc19_24.3: type = converted %int.make_type_32, %.loc19_24.2 [template = i32] +// CHECK:STDOUT: %.loc19_24.4: type = converted %.loc19_24.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %t.var: ref = var t // CHECK:STDOUT: %t: ref = bind_name t, %t.var -// CHECK:STDOUT: %Incomplete.ref.loc17: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] -// CHECK:STDOUT: %.loc17: type = ptr_type Incomplete [template = constants.%.4] +// CHECK:STDOUT: %Incomplete.ref.loc21: type = name_ref Incomplete, %Incomplete.decl [template = constants.%Incomplete] +// CHECK:STDOUT: %.loc21: type = ptr_type Incomplete [template = constants.%.4] // CHECK:STDOUT: %p.var: ref Incomplete* = var p // CHECK:STDOUT: %p: ref Incomplete* = bind_name p, %p.var // CHECK:STDOUT: } @@ -60,8 +64,8 @@ var p: Incomplete* = &t[1]; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %t.ref: ref = name_ref t, file.%t -// CHECK:STDOUT: %.loc17_25: i32 = int_literal 1 [template = constants.%.5] -// CHECK:STDOUT: %.loc17_22: = addr_of [template = ] +// CHECK:STDOUT: %.loc21_25: i32 = int_literal 1 [template = constants.%.5] +// CHECK:STDOUT: %.loc21_22: = addr_of [template = ] // CHECK:STDOUT: assign file.%p.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_too_few_element.carbon b/toolchain/check/testdata/tuples/fail_too_few_element.carbon index f19389a45790..c8511b4d1326 100644 --- a/toolchain/check/testdata/tuples/fail_too_few_element.carbon +++ b/toolchain/check/testdata/tuples/fail_too_few_element.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_too_few_element.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_too_few_element.carbon // CHECK:STDERR: fail_too_few_element.carbon:[[@LINE+3]]:21: ERROR: Cannot initialize tuple of 2 element(s) from tuple with 1 element(s). // CHECK:STDERR: var x: (i32, i32) = (2, ); @@ -29,15 +33,15 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_9: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) -// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] -// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] -// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] -// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] -// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc14_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: (type, type) = tuple_literal (%int.make_type_32.loc14_9, %int.make_type_32.loc14_14) +// CHECK:STDOUT: %.loc14_17.2: type = value_of_initializer %int.make_type_32.loc14_9 [template = i32] +// CHECK:STDOUT: %.loc14_17.3: type = converted %int.make_type_32.loc14_9, %.loc14_17.2 [template = i32] +// CHECK:STDOUT: %.loc14_17.4: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32] +// CHECK:STDOUT: %.loc14_17.5: type = converted %int.make_type_32.loc14_14, %.loc14_17.4 [template = i32] +// CHECK:STDOUT: %.loc14_17.6: type = converted %.loc14_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32, i32) = var x // CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var // CHECK:STDOUT: } @@ -46,8 +50,8 @@ var x: (i32, i32) = (2, ); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_25: (i32,) = tuple_literal (%.loc10_22) +// CHECK:STDOUT: %.loc14_22: i32 = int_literal 2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_25: (i32,) = tuple_literal (%.loc14_22) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_type_assign.carbon b/toolchain/check/testdata/tuples/fail_type_assign.carbon index f8522afa8b04..165afefb2ef9 100644 --- a/toolchain/check/testdata/tuples/fail_type_assign.carbon +++ b/toolchain/check/testdata/tuples/fail_type_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_type_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_type_assign.carbon // CHECK:STDERR: fail_type_assign.carbon:[[@LINE+3]]:18: ERROR: Cannot implicitly convert from `type` to `i32`. // CHECK:STDERR: var x: (i32, ) = (i32, ); @@ -27,10 +31,10 @@ var x: (i32, ) = (i32, ); // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_14.1: (type,) = tuple_literal (%int.make_type_32) -// CHECK:STDOUT: %.loc10_14.2: type = value_of_initializer %int.make_type_32 [template = i32] -// CHECK:STDOUT: %.loc10_14.3: type = converted %int.make_type_32, %.loc10_14.2 [template = i32] -// CHECK:STDOUT: %.loc10_14.4: type = converted %.loc10_14.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_14.1: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc14_14.2: type = value_of_initializer %int.make_type_32 [template = i32] +// CHECK:STDOUT: %.loc14_14.3: type = converted %int.make_type_32, %.loc14_14.2 [template = i32] +// CHECK:STDOUT: %.loc14_14.4: type = converted %.loc14_14.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] @@ -41,7 +45,7 @@ var x: (i32, ) = (i32, ); // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10: (type,) = tuple_literal (%int.make_type_32) +// CHECK:STDOUT: %.loc14: (type,) = tuple_literal (%int.make_type_32) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/fail_value_as_type.carbon b/toolchain/check/testdata/tuples/fail_value_as_type.carbon index 589c5e6be4d8..c7963ae7b30a 100644 --- a/toolchain/check/testdata/tuples/fail_value_as_type.carbon +++ b/toolchain/check/testdata/tuples/fail_value_as_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/fail_value_as_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/fail_value_as_type.carbon // CHECK:STDERR: fail_value_as_type.carbon:[[@LINE+3]]:8: ERROR: Cannot implicitly convert from `i32` to `type`. // CHECK:STDERR: var x: (1, ); @@ -22,8 +26,8 @@ var x: (1, ); // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc10_9: i32 = int_literal 1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_12: (i32,) = tuple_literal (%.loc10_9) +// CHECK:STDOUT: %.loc14_9: i32 = int_literal 1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_12: (i32,) = tuple_literal (%.loc14_9) // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/import.carbon b/toolchain/check/testdata/tuples/import.carbon index bba8300a2294..e3ea8a113ced 100644 --- a/toolchain/check/testdata/tuples/import.carbon +++ b/toolchain/check/testdata/tuples/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/tuples/nested_tuple.carbon b/toolchain/check/testdata/tuples/nested_tuple.carbon index 9b68c703fb39..c15754095d24 100644 --- a/toolchain/check/testdata/tuples/nested_tuple.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/nested_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/nested_tuple.carbon var x: ((i32, i32), i32) = ((12, 76), 6); @@ -33,21 +37,21 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_10: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_10: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_15: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_18: (type, type) = tuple_literal (%int.make_type_32.loc7_10, %int.make_type_32.loc7_15) +// CHECK:STDOUT: %int.make_type_32.loc11_15: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_18: (type, type) = tuple_literal (%int.make_type_32.loc11_10, %int.make_type_32.loc11_15) // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_21: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_24.1: ((type, type), type) = tuple_literal (%.loc7_18, %int.make_type_32.loc7_21) -// CHECK:STDOUT: %.loc7_24.2: type = value_of_initializer %int.make_type_32.loc7_10 [template = i32] -// CHECK:STDOUT: %.loc7_24.3: type = converted %int.make_type_32.loc7_10, %.loc7_24.2 [template = i32] -// CHECK:STDOUT: %.loc7_24.4: type = value_of_initializer %int.make_type_32.loc7_15 [template = i32] -// CHECK:STDOUT: %.loc7_24.5: type = converted %int.make_type_32.loc7_15, %.loc7_24.4 [template = i32] -// CHECK:STDOUT: %.loc7_24.6: type = converted %.loc7_18, constants.%.4 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_24.7: type = value_of_initializer %int.make_type_32.loc7_21 [template = i32] -// CHECK:STDOUT: %.loc7_24.8: type = converted %int.make_type_32.loc7_21, %.loc7_24.7 [template = i32] -// CHECK:STDOUT: %.loc7_24.9: type = converted %.loc7_24.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc11_21: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_24.1: ((type, type), type) = tuple_literal (%.loc11_18, %int.make_type_32.loc11_21) +// CHECK:STDOUT: %.loc11_24.2: type = value_of_initializer %int.make_type_32.loc11_10 [template = i32] +// CHECK:STDOUT: %.loc11_24.3: type = converted %int.make_type_32.loc11_10, %.loc11_24.2 [template = i32] +// CHECK:STDOUT: %.loc11_24.4: type = value_of_initializer %int.make_type_32.loc11_15 [template = i32] +// CHECK:STDOUT: %.loc11_24.5: type = converted %int.make_type_32.loc11_15, %.loc11_24.4 [template = i32] +// CHECK:STDOUT: %.loc11_24.6: type = converted %.loc11_18, constants.%.4 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_24.7: type = value_of_initializer %int.make_type_32.loc11_21 [template = i32] +// CHECK:STDOUT: %.loc11_24.8: type = converted %int.make_type_32.loc11_21, %.loc11_24.7 [template = i32] +// CHECK:STDOUT: %.loc11_24.9: type = converted %.loc11_24.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %x.var: ref ((i32, i32), i32) = var x // CHECK:STDOUT: %x: ref ((i32, i32), i32) = bind_name x, %x.var // CHECK:STDOUT: } @@ -56,23 +60,23 @@ var x: ((i32, i32), i32) = ((12, 76), 6); // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_30: i32 = int_literal 12 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_34: i32 = int_literal 76 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_36.1: (i32, i32) = tuple_literal (%.loc7_30, %.loc7_34) -// CHECK:STDOUT: %.loc7_39: i32 = int_literal 6 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_40.1: ((i32, i32), i32) = tuple_literal (%.loc7_36.1, %.loc7_39) -// CHECK:STDOUT: %.loc7_40.2: ref (i32, i32) = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_36.2: ref i32 = tuple_access %.loc7_40.2, element0 -// CHECK:STDOUT: %.loc7_36.3: init i32 = initialize_from %.loc7_30 to %.loc7_36.2 [template = constants.%.9] -// CHECK:STDOUT: %.loc7_36.4: ref i32 = tuple_access %.loc7_40.2, element1 -// CHECK:STDOUT: %.loc7_36.5: init i32 = initialize_from %.loc7_34 to %.loc7_36.4 [template = constants.%.10] -// CHECK:STDOUT: %.loc7_36.6: init (i32, i32) = tuple_init (%.loc7_36.3, %.loc7_36.5) to %.loc7_40.2 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc7_40.3: init (i32, i32) = converted %.loc7_36.1, %.loc7_36.6 [template = constants.%tuple.1] -// CHECK:STDOUT: %.loc7_40.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc7_40.5: init i32 = initialize_from %.loc7_39 to %.loc7_40.4 [template = constants.%.11] -// CHECK:STDOUT: %.loc7_40.6: init ((i32, i32), i32) = tuple_init (%.loc7_40.3, %.loc7_40.5) to file.%x.var [template = constants.%tuple.2] -// CHECK:STDOUT: %.loc7_41: init ((i32, i32), i32) = converted %.loc7_40.1, %.loc7_40.6 [template = constants.%tuple.2] -// CHECK:STDOUT: assign file.%x.var, %.loc7_41 +// CHECK:STDOUT: %.loc11_30: i32 = int_literal 12 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_34: i32 = int_literal 76 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_36.1: (i32, i32) = tuple_literal (%.loc11_30, %.loc11_34) +// CHECK:STDOUT: %.loc11_39: i32 = int_literal 6 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_40.1: ((i32, i32), i32) = tuple_literal (%.loc11_36.1, %.loc11_39) +// CHECK:STDOUT: %.loc11_40.2: ref (i32, i32) = tuple_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_36.2: ref i32 = tuple_access %.loc11_40.2, element0 +// CHECK:STDOUT: %.loc11_36.3: init i32 = initialize_from %.loc11_30 to %.loc11_36.2 [template = constants.%.9] +// CHECK:STDOUT: %.loc11_36.4: ref i32 = tuple_access %.loc11_40.2, element1 +// CHECK:STDOUT: %.loc11_36.5: init i32 = initialize_from %.loc11_34 to %.loc11_36.4 [template = constants.%.10] +// CHECK:STDOUT: %.loc11_36.6: init (i32, i32) = tuple_init (%.loc11_36.3, %.loc11_36.5) to %.loc11_40.2 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_40.3: init (i32, i32) = converted %.loc11_36.1, %.loc11_36.6 [template = constants.%tuple.1] +// CHECK:STDOUT: %.loc11_40.4: ref i32 = tuple_access file.%x.var, element1 +// CHECK:STDOUT: %.loc11_40.5: init i32 = initialize_from %.loc11_39 to %.loc11_40.4 [template = constants.%.11] +// CHECK:STDOUT: %.loc11_40.6: init ((i32, i32), i32) = tuple_init (%.loc11_40.3, %.loc11_40.5) to file.%x.var [template = constants.%tuple.2] +// CHECK:STDOUT: %.loc11_41: init ((i32, i32), i32) = converted %.loc11_40.1, %.loc11_40.6 [template = constants.%tuple.2] +// CHECK:STDOUT: assign file.%x.var, %.loc11_41 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon index d8ae17e86813..4a48f31f3728 100644 --- a/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +++ b/toolchain/check/testdata/tuples/nested_tuple_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/nested_tuple_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/nested_tuple_in_place.carbon fn F() -> (i32, i32, i32); @@ -53,17 +57,17 @@ fn H() { // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.2] { -// CHECK:STDOUT: %int.make_type_32.loc7_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc7_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc7_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc7_12, %int.make_type_32.loc7_17, %int.make_type_32.loc7_22) -// CHECK:STDOUT: %.loc7_25.2: type = value_of_initializer %int.make_type_32.loc7_12 [template = i32] -// CHECK:STDOUT: %.loc7_25.3: type = converted %int.make_type_32.loc7_12, %.loc7_25.2 [template = i32] -// CHECK:STDOUT: %.loc7_25.4: type = value_of_initializer %int.make_type_32.loc7_17 [template = i32] -// CHECK:STDOUT: %.loc7_25.5: type = converted %int.make_type_32.loc7_17, %.loc7_25.4 [template = i32] -// CHECK:STDOUT: %.loc7_25.6: type = value_of_initializer %int.make_type_32.loc7_22 [template = i32] -// CHECK:STDOUT: %.loc7_25.7: type = converted %int.make_type_32.loc7_22, %.loc7_25.6 [template = i32] -// CHECK:STDOUT: %.loc7_25.8: type = converted %.loc7_25.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc11_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc11_25.1: (type, type, type) = tuple_literal (%int.make_type_32.loc11_12, %int.make_type_32.loc11_17, %int.make_type_32.loc11_22) +// CHECK:STDOUT: %.loc11_25.2: type = value_of_initializer %int.make_type_32.loc11_12 [template = i32] +// CHECK:STDOUT: %.loc11_25.3: type = converted %int.make_type_32.loc11_12, %.loc11_25.2 [template = i32] +// CHECK:STDOUT: %.loc11_25.4: type = value_of_initializer %int.make_type_32.loc11_17 [template = i32] +// CHECK:STDOUT: %.loc11_25.5: type = converted %int.make_type_32.loc11_17, %.loc11_25.4 [template = i32] +// CHECK:STDOUT: %.loc11_25.6: type = value_of_initializer %int.make_type_32.loc11_22 [template = i32] +// CHECK:STDOUT: %.loc11_25.7: type = converted %int.make_type_32.loc11_22, %.loc11_25.6 [template = i32] +// CHECK:STDOUT: %.loc11_25.8: type = converted %.loc11_25.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: @F.%return: ref (i32, i32, i32) = var // CHECK:STDOUT: } // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.3] {} @@ -87,81 +91,81 @@ fn H() { // CHECK:STDOUT: // CHECK:STDOUT: fn @G() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc10_12: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_25: (type, type, type) = tuple_literal (%int.make_type_32.loc10_12, %int.make_type_32.loc10_17, %int.make_type_32.loc10_22) -// CHECK:STDOUT: %int.make_type_32.loc10_29: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_34: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc10_39: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc10_42: (type, type, type) = tuple_literal (%int.make_type_32.loc10_29, %int.make_type_32.loc10_34, %int.make_type_32.loc10_39) -// CHECK:STDOUT: %.loc10_43.1: ((type, type, type), (type, type, type)) = tuple_literal (%.loc10_25, %.loc10_42) -// CHECK:STDOUT: %.loc10_43.2: type = value_of_initializer %int.make_type_32.loc10_12 [template = i32] -// CHECK:STDOUT: %.loc10_43.3: type = converted %int.make_type_32.loc10_12, %.loc10_43.2 [template = i32] -// CHECK:STDOUT: %.loc10_43.4: type = value_of_initializer %int.make_type_32.loc10_17 [template = i32] -// CHECK:STDOUT: %.loc10_43.5: type = converted %int.make_type_32.loc10_17, %.loc10_43.4 [template = i32] -// CHECK:STDOUT: %.loc10_43.6: type = value_of_initializer %int.make_type_32.loc10_22 [template = i32] -// CHECK:STDOUT: %.loc10_43.7: type = converted %int.make_type_32.loc10_22, %.loc10_43.6 [template = i32] -// CHECK:STDOUT: %.loc10_43.8: type = converted %.loc10_25, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_43.9: type = value_of_initializer %int.make_type_32.loc10_29 [template = i32] -// CHECK:STDOUT: %.loc10_43.10: type = converted %int.make_type_32.loc10_29, %.loc10_43.9 [template = i32] -// CHECK:STDOUT: %.loc10_43.11: type = value_of_initializer %int.make_type_32.loc10_34 [template = i32] -// CHECK:STDOUT: %.loc10_43.12: type = converted %int.make_type_32.loc10_34, %.loc10_43.11 [template = i32] -// CHECK:STDOUT: %.loc10_43.13: type = value_of_initializer %int.make_type_32.loc10_39 [template = i32] -// CHECK:STDOUT: %.loc10_43.14: type = converted %int.make_type_32.loc10_39, %.loc10_43.13 [template = i32] -// CHECK:STDOUT: %.loc10_43.15: type = converted %.loc10_42, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc10_43.16: type = converted %.loc10_43.1, constants.%.5 [template = constants.%.5] +// CHECK:STDOUT: %int.make_type_32.loc14_12: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_25: (type, type, type) = tuple_literal (%int.make_type_32.loc14_12, %int.make_type_32.loc14_17, %int.make_type_32.loc14_22) +// CHECK:STDOUT: %int.make_type_32.loc14_29: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_34: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc14_39: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc14_42: (type, type, type) = tuple_literal (%int.make_type_32.loc14_29, %int.make_type_32.loc14_34, %int.make_type_32.loc14_39) +// CHECK:STDOUT: %.loc14_43.1: ((type, type, type), (type, type, type)) = tuple_literal (%.loc14_25, %.loc14_42) +// CHECK:STDOUT: %.loc14_43.2: type = value_of_initializer %int.make_type_32.loc14_12 [template = i32] +// CHECK:STDOUT: %.loc14_43.3: type = converted %int.make_type_32.loc14_12, %.loc14_43.2 [template = i32] +// CHECK:STDOUT: %.loc14_43.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32] +// CHECK:STDOUT: %.loc14_43.5: type = converted %int.make_type_32.loc14_17, %.loc14_43.4 [template = i32] +// CHECK:STDOUT: %.loc14_43.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] +// CHECK:STDOUT: %.loc14_43.7: type = converted %int.make_type_32.loc14_22, %.loc14_43.6 [template = i32] +// CHECK:STDOUT: %.loc14_43.8: type = converted %.loc14_25, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_43.9: type = value_of_initializer %int.make_type_32.loc14_29 [template = i32] +// CHECK:STDOUT: %.loc14_43.10: type = converted %int.make_type_32.loc14_29, %.loc14_43.9 [template = i32] +// CHECK:STDOUT: %.loc14_43.11: type = value_of_initializer %int.make_type_32.loc14_34 [template = i32] +// CHECK:STDOUT: %.loc14_43.12: type = converted %int.make_type_32.loc14_34, %.loc14_43.11 [template = i32] +// CHECK:STDOUT: %.loc14_43.13: type = value_of_initializer %int.make_type_32.loc14_39 [template = i32] +// CHECK:STDOUT: %.loc14_43.14: type = converted %int.make_type_32.loc14_39, %.loc14_43.13 [template = i32] +// CHECK:STDOUT: %.loc14_43.15: type = converted %.loc14_42, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc14_43.16: type = converted %.loc14_43.1, constants.%.5 [template = constants.%.5] // CHECK:STDOUT: %v.var: ref ((i32, i32, i32), (i32, i32, i32)) = var v // CHECK:STDOUT: %v: ref ((i32, i32, i32), (i32, i32, i32)) = bind_name v, %v.var -// CHECK:STDOUT: %F.ref.loc10_48: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 -// CHECK:STDOUT: %F.call.loc10_49: init (i32, i32, i32) = call %F.ref.loc10_48() to %.loc10_56.1 -// CHECK:STDOUT: %F.ref.loc10_53: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc10_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 -// CHECK:STDOUT: %F.call.loc10_54: init (i32, i32, i32) = call %F.ref.loc10_53() to %.loc10_56.2 -// CHECK:STDOUT: %.loc10_56.3: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc10_49, %F.call.loc10_54) -// CHECK:STDOUT: %.loc10_56.4: init ((i32, i32, i32), (i32, i32, i32)) = tuple_init (%F.call.loc10_49, %F.call.loc10_54) to %v.var -// CHECK:STDOUT: %.loc10_57: init ((i32, i32, i32), (i32, i32, i32)) = converted %.loc10_56.3, %.loc10_56.4 -// CHECK:STDOUT: assign %v.var, %.loc10_57 +// CHECK:STDOUT: %F.ref.loc14_48: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_56.1: ref (i32, i32, i32) = tuple_access %v.var, element0 +// CHECK:STDOUT: %F.call.loc14_49: init (i32, i32, i32) = call %F.ref.loc14_48() to %.loc14_56.1 +// CHECK:STDOUT: %F.ref.loc14_53: F = name_ref F, file.%F.decl [template = constants.%struct.2] +// CHECK:STDOUT: %.loc14_56.2: ref (i32, i32, i32) = tuple_access %v.var, element1 +// CHECK:STDOUT: %F.call.loc14_54: init (i32, i32, i32) = call %F.ref.loc14_53() to %.loc14_56.2 +// CHECK:STDOUT: %.loc14_56.3: ((i32, i32, i32), (i32, i32, i32)) = tuple_literal (%F.call.loc14_49, %F.call.loc14_54) +// CHECK:STDOUT: %.loc14_56.4: init ((i32, i32, i32), (i32, i32, i32)) = tuple_init (%F.call.loc14_49, %F.call.loc14_54) to %v.var +// CHECK:STDOUT: %.loc14_57: init ((i32, i32, i32), (i32, i32, i32)) = converted %.loc14_56.3, %.loc14_56.4 +// CHECK:STDOUT: assign %v.var, %.loc14_57 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @H() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int.make_type_32.loc14_11: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_17: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_22: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %int.make_type_32.loc14_27: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_30: (type, type, type) = tuple_literal (%int.make_type_32.loc14_17, %int.make_type_32.loc14_22, %int.make_type_32.loc14_27) -// CHECK:STDOUT: %int.make_type_32.loc14_33: init type = call constants.%struct.1() [template = i32] -// CHECK:STDOUT: %.loc14_36.1: (type, (type, type, type), type) = tuple_literal (%int.make_type_32.loc14_11, %.loc14_30, %int.make_type_32.loc14_33) -// CHECK:STDOUT: %.loc14_36.2: type = value_of_initializer %int.make_type_32.loc14_11 [template = i32] -// CHECK:STDOUT: %.loc14_36.3: type = converted %int.make_type_32.loc14_11, %.loc14_36.2 [template = i32] -// CHECK:STDOUT: %.loc14_36.4: type = value_of_initializer %int.make_type_32.loc14_17 [template = i32] -// CHECK:STDOUT: %.loc14_36.5: type = converted %int.make_type_32.loc14_17, %.loc14_36.4 [template = i32] -// CHECK:STDOUT: %.loc14_36.6: type = value_of_initializer %int.make_type_32.loc14_22 [template = i32] -// CHECK:STDOUT: %.loc14_36.7: type = converted %int.make_type_32.loc14_22, %.loc14_36.6 [template = i32] -// CHECK:STDOUT: %.loc14_36.8: type = value_of_initializer %int.make_type_32.loc14_27 [template = i32] -// CHECK:STDOUT: %.loc14_36.9: type = converted %int.make_type_32.loc14_27, %.loc14_36.8 [template = i32] -// CHECK:STDOUT: %.loc14_36.10: type = converted %.loc14_30, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc14_36.11: type = value_of_initializer %int.make_type_32.loc14_33 [template = i32] -// CHECK:STDOUT: %.loc14_36.12: type = converted %int.make_type_32.loc14_33, %.loc14_36.11 [template = i32] -// CHECK:STDOUT: %.loc14_36.13: type = converted %.loc14_36.1, constants.%.10 [template = constants.%.10] +// CHECK:STDOUT: %int.make_type_32.loc18_11: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_17: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_22: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %int.make_type_32.loc18_27: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_30: (type, type, type) = tuple_literal (%int.make_type_32.loc18_17, %int.make_type_32.loc18_22, %int.make_type_32.loc18_27) +// CHECK:STDOUT: %int.make_type_32.loc18_33: init type = call constants.%struct.1() [template = i32] +// CHECK:STDOUT: %.loc18_36.1: (type, (type, type, type), type) = tuple_literal (%int.make_type_32.loc18_11, %.loc18_30, %int.make_type_32.loc18_33) +// CHECK:STDOUT: %.loc18_36.2: type = value_of_initializer %int.make_type_32.loc18_11 [template = i32] +// CHECK:STDOUT: %.loc18_36.3: type = converted %int.make_type_32.loc18_11, %.loc18_36.2 [template = i32] +// CHECK:STDOUT: %.loc18_36.4: type = value_of_initializer %int.make_type_32.loc18_17 [template = i32] +// CHECK:STDOUT: %.loc18_36.5: type = converted %int.make_type_32.loc18_17, %.loc18_36.4 [template = i32] +// CHECK:STDOUT: %.loc18_36.6: type = value_of_initializer %int.make_type_32.loc18_22 [template = i32] +// CHECK:STDOUT: %.loc18_36.7: type = converted %int.make_type_32.loc18_22, %.loc18_36.6 [template = i32] +// CHECK:STDOUT: %.loc18_36.8: type = value_of_initializer %int.make_type_32.loc18_27 [template = i32] +// CHECK:STDOUT: %.loc18_36.9: type = converted %int.make_type_32.loc18_27, %.loc18_36.8 [template = i32] +// CHECK:STDOUT: %.loc18_36.10: type = converted %.loc18_30, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc18_36.11: type = value_of_initializer %int.make_type_32.loc18_33 [template = i32] +// CHECK:STDOUT: %.loc18_36.12: type = converted %int.make_type_32.loc18_33, %.loc18_36.11 [template = i32] +// CHECK:STDOUT: %.loc18_36.13: type = converted %.loc18_36.1, constants.%.10 [template = constants.%.10] // CHECK:STDOUT: %v.var: ref (i32, (i32, i32, i32), i32) = var v // CHECK:STDOUT: %v: ref (i32, (i32, i32, i32), i32) = bind_name v, %v.var -// CHECK:STDOUT: %.loc14_41: i32 = int_literal 1 [template = constants.%.13] +// CHECK:STDOUT: %.loc18_41: i32 = int_literal 1 [template = constants.%.13] // CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.2] -// CHECK:STDOUT: %.loc14_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 -// CHECK:STDOUT: %F.call: init (i32, i32, i32) = call %F.ref() to %.loc14_50.1 -// CHECK:STDOUT: %.loc14_49: i32 = int_literal 2 [template = constants.%.14] -// CHECK:STDOUT: %.loc14_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc14_41, %F.call, %.loc14_49) -// CHECK:STDOUT: %.loc14_50.3: ref i32 = tuple_access %v.var, element0 -// CHECK:STDOUT: %.loc14_50.4: init i32 = initialize_from %.loc14_41 to %.loc14_50.3 [template = constants.%.13] -// CHECK:STDOUT: %.loc14_50.5: ref i32 = tuple_access %v.var, element2 -// CHECK:STDOUT: %.loc14_50.6: init i32 = initialize_from %.loc14_49 to %.loc14_50.5 [template = constants.%.14] -// CHECK:STDOUT: %.loc14_50.7: init (i32, (i32, i32, i32), i32) = tuple_init (%.loc14_50.4, %F.call, %.loc14_50.6) to %v.var -// CHECK:STDOUT: %.loc14_51: init (i32, (i32, i32, i32), i32) = converted %.loc14_50.2, %.loc14_50.7 -// CHECK:STDOUT: assign %v.var, %.loc14_51 +// CHECK:STDOUT: %.loc18_50.1: ref (i32, i32, i32) = tuple_access %v.var, element1 +// CHECK:STDOUT: %F.call: init (i32, i32, i32) = call %F.ref() to %.loc18_50.1 +// CHECK:STDOUT: %.loc18_49: i32 = int_literal 2 [template = constants.%.14] +// CHECK:STDOUT: %.loc18_50.2: (i32, (i32, i32, i32), i32) = tuple_literal (%.loc18_41, %F.call, %.loc18_49) +// CHECK:STDOUT: %.loc18_50.3: ref i32 = tuple_access %v.var, element0 +// CHECK:STDOUT: %.loc18_50.4: init i32 = initialize_from %.loc18_41 to %.loc18_50.3 [template = constants.%.13] +// CHECK:STDOUT: %.loc18_50.5: ref i32 = tuple_access %v.var, element2 +// CHECK:STDOUT: %.loc18_50.6: init i32 = initialize_from %.loc18_49 to %.loc18_50.5 [template = constants.%.14] +// CHECK:STDOUT: %.loc18_50.7: init (i32, (i32, i32, i32), i32) = tuple_init (%.loc18_50.4, %F.call, %.loc18_50.6) to %v.var +// CHECK:STDOUT: %.loc18_51: init (i32, (i32, i32, i32), i32) = converted %.loc18_50.2, %.loc18_50.7 +// CHECK:STDOUT: assign %v.var, %.loc18_51 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/no_prelude/empty.carbon b/toolchain/check/testdata/tuples/no_prelude/empty.carbon index 35ceee4893db..326b1a6b2e3c 100644 --- a/toolchain/check/testdata/tuples/no_prelude/empty.carbon +++ b/toolchain/check/testdata/tuples/no_prelude/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/no_prelude/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/no_prelude/empty.carbon var x: () = (); var y: () = x; @@ -19,26 +23,26 @@ var y: () = x; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_9.2: type = converted %.loc7_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_9.2: type = converted %.loc11_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_9.2: type = converted %.loc8_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %y.var: ref () = var y // CHECK:STDOUT: %y: ref () = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_14.2: init () = tuple_init () to file.%x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_15: init () = converted %.loc7_14.1, %.loc7_14.2 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%x.var, %.loc7_15 +// CHECK:STDOUT: %.loc11_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_14.2: init () = tuple_init () to file.%x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_15: init () = converted %.loc11_14.1, %.loc11_14.2 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%x.var, %.loc11_15 // CHECK:STDOUT: %x.ref: ref () = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_13: init () = tuple_init () to file.%y.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_14: init () = converted %x.ref, %.loc8_13 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%y.var, %.loc8_14 +// CHECK:STDOUT: %.loc12_13: init () = tuple_init () to file.%y.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_14: init () = converted %x.ref, %.loc12_13 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%y.var, %.loc12_14 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon b/toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon index 76bbe25b000b..a873f63ee083 100644 --- a/toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon +++ b/toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/no_prelude/fail_assign_empty.carbon // CHECK:STDERR: fail_assign_empty.carbon:[[@LINE+3]]:16: ERROR: Cannot initialize tuple of 1 element(s) from tuple with 0 element(s). // CHECK:STDERR: var x: ((),) = (); @@ -20,17 +24,17 @@ var x: ((),) = (); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_10: () = tuple_literal () -// CHECK:STDOUT: %.loc10_12.1: ((),) = tuple_literal (%.loc10_10) -// CHECK:STDOUT: %.loc10_12.2: type = converted %.loc10_10, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_12.3: type = converted %.loc10_12.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc14_10: () = tuple_literal () +// CHECK:STDOUT: %.loc14_12.1: ((),) = tuple_literal (%.loc14_10) +// CHECK:STDOUT: %.loc14_12.2: type = converted %.loc14_10, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_12.3: type = converted %.loc14_12.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref ((),) = var x // CHECK:STDOUT: %x: ref ((),) = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10: () = tuple_literal () +// CHECK:STDOUT: %.loc14: () = tuple_literal () // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon b/toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon index 07dfa4ecf23b..5d34c7b66944 100644 --- a/toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/no_prelude/fail_assign_to_empty.carbon // CHECK:STDERR: fail_assign_to_empty.carbon:[[@LINE+3]]:13: ERROR: Cannot initialize tuple of 0 element(s) from tuple with 1 element(s). // CHECK:STDERR: var x: () = ((),); @@ -20,16 +24,16 @@ var x: () = ((),); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_15: () = tuple_literal () -// CHECK:STDOUT: %.loc10_17: ((),) = tuple_literal (%.loc10_15) +// CHECK:STDOUT: %.loc14_15: () = tuple_literal () +// CHECK:STDOUT: %.loc14_17: ((),) = tuple_literal (%.loc14_15) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/tuples/one_element.carbon b/toolchain/check/testdata/tuples/one_element.carbon index ef23c37fae45..e9d7b45cb7e9 100644 --- a/toolchain/check/testdata/tuples/one_element.carbon +++ b/toolchain/check/testdata/tuples/one_element.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/one_element.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/one_element.carbon var x: (i32,) = (4,); var y: (i32,) = x; @@ -27,19 +31,19 @@ var y: (i32,) = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (%int.make_type_32.loc7) -// CHECK:STDOUT: %.loc7_13.2: type = value_of_initializer %int.make_type_32.loc7 [template = i32] -// CHECK:STDOUT: %.loc7_13.3: type = converted %int.make_type_32.loc7, %.loc7_13.2 [template = i32] -// CHECK:STDOUT: %.loc7_13.4: type = converted %.loc7_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc11: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc11_13.1: (type,) = tuple_literal (%int.make_type_32.loc11) +// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %int.make_type_32.loc11 [template = i32] +// CHECK:STDOUT: %.loc11_13.3: type = converted %int.make_type_32.loc11, %.loc11_13.2 [template = i32] +// CHECK:STDOUT: %.loc11_13.4: type = converted %.loc11_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %x.var: ref (i32,) = var x // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (%int.make_type_32.loc8) -// CHECK:STDOUT: %.loc8_13.2: type = value_of_initializer %int.make_type_32.loc8 [template = i32] -// CHECK:STDOUT: %.loc8_13.3: type = converted %int.make_type_32.loc8, %.loc8_13.2 [template = i32] -// CHECK:STDOUT: %.loc8_13.4: type = converted %.loc8_13.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %int.make_type_32.loc12: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_13.1: (type,) = tuple_literal (%int.make_type_32.loc12) +// CHECK:STDOUT: %.loc12_13.2: type = value_of_initializer %int.make_type_32.loc12 [template = i32] +// CHECK:STDOUT: %.loc12_13.3: type = converted %int.make_type_32.loc12, %.loc12_13.2 [template = i32] +// CHECK:STDOUT: %.loc12_13.4: type = converted %.loc12_13.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %y.var: ref (i32,) = var y // CHECK:STDOUT: %y: ref (i32,) = bind_name y, %y.var // CHECK:STDOUT: } @@ -48,17 +52,17 @@ var y: (i32,) = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_18: i32 = int_literal 4 [template = constants.%.4] -// CHECK:STDOUT: %.loc7_20.1: (i32,) = tuple_literal (%.loc7_18) -// CHECK:STDOUT: %.loc7_20.2: init (i32,) = tuple_init (%.loc7_18) to file.%x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_21: init (i32,) = converted %.loc7_20.1, %.loc7_20.2 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%x.var, %.loc7_21 +// CHECK:STDOUT: %.loc11_18: i32 = int_literal 4 [template = constants.%.4] +// CHECK:STDOUT: %.loc11_20.1: (i32,) = tuple_literal (%.loc11_18) +// CHECK:STDOUT: %.loc11_20.2: init (i32,) = tuple_init (%.loc11_18) to file.%x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_21: init (i32,) = converted %.loc11_20.1, %.loc11_20.2 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%x.var, %.loc11_21 // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_17.1: ref i32 = tuple_access %x.ref, element0 -// CHECK:STDOUT: %.loc8_17.2: i32 = bind_value %.loc8_17.1 -// CHECK:STDOUT: %.loc8_17.3: init (i32,) = tuple_init (%.loc8_17.2) to file.%y.var -// CHECK:STDOUT: %.loc8_18: init (i32,) = converted %x.ref, %.loc8_17.3 -// CHECK:STDOUT: assign file.%y.var, %.loc8_18 +// CHECK:STDOUT: %.loc12_17.1: ref i32 = tuple_access %x.ref, element0 +// CHECK:STDOUT: %.loc12_17.2: i32 = bind_value %.loc12_17.1 +// CHECK:STDOUT: %.loc12_17.3: init (i32,) = tuple_init (%.loc12_17.2) to file.%y.var +// CHECK:STDOUT: %.loc12_18: init (i32,) = converted %x.ref, %.loc12_17.3 +// CHECK:STDOUT: assign file.%y.var, %.loc12_18 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/tuples/two_elements.carbon b/toolchain/check/testdata/tuples/two_elements.carbon index 2d6fc47afbfa..77a181fc69a2 100644 --- a/toolchain/check/testdata/tuples/two_elements.carbon +++ b/toolchain/check/testdata/tuples/two_elements.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuples/two_elements.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuples/two_elements.carbon let v: (i32, i32) = (4, 102); let w: (i32, i32) = v; @@ -32,48 +36,8 @@ var y: (i32, i32) = x; // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc7_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc7_17.1: (type, type) = tuple_literal (%int.make_type_32.loc7_9, %int.make_type_32.loc7_14) -// CHECK:STDOUT: %.loc7_17.2: type = value_of_initializer %int.make_type_32.loc7_9 [template = i32] -// CHECK:STDOUT: %.loc7_17.3: type = converted %int.make_type_32.loc7_9, %.loc7_17.2 [template = i32] -// CHECK:STDOUT: %.loc7_17.4: type = value_of_initializer %int.make_type_32.loc7_14 [template = i32] -// CHECK:STDOUT: %.loc7_17.5: type = converted %int.make_type_32.loc7_14, %.loc7_17.4 [template = i32] -// CHECK:STDOUT: %.loc7_17.6: type = converted %.loc7_17.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %.loc7_22: i32 = int_literal 4 [template = constants.%.5] -// CHECK:STDOUT: %.loc7_25: i32 = int_literal 102 [template = constants.%.6] -// CHECK:STDOUT: %.loc7_28: (i32, i32) = tuple_literal (%.loc7_22, %.loc7_25) -// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc7_22, %.loc7_25) [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_29: (i32, i32) = converted %.loc7_28, %tuple [template = constants.%tuple] -// CHECK:STDOUT: %v: (i32, i32) = bind_name v, %.loc7_29 -// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8_9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc8_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc8_17.1: (type, type) = tuple_literal (%int.make_type_32.loc8_9, %int.make_type_32.loc8_14) -// CHECK:STDOUT: %.loc8_17.2: type = value_of_initializer %int.make_type_32.loc8_9 [template = i32] -// CHECK:STDOUT: %.loc8_17.3: type = converted %int.make_type_32.loc8_9, %.loc8_17.2 [template = i32] -// CHECK:STDOUT: %.loc8_17.4: type = value_of_initializer %int.make_type_32.loc8_14 [template = i32] -// CHECK:STDOUT: %.loc8_17.5: type = converted %int.make_type_32.loc8_14, %.loc8_17.4 [template = i32] -// CHECK:STDOUT: %.loc8_17.6: type = converted %.loc8_17.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %v.ref: (i32, i32) = name_ref v, %v -// CHECK:STDOUT: %w: (i32, i32) = bind_name w, %v.ref -// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] -// CHECK:STDOUT: %int.make_type_32.loc10_14: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %.loc10_17.1: (type, type) = tuple_literal (%int.make_type_32.loc10_9, %int.make_type_32.loc10_14) -// CHECK:STDOUT: %.loc10_17.2: type = value_of_initializer %int.make_type_32.loc10_9 [template = i32] -// CHECK:STDOUT: %.loc10_17.3: type = converted %int.make_type_32.loc10_9, %.loc10_17.2 [template = i32] -// CHECK:STDOUT: %.loc10_17.4: type = value_of_initializer %int.make_type_32.loc10_14 [template = i32] -// CHECK:STDOUT: %.loc10_17.5: type = converted %int.make_type_32.loc10_14, %.loc10_17.4 [template = i32] -// CHECK:STDOUT: %.loc10_17.6: type = converted %.loc10_17.1, constants.%.3 [template = constants.%.3] -// CHECK:STDOUT: %x.var: ref (i32, i32) = var x -// CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var -// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc11_9: init type = call constants.%struct() [template = i32] -// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] // CHECK:STDOUT: %int.make_type_32.loc11_14: init type = call constants.%struct() [template = i32] // CHECK:STDOUT: %.loc11_17.1: (type, type) = tuple_literal (%int.make_type_32.loc11_9, %int.make_type_32.loc11_14) // CHECK:STDOUT: %.loc11_17.2: type = value_of_initializer %int.make_type_32.loc11_9 [template = i32] @@ -81,6 +45,46 @@ var y: (i32, i32) = x; // CHECK:STDOUT: %.loc11_17.4: type = value_of_initializer %int.make_type_32.loc11_14 [template = i32] // CHECK:STDOUT: %.loc11_17.5: type = converted %int.make_type_32.loc11_14, %.loc11_17.4 [template = i32] // CHECK:STDOUT: %.loc11_17.6: type = converted %.loc11_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %.loc11_22: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc11_25: i32 = int_literal 102 [template = constants.%.6] +// CHECK:STDOUT: %.loc11_28: (i32, i32) = tuple_literal (%.loc11_22, %.loc11_25) +// CHECK:STDOUT: %tuple: (i32, i32) = tuple_value (%.loc11_22, %.loc11_25) [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_29: (i32, i32) = converted %.loc11_28, %tuple [template = constants.%tuple] +// CHECK:STDOUT: %v: (i32, i32) = bind_name v, %.loc11_29 +// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc12_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.4: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc12_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc12_17.1: (type, type) = tuple_literal (%int.make_type_32.loc12_9, %int.make_type_32.loc12_14) +// CHECK:STDOUT: %.loc12_17.2: type = value_of_initializer %int.make_type_32.loc12_9 [template = i32] +// CHECK:STDOUT: %.loc12_17.3: type = converted %int.make_type_32.loc12_9, %.loc12_17.2 [template = i32] +// CHECK:STDOUT: %.loc12_17.4: type = value_of_initializer %int.make_type_32.loc12_14 [template = i32] +// CHECK:STDOUT: %.loc12_17.5: type = converted %int.make_type_32.loc12_14, %.loc12_17.4 [template = i32] +// CHECK:STDOUT: %.loc12_17.6: type = converted %.loc12_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %v.ref: (i32, i32) = name_ref v, %v +// CHECK:STDOUT: %w: (i32, i32) = bind_name w, %v.ref +// CHECK:STDOUT: %import_ref.5: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc14_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.6: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc14_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc14_17.1: (type, type) = tuple_literal (%int.make_type_32.loc14_9, %int.make_type_32.loc14_14) +// CHECK:STDOUT: %.loc14_17.2: type = value_of_initializer %int.make_type_32.loc14_9 [template = i32] +// CHECK:STDOUT: %.loc14_17.3: type = converted %int.make_type_32.loc14_9, %.loc14_17.2 [template = i32] +// CHECK:STDOUT: %.loc14_17.4: type = value_of_initializer %int.make_type_32.loc14_14 [template = i32] +// CHECK:STDOUT: %.loc14_17.5: type = converted %int.make_type_32.loc14_14, %.loc14_17.4 [template = i32] +// CHECK:STDOUT: %.loc14_17.6: type = converted %.loc14_17.1, constants.%.3 [template = constants.%.3] +// CHECK:STDOUT: %x.var: ref (i32, i32) = var x +// CHECK:STDOUT: %x: ref (i32, i32) = bind_name x, %x.var +// CHECK:STDOUT: %import_ref.7: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc15_9: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %import_ref.8: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct] +// CHECK:STDOUT: %int.make_type_32.loc15_14: init type = call constants.%struct() [template = i32] +// CHECK:STDOUT: %.loc15_17.1: (type, type) = tuple_literal (%int.make_type_32.loc15_9, %int.make_type_32.loc15_14) +// CHECK:STDOUT: %.loc15_17.2: type = value_of_initializer %int.make_type_32.loc15_9 [template = i32] +// CHECK:STDOUT: %.loc15_17.3: type = converted %int.make_type_32.loc15_9, %.loc15_17.2 [template = i32] +// CHECK:STDOUT: %.loc15_17.4: type = value_of_initializer %int.make_type_32.loc15_14 [template = i32] +// CHECK:STDOUT: %.loc15_17.5: type = converted %int.make_type_32.loc15_14, %.loc15_17.4 [template = i32] +// CHECK:STDOUT: %.loc15_17.6: type = converted %.loc15_17.1, constants.%.3 [template = constants.%.3] // CHECK:STDOUT: %y.var: ref (i32, i32) = var y // CHECK:STDOUT: %y: ref (i32, i32) = bind_name y, %y.var // CHECK:STDOUT: } @@ -89,28 +93,28 @@ var y: (i32, i32) = x; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_22: i32 = int_literal 4 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_25: i32 = int_literal 102 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_28.1: (i32, i32) = tuple_literal (%.loc10_22, %.loc10_25) -// CHECK:STDOUT: %.loc10_28.2: ref i32 = tuple_access file.%x.var, element0 -// CHECK:STDOUT: %.loc10_28.3: init i32 = initialize_from %.loc10_22 to %.loc10_28.2 [template = constants.%.5] -// CHECK:STDOUT: %.loc10_28.4: ref i32 = tuple_access file.%x.var, element1 -// CHECK:STDOUT: %.loc10_28.5: init i32 = initialize_from %.loc10_25 to %.loc10_28.4 [template = constants.%.6] -// CHECK:STDOUT: %.loc10_28.6: init (i32, i32) = tuple_init (%.loc10_28.3, %.loc10_28.5) to file.%x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_29: init (i32, i32) = converted %.loc10_28.1, %.loc10_28.6 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%x.var, %.loc10_29 +// CHECK:STDOUT: %.loc14_22: i32 = int_literal 4 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_25: i32 = int_literal 102 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_28.1: (i32, i32) = tuple_literal (%.loc14_22, %.loc14_25) +// CHECK:STDOUT: %.loc14_28.2: ref i32 = tuple_access file.%x.var, element0 +// CHECK:STDOUT: %.loc14_28.3: init i32 = initialize_from %.loc14_22 to %.loc14_28.2 [template = constants.%.5] +// CHECK:STDOUT: %.loc14_28.4: ref i32 = tuple_access file.%x.var, element1 +// CHECK:STDOUT: %.loc14_28.5: init i32 = initialize_from %.loc14_25 to %.loc14_28.4 [template = constants.%.6] +// CHECK:STDOUT: %.loc14_28.6: init (i32, i32) = tuple_init (%.loc14_28.3, %.loc14_28.5) to file.%x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_29: init (i32, i32) = converted %.loc14_28.1, %.loc14_28.6 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%x.var, %.loc14_29 // CHECK:STDOUT: %x.ref: ref (i32, i32) = name_ref x, file.%x -// CHECK:STDOUT: %.loc11_21.1: ref i32 = tuple_access %x.ref, element0 -// CHECK:STDOUT: %.loc11_21.2: i32 = bind_value %.loc11_21.1 -// CHECK:STDOUT: %.loc11_21.3: ref i32 = tuple_access file.%y.var, element0 -// CHECK:STDOUT: %.loc11_21.4: init i32 = initialize_from %.loc11_21.2 to %.loc11_21.3 -// CHECK:STDOUT: %.loc11_21.5: ref i32 = tuple_access %x.ref, element1 -// CHECK:STDOUT: %.loc11_21.6: i32 = bind_value %.loc11_21.5 -// CHECK:STDOUT: %.loc11_21.7: ref i32 = tuple_access file.%y.var, element1 -// CHECK:STDOUT: %.loc11_21.8: init i32 = initialize_from %.loc11_21.6 to %.loc11_21.7 -// CHECK:STDOUT: %.loc11_21.9: init (i32, i32) = tuple_init (%.loc11_21.4, %.loc11_21.8) to file.%y.var -// CHECK:STDOUT: %.loc11_22: init (i32, i32) = converted %x.ref, %.loc11_21.9 -// CHECK:STDOUT: assign file.%y.var, %.loc11_22 +// CHECK:STDOUT: %.loc15_21.1: ref i32 = tuple_access %x.ref, element0 +// CHECK:STDOUT: %.loc15_21.2: i32 = bind_value %.loc15_21.1 +// CHECK:STDOUT: %.loc15_21.3: ref i32 = tuple_access file.%y.var, element0 +// CHECK:STDOUT: %.loc15_21.4: init i32 = initialize_from %.loc15_21.2 to %.loc15_21.3 +// CHECK:STDOUT: %.loc15_21.5: ref i32 = tuple_access %x.ref, element1 +// CHECK:STDOUT: %.loc15_21.6: i32 = bind_value %.loc15_21.5 +// CHECK:STDOUT: %.loc15_21.7: ref i32 = tuple_access file.%y.var, element1 +// CHECK:STDOUT: %.loc15_21.8: init i32 = initialize_from %.loc15_21.6 to %.loc15_21.7 +// CHECK:STDOUT: %.loc15_21.9: init (i32, i32) = tuple_init (%.loc15_21.4, %.loc15_21.8) to file.%y.var +// CHECK:STDOUT: %.loc15_22: init (i32, i32) = converted %x.ref, %.loc15_21.9 +// CHECK:STDOUT: assign file.%y.var, %.loc15_22 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/fail_not_copyable.carbon b/toolchain/check/testdata/var/fail_not_copyable.carbon index 01a70f706c75..af97cd52443e 100644 --- a/toolchain/check/testdata/var/fail_not_copyable.carbon +++ b/toolchain/check/testdata/var/fail_not_copyable.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/fail_not_copyable.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_not_copyable.carbon class X { } @@ -46,8 +50,8 @@ fn F(x: X) { // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] { // CHECK:STDOUT: %X.ref: type = name_ref X, %X.decl [template = constants.%X] -// CHECK:STDOUT: %x.loc10_6.1: X = param x -// CHECK:STDOUT: @F.%x: X = bind_name x, %x.loc10_6.1 +// CHECK:STDOUT: %x.loc14_6.1: X = param x +// CHECK:STDOUT: @F.%x: X = bind_name x, %x.loc14_6.1 // CHECK:STDOUT: } // CHECK:STDOUT: } // CHECK:STDOUT: @@ -60,7 +64,7 @@ fn F(x: X) { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %s.var: ref String = var s // CHECK:STDOUT: %s: ref String = bind_name s, %s.var -// CHECK:STDOUT: %.loc17: String = string_literal "hello" [template = constants.%.5] +// CHECK:STDOUT: %.loc21: String = string_literal "hello" [template = constants.%.5] // CHECK:STDOUT: assign %s.var, // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [template = constants.%X] // CHECK:STDOUT: %y.var: ref X = var y diff --git a/toolchain/check/testdata/var/fail_storage_is_literal.carbon b/toolchain/check/testdata/var/fail_storage_is_literal.carbon index 30a990be2f3b..67d96de9d18a 100644 --- a/toolchain/check/testdata/var/fail_storage_is_literal.carbon +++ b/toolchain/check/testdata/var/fail_storage_is_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_storage_is_literal.carbon fn Main() { // CHECK:STDERR: fail_storage_is_literal.carbon:[[@LINE+3]]:10: ERROR: Cannot implicitly convert from `i32` to `type`. @@ -31,10 +35,10 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_10: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_10: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref = var x // CHECK:STDOUT: %x: ref = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_14: i32 = int_literal 1 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_14: i32 = int_literal 1 [template = constants.%.2] // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon index b55cb2941c26..0b66deebf959 100644 --- a/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon +++ b/toolchain/check/testdata/var/fail_todo_control_flow_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/fail_todo_control_flow_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/fail_todo_control_flow_init.carbon // CHECK:STDERR: fail_todo_control_flow_init.carbon:[[@LINE+12]]:13: ERROR: Semantics TODO: `Control flow expressions are currently only supported inside functions.`. // CHECK:STDERR: var x: () = if true then () else (); @@ -71,24 +75,24 @@ var y2: bool = false or true; // CHECK:STDOUT: .y2 = %y2 // CHECK:STDOUT: } // CHECK:STDOUT: %Core: = namespace [template] {} -// CHECK:STDOUT: %.loc19_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc19_9.2: type = converted %.loc19_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc23_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc23_9.2: type = converted %.loc23_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var -// CHECK:STDOUT: %.loc33_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc33_10.2: type = converted %.loc33_10.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc37_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc37_10.2: type = converted %.loc37_10.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x2.var: ref () = var x2 // CHECK:STDOUT: %x2: ref () = bind_name x2, %x2.var // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] -// CHECK:STDOUT: %bool.make_type.loc43: init type = call constants.%struct() [template = bool] -// CHECK:STDOUT: %.loc43_8.1: type = value_of_initializer %bool.make_type.loc43 [template = bool] -// CHECK:STDOUT: %.loc43_8.2: type = converted %bool.make_type.loc43, %.loc43_8.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc47: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc47_8.1: type = value_of_initializer %bool.make_type.loc47 [template = bool] +// CHECK:STDOUT: %.loc47_8.2: type = converted %bool.make_type.loc47, %.loc47_8.1 [template = bool] // CHECK:STDOUT: %y.var: ref bool = var y // CHECK:STDOUT: %y: ref bool = bind_name y, %y.var // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct] -// CHECK:STDOUT: %bool.make_type.loc52: init type = call constants.%struct() [template = bool] -// CHECK:STDOUT: %.loc52_9.1: type = value_of_initializer %bool.make_type.loc52 [template = bool] -// CHECK:STDOUT: %.loc52_9.2: type = converted %bool.make_type.loc52, %.loc52_9.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc56: init type = call constants.%struct() [template = bool] +// CHECK:STDOUT: %.loc56_9.1: type = value_of_initializer %bool.make_type.loc56 [template = bool] +// CHECK:STDOUT: %.loc56_9.2: type = converted %bool.make_type.loc56, %.loc56_9.1 [template = bool] // CHECK:STDOUT: %y2.var: ref bool = var y2 // CHECK:STDOUT: %y2: ref bool = bind_name y2, %y2.var // CHECK:STDOUT: } @@ -97,7 +101,7 @@ var y2: bool = false or true; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc19: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc19 br !if.expr.then else br !if.expr.else +// CHECK:STDOUT: %.loc23: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc23 br !if.expr.then else br !if.expr.else // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/decl.carbon b/toolchain/check/testdata/var/no_prelude/decl.carbon index fddbf8a16052..6997414bc136 100644 --- a/toolchain/check/testdata/var/no_prelude/decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/decl.carbon fn Main() { var x: (); @@ -25,8 +29,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon b/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon index 6c3f7058b468..164e8198ba80 100644 --- a/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon +++ b/toolchain/check/testdata/var/no_prelude/decl_with_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/decl_with_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/decl_with_init.carbon fn Main() { var x: () = (); @@ -26,14 +30,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_16.2: init () = tuple_init () to %x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_17: init () = converted %.loc8_16.1, %.loc8_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var, %.loc8_17 +// CHECK:STDOUT: %.loc12_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_16.2: init () = tuple_init () to %x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_17: init () = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var, %.loc12_17 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/export_name.carbon b/toolchain/check/testdata/var/no_prelude/export_name.carbon index 736ebeb7321d..73eb893073df 100644 --- a/toolchain/check/testdata/var/no_prelude/export_name.carbon +++ b/toolchain/check/testdata/var/no_prelude/export_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/export_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/export_name.carbon // ============================================================================ // Setup files diff --git a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon index d5ffd3133d03..7a77575d4022 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_duplicate_decl.carbon fn Main() { @@ -34,22 +38,22 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc9_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_11.2: type = converted %.loc9_11.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.var.loc9: ref () = var x -// CHECK:STDOUT: %x.loc9: ref () = bind_name x, %x.var.loc9 -// CHECK:STDOUT: %.loc9_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc9_16.2: init () = tuple_init () to %x.var.loc9 [template = constants.%tuple] -// CHECK:STDOUT: %.loc9_17: init () = converted %.loc9_16.1, %.loc9_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var.loc9, %.loc9_17 -// CHECK:STDOUT: %.loc16_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_11.2: type = converted %.loc16_11.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.var.loc16: ref () = var x -// CHECK:STDOUT: %x.loc16: ref () = bind_name x, %x.var.loc16 -// CHECK:STDOUT: %.loc16_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_16.2: init () = tuple_init () to %x.var.loc16 [template = constants.%tuple] -// CHECK:STDOUT: %.loc16_17: init () = converted %.loc16_16.1, %.loc16_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var.loc16, %.loc16_17 +// CHECK:STDOUT: %.loc13_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_11.2: type = converted %.loc13_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.var.loc13: ref () = var x +// CHECK:STDOUT: %x.loc13: ref () = bind_name x, %x.var.loc13 +// CHECK:STDOUT: %.loc13_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc13_16.2: init () = tuple_init () to %x.var.loc13 [template = constants.%tuple] +// CHECK:STDOUT: %.loc13_17: init () = converted %.loc13_16.1, %.loc13_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var.loc13, %.loc13_17 +// CHECK:STDOUT: %.loc20_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc20_11.2: type = converted %.loc20_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.var.loc20: ref () = var x +// CHECK:STDOUT: %x.loc20: ref () = bind_name x, %x.var.loc20 +// CHECK:STDOUT: %.loc20_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc20_16.2: init () = tuple_init () to %x.var.loc20 [template = constants.%tuple] +// CHECK:STDOUT: %.loc20_17: init () = converted %.loc20_16.1, %.loc20_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var.loc20, %.loc20_17 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/fail_generic.carbon b/toolchain/check/testdata/var/no_prelude/fail_generic.carbon index fad353384a69..b43b5a391b8f 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_generic.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_generic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_generic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_generic.carbon fn Main() { // CHECK:STDERR: fail_generic.carbon:[[@LINE+3]]:11: ERROR: `var` declaration cannot declare a compile-time binding. @@ -30,14 +34,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_12.2: type = converted %.loc11_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_12.2: type = converted %.loc15_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: () = bind_symbolic_name x 0, %x.var [symbolic = constants.%x] -// CHECK:STDOUT: %.loc11_17.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_17.2: init () = tuple_init () to %x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_18: init () = converted %.loc11_17.1, %.loc11_17.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var, %.loc11_18 +// CHECK:STDOUT: %.loc15_17.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_17.2: init () = tuple_init () to %x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc15_18: init () = converted %.loc15_17.1, %.loc15_17.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var, %.loc15_18 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon b/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon index 2df9244f04f7..88e4b8a5a040 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_init_type_mismatch.carbon fn Main() { // CHECK:STDERR: fail_init_type_mismatch.carbon:[[@LINE+3]]:3: ERROR: Cannot implicitly convert from `()` to `{}`. @@ -29,11 +33,11 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_11.1: {} = struct_literal () -// CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.2 [template = constants.%.2] +// CHECK:STDOUT: %.loc15_11.1: {} = struct_literal () +// CHECK:STDOUT: %.loc15_11.2: type = converted %.loc15_11.1, constants.%.2 [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {} = var x // CHECK:STDOUT: %x: ref {} = bind_name x, %x.var -// CHECK:STDOUT: %.loc11_16: () = tuple_literal () +// CHECK:STDOUT: %.loc15_16: () = tuple_literal () // CHECK:STDOUT: assign %x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon b/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon index 39766f3b909a..5648fcecf31d 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_init_with_self.carbon fn Main() { // CHECK:STDERR: fail_init_with_self.carbon:[[@LINE+3]]:15: ERROR: Name `x` not found. @@ -28,8 +32,8 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_11.2: type = converted %.loc11_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_11.2: type = converted %.loc15_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var // CHECK:STDOUT: %x.ref: = name_ref x, [template = ] diff --git a/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon b/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon index ad27edc8ee85..716c6f48db5d 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_lookup_outside_scope.carbon fn Main() { var x: (); @@ -27,16 +31,16 @@ var y: () = x; // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct] {} -// CHECK:STDOUT: %.loc14_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc14_9.2: type = converted %.loc14_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc18_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc18_9.2: type = converted %.loc18_9.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %y.var: ref () = var y // CHECK:STDOUT: %y: ref () = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon b/toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon index 4f3eb6af54db..5f2df37a41b7 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_modifiers.carbon // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: ERROR: `protected` not allowed on `var` declaration at file scope, `protected` is only allowed on class members. // CHECK:STDERR: protected var b: (); @@ -54,20 +58,20 @@ abstract var e: (); // CHECK:STDOUT: .d = %d // CHECK:STDOUT: .e = %e // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_19.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_19.2: type = converted %.loc11_19.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc15_19.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_19.2: type = converted %.loc15_19.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %b.var: ref () = var b // CHECK:STDOUT: %b: ref () = bind_name b, %b.var -// CHECK:STDOUT: %.loc24_27.1: () = tuple_literal () -// CHECK:STDOUT: %.loc24_27.2: type = converted %.loc24_27.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc28_27.1: () = tuple_literal () +// CHECK:STDOUT: %.loc28_27.2: type = converted %.loc28_27.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %c.var: ref () = var c // CHECK:STDOUT: %c: ref () = bind_name c, %c.var -// CHECK:STDOUT: %.loc37_29.1: () = tuple_literal () -// CHECK:STDOUT: %.loc37_29.2: type = converted %.loc37_29.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc41_29.1: () = tuple_literal () +// CHECK:STDOUT: %.loc41_29.2: type = converted %.loc41_29.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %d.var: ref () = var d // CHECK:STDOUT: %d: ref () = bind_name d, %d.var -// CHECK:STDOUT: %.loc42_18.1: () = tuple_literal () -// CHECK:STDOUT: %.loc42_18.2: type = converted %.loc42_18.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc46_18.1: () = tuple_literal () +// CHECK:STDOUT: %.loc46_18.2: type = converted %.loc46_18.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %e.var: ref () = var e // CHECK:STDOUT: %e: ref () = bind_name e, %e.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon b/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon index 3f1e8b81c1fc..a620cfe6f16c 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_namespace_conflict.carbon namespace A; @@ -32,25 +36,25 @@ var A: () = (); // CHECK:STDOUT: // CHECK:STDOUT: file { // CHECK:STDOUT: package: = namespace [template] { -// CHECK:STDOUT: .A = %A.loc7 +// CHECK:STDOUT: .A = %A.loc11 // CHECK:STDOUT: } -// CHECK:STDOUT: %A.loc7: = namespace [template] {} -// CHECK:STDOUT: %.loc16_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %A.var.loc16: ref () = var A -// CHECK:STDOUT: %A.loc16: ref () = bind_name A, %A.var.loc16 -// CHECK:STDOUT: %.loc24_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc24_9.2: type = converted %.loc24_9.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %A.var.loc24: ref () = var A -// CHECK:STDOUT: %A.loc24: ref () = bind_name A, %A.var.loc24 +// CHECK:STDOUT: %A.loc11: = namespace [template] {} +// CHECK:STDOUT: %.loc20_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc20_9.2: type = converted %.loc20_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %A.var.loc20: ref () = var A +// CHECK:STDOUT: %A.loc20: ref () = bind_name A, %A.var.loc20 +// CHECK:STDOUT: %.loc28_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc28_9.2: type = converted %.loc28_9.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %A.var.loc28: ref () = var A +// CHECK:STDOUT: %A.loc28: ref () = bind_name A, %A.var.loc28 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc24_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc24_14.2: init () = tuple_init () to file.%A.var.loc24 [template = constants.%tuple] -// CHECK:STDOUT: %.loc24_15: init () = converted %.loc24_14.1, %.loc24_14.2 [template = constants.%tuple] -// CHECK:STDOUT: assign file.%A.var.loc24, %.loc24_15 +// CHECK:STDOUT: %.loc28_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc28_14.2: init () = tuple_init () to file.%A.var.loc28 [template = constants.%tuple] +// CHECK:STDOUT: %.loc28_15: init () = converted %.loc28_14.1, %.loc28_14.2 [template = constants.%tuple] +// CHECK:STDOUT: assign file.%A.var.loc28, %.loc28_15 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon b/toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon index 23eef5019e2f..fe79c589bded 100644 --- a/toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon +++ b/toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/fail_todo_modifiers.carbon // CHECK:STDERR: fail_todo_modifiers.carbon:[[@LINE+3]]:1: ERROR: Semantics TODO: `access modifier`. // CHECK:STDERR: private var a: (); @@ -19,8 +23,8 @@ private var a: (); // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .a = %a // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc10_17.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_17.2: type = converted %.loc10_17.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_17.1: () = tuple_literal () +// CHECK:STDOUT: %.loc14_17.2: type = converted %.loc14_17.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %a.var: ref () = var a // CHECK:STDOUT: %a: ref () = bind_name a, %a.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/global_decl.carbon b/toolchain/check/testdata/var/no_prelude/global_decl.carbon index 0515621b0224..e54e74a9c2d4 100644 --- a/toolchain/check/testdata/var/no_prelude/global_decl.carbon +++ b/toolchain/check/testdata/var/no_prelude/global_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/global_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/global_decl.carbon var x: {.v: ()}; @@ -17,9 +21,9 @@ var x: {.v: ()}; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_15: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.v: ()} = var x // CHECK:STDOUT: %x: ref {.v: ()} = bind_name x, %x.var // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon b/toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon index 4e198c94b15b..c1c25fa410f1 100644 --- a/toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon +++ b/toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/global_decl_with_init.carbon var x: {.v: ()} = {.v = ()}; @@ -19,23 +23,23 @@ var x: {.v: ()} = {.v = ()}; // CHECK:STDOUT: package: = namespace [template] { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_15: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.v: ()} = var x // CHECK:STDOUT: %x: ref {.v: ()} = bind_name x, %x.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_27.1: {.v: ()} = struct_literal (%.loc7_26.1) -// CHECK:STDOUT: %.loc7_27.2: ref () = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_26.2: init () = tuple_init () to %.loc7_27.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.3: init () = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.4: init {.v: ()} = struct_init (%.loc7_27.3) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_28: init {.v: ()} = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_26.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_27.1: {.v: ()} = struct_literal (%.loc11_26.1) +// CHECK:STDOUT: %.loc11_27.2: ref () = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_26.2: init () = tuple_init () to %.loc11_27.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.3: init () = converted %.loc11_26.1, %.loc11_26.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.4: init {.v: ()} = struct_init (%.loc11_27.3) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_28: init {.v: ()} = converted %.loc11_27.1, %.loc11_27.4 [template = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/global_lookup.carbon b/toolchain/check/testdata/var/no_prelude/global_lookup.carbon index 1b2dfa331e82..4daa1c4c58fd 100644 --- a/toolchain/check/testdata/var/no_prelude/global_lookup.carbon +++ b/toolchain/check/testdata/var/no_prelude/global_lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/global_lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/global_lookup.carbon var x: {.v: ()} = {.v = ()}; var y: {.v: ()} = x; @@ -21,36 +25,36 @@ var y: {.v: ()} = x; // CHECK:STDOUT: .x = %x // CHECK:STDOUT: .y = %y // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_15: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.v: ()} = var x // CHECK:STDOUT: %x: ref {.v: ()} = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_14.2: type = converted %.loc8_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc8_15: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc12_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_14.2: type = converted %.loc12_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.v: ()} = var y // CHECK:STDOUT: %y: ref {.v: ()} = bind_name y, %y.var // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_27.1: {.v: ()} = struct_literal (%.loc7_26.1) -// CHECK:STDOUT: %.loc7_27.2: ref () = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_26.2: init () = tuple_init () to %.loc7_27.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.3: init () = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.4: init {.v: ()} = struct_init (%.loc7_27.3) to file.%x.var [template = constants.%struct] -// CHECK:STDOUT: %.loc7_28: init {.v: ()} = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_26.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_27.1: {.v: ()} = struct_literal (%.loc11_26.1) +// CHECK:STDOUT: %.loc11_27.2: ref () = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_26.2: init () = tuple_init () to %.loc11_27.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.3: init () = converted %.loc11_26.1, %.loc11_26.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.4: init {.v: ()} = struct_init (%.loc11_27.3) to file.%x.var [template = constants.%struct] +// CHECK:STDOUT: %.loc11_28: init {.v: ()} = converted %.loc11_27.1, %.loc11_27.4 [template = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: %x.ref: ref {.v: ()} = name_ref x, file.%x -// CHECK:STDOUT: %.loc8_19.1: ref () = struct_access %x.ref, element0 -// CHECK:STDOUT: %.loc8_19.2: ref () = struct_access file.%y.var, element0 -// CHECK:STDOUT: %.loc8_19.3: init () = tuple_init () to %.loc8_19.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_19.4: init () = converted %.loc8_19.1, %.loc8_19.3 [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_19.5: init {.v: ()} = struct_init (%.loc8_19.4) to file.%y.var [template = constants.%struct] -// CHECK:STDOUT: %.loc8_20: init {.v: ()} = converted %x.ref, %.loc8_19.5 [template = constants.%struct] -// CHECK:STDOUT: assign file.%y.var, %.loc8_20 +// CHECK:STDOUT: %.loc12_19.1: ref () = struct_access %x.ref, element0 +// CHECK:STDOUT: %.loc12_19.2: ref () = struct_access file.%y.var, element0 +// CHECK:STDOUT: %.loc12_19.3: init () = tuple_init () to %.loc12_19.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_19.4: init () = converted %.loc12_19.1, %.loc12_19.3 [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_19.5: init {.v: ()} = struct_init (%.loc12_19.4) to file.%y.var [template = constants.%struct] +// CHECK:STDOUT: %.loc12_20: init {.v: ()} = converted %x.ref, %.loc12_19.5 [template = constants.%struct] +// CHECK:STDOUT: assign file.%y.var, %.loc12_20 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon b/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon index 729d5bcb6ed0..9af1d248311a 100644 --- a/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon +++ b/toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/global_lookup_in_scope.carbon var x: {.v: ()} = {.v = ()}; @@ -26,9 +30,9 @@ fn Main() { // CHECK:STDOUT: .x = %x // CHECK:STDOUT: .Main = %Main.decl // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc7_14.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_14.2: type = converted %.loc7_14.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc7_15: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc11_14.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_14.2: type = converted %.loc11_14.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc11_15: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %x.var: ref {.v: ()} = var x // CHECK:STDOUT: %x: ref {.v: ()} = bind_name x, %x.var // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {} @@ -36,32 +40,32 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_16.2: type = converted %.loc10_16.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %.loc10_17: type = struct_type {.v: ()} [template = constants.%.2] +// CHECK:STDOUT: %.loc14_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc14_16.2: type = converted %.loc14_16.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_17: type = struct_type {.v: ()} [template = constants.%.2] // CHECK:STDOUT: %y.var: ref {.v: ()} = var y // CHECK:STDOUT: %y: ref {.v: ()} = bind_name y, %y.var // CHECK:STDOUT: %x.ref: ref {.v: ()} = name_ref x, file.%x -// CHECK:STDOUT: %.loc10_21.1: ref () = struct_access %x.ref, element0 -// CHECK:STDOUT: %.loc10_21.2: ref () = struct_access %y.var, element0 -// CHECK:STDOUT: %.loc10_21.3: init () = tuple_init () to %.loc10_21.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_21.4: init () = converted %.loc10_21.1, %.loc10_21.3 [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_21.5: init {.v: ()} = struct_init (%.loc10_21.4) to %y.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc10_22: init {.v: ()} = converted %x.ref, %.loc10_21.5 [template = constants.%struct.1] -// CHECK:STDOUT: assign %y.var, %.loc10_22 +// CHECK:STDOUT: %.loc14_21.1: ref () = struct_access %x.ref, element0 +// CHECK:STDOUT: %.loc14_21.2: ref () = struct_access %y.var, element0 +// CHECK:STDOUT: %.loc14_21.3: init () = tuple_init () to %.loc14_21.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_21.4: init () = converted %.loc14_21.1, %.loc14_21.3 [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_21.5: init {.v: ()} = struct_init (%.loc14_21.4) to %y.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc14_22: init {.v: ()} = converted %x.ref, %.loc14_21.5 [template = constants.%struct.1] +// CHECK:STDOUT: assign %y.var, %.loc14_22 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc7_26.1: () = tuple_literal () -// CHECK:STDOUT: %.loc7_27.1: {.v: ()} = struct_literal (%.loc7_26.1) -// CHECK:STDOUT: %.loc7_27.2: ref () = struct_access file.%x.var, element0 -// CHECK:STDOUT: %.loc7_26.2: init () = tuple_init () to %.loc7_27.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.3: init () = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%tuple] -// CHECK:STDOUT: %.loc7_27.4: init {.v: ()} = struct_init (%.loc7_27.3) to file.%x.var [template = constants.%struct.1] -// CHECK:STDOUT: %.loc7_28: init {.v: ()} = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%struct.1] -// CHECK:STDOUT: assign file.%x.var, %.loc7_28 +// CHECK:STDOUT: %.loc11_26.1: () = tuple_literal () +// CHECK:STDOUT: %.loc11_27.1: {.v: ()} = struct_literal (%.loc11_26.1) +// CHECK:STDOUT: %.loc11_27.2: ref () = struct_access file.%x.var, element0 +// CHECK:STDOUT: %.loc11_26.2: init () = tuple_init () to %.loc11_27.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.3: init () = converted %.loc11_26.1, %.loc11_26.2 [template = constants.%tuple] +// CHECK:STDOUT: %.loc11_27.4: init {.v: ()} = struct_init (%.loc11_27.3) to file.%x.var [template = constants.%struct.1] +// CHECK:STDOUT: %.loc11_28: init {.v: ()} = converted %.loc11_27.1, %.loc11_27.4 [template = constants.%struct.1] +// CHECK:STDOUT: assign file.%x.var, %.loc11_28 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/var/no_prelude/import.carbon b/toolchain/check/testdata/var/no_prelude/import.carbon index 3b0f7768176b..352adc5fc373 100644 --- a/toolchain/check/testdata/var/no_prelude/import.carbon +++ b/toolchain/check/testdata/var/no_prelude/import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/import.carbon // --- implicit.carbon diff --git a/toolchain/check/testdata/var/no_prelude/lookup.carbon b/toolchain/check/testdata/var/no_prelude/lookup.carbon index f74fab09b5e2..e8f82d7089ba 100644 --- a/toolchain/check/testdata/var/no_prelude/lookup.carbon +++ b/toolchain/check/testdata/var/no_prelude/lookup.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/lookup.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/lookup.carbon fn Main() { var x: () = (); @@ -27,14 +31,14 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc8_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_11.2: type = converted %.loc8_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc12_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_11.2: type = converted %.loc12_11.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %x.var: ref () = var x // CHECK:STDOUT: %x: ref () = bind_name x, %x.var -// CHECK:STDOUT: %.loc8_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc8_16.2: init () = tuple_init () to %x.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc8_17: init () = converted %.loc8_16.1, %.loc8_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var, %.loc8_17 +// CHECK:STDOUT: %.loc12_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc12_16.2: init () = tuple_init () to %x.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc12_17: init () = converted %.loc12_16.1, %.loc12_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var, %.loc12_17 // CHECK:STDOUT: %x.ref: ref () = name_ref x, %x // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/var/no_prelude/shadowing.carbon b/toolchain/check/testdata/var/no_prelude/shadowing.carbon index ca0735b4854d..80ec626205e9 100644 --- a/toolchain/check/testdata/var/no_prelude/shadowing.carbon +++ b/toolchain/check/testdata/var/no_prelude/shadowing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/var/no_prelude/shadowing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/var/no_prelude/shadowing.carbon namespace NS; @@ -40,44 +44,44 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: fn @Main() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc10_12.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_12.2: type = converted %.loc10_12.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %.loc14_12.1: () = tuple_literal () +// CHECK:STDOUT: %.loc14_12.2: type = converted %.loc14_12.1, constants.%.1 [template = constants.%.1] // CHECK:STDOUT: %NS.var: ref () = var NS // CHECK:STDOUT: %NS: ref () = bind_name NS, %NS.var -// CHECK:STDOUT: %.loc10_17.1: () = tuple_literal () -// CHECK:STDOUT: %.loc10_17.2: init () = tuple_init () to %NS.var [template = constants.%tuple] -// CHECK:STDOUT: %.loc10_18: init () = converted %.loc10_17.1, %.loc10_17.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %NS.var, %.loc10_18 +// CHECK:STDOUT: %.loc14_17.1: () = tuple_literal () +// CHECK:STDOUT: %.loc14_17.2: init () = tuple_init () to %NS.var [template = constants.%tuple] +// CHECK:STDOUT: %.loc14_18: init () = converted %.loc14_17.1, %.loc14_17.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %NS.var, %.loc14_18 // CHECK:STDOUT: %NS.ref: ref () = name_ref NS, %NS -// CHECK:STDOUT: %.loc11_9.1: () = tuple_literal () -// CHECK:STDOUT: %.loc11_9.2: init () = tuple_init () to %NS.ref [template = constants.%tuple] -// CHECK:STDOUT: %.loc11_6: init () = converted %.loc11_9.1, %.loc11_9.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %NS.ref, %.loc11_6 -// CHECK:STDOUT: %.loc13_11.1: () = tuple_literal () -// CHECK:STDOUT: %.loc13_11.2: type = converted %.loc13_11.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.var.loc13: ref () = var x -// CHECK:STDOUT: %x.loc13: ref () = bind_name x, %x.var.loc13 -// CHECK:STDOUT: %.loc13_16.1: () = tuple_literal () -// CHECK:STDOUT: %.loc13_16.2: init () = tuple_init () to %x.var.loc13 [template = constants.%tuple] -// CHECK:STDOUT: %.loc13_17: init () = converted %.loc13_16.1, %.loc13_16.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var.loc13, %.loc13_17 -// CHECK:STDOUT: %.loc14: bool = bool_literal true [template = constants.%.2] -// CHECK:STDOUT: if %.loc14 br !if.then else br !if.else +// CHECK:STDOUT: %.loc15_9.1: () = tuple_literal () +// CHECK:STDOUT: %.loc15_9.2: init () = tuple_init () to %NS.ref [template = constants.%tuple] +// CHECK:STDOUT: %.loc15_6: init () = converted %.loc15_9.1, %.loc15_9.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %NS.ref, %.loc15_6 +// CHECK:STDOUT: %.loc17_11.1: () = tuple_literal () +// CHECK:STDOUT: %.loc17_11.2: type = converted %.loc17_11.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.var.loc17: ref () = var x +// CHECK:STDOUT: %x.loc17: ref () = bind_name x, %x.var.loc17 +// CHECK:STDOUT: %.loc17_16.1: () = tuple_literal () +// CHECK:STDOUT: %.loc17_16.2: init () = tuple_init () to %x.var.loc17 [template = constants.%tuple] +// CHECK:STDOUT: %.loc17_17: init () = converted %.loc17_16.1, %.loc17_16.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var.loc17, %.loc17_17 +// CHECK:STDOUT: %.loc18: bool = bool_literal true [template = constants.%.2] +// CHECK:STDOUT: if %.loc18 br !if.then else br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.then: -// CHECK:STDOUT: %.loc15_13.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_13.2: type = converted %.loc15_13.1, constants.%.1 [template = constants.%.1] -// CHECK:STDOUT: %x.var.loc15: ref () = var x -// CHECK:STDOUT: %x.loc15: ref () = bind_name x, %x.var.loc15 -// CHECK:STDOUT: %.loc15_18.1: () = tuple_literal () -// CHECK:STDOUT: %.loc15_18.2: init () = tuple_init () to %x.var.loc15 [template = constants.%tuple] -// CHECK:STDOUT: %.loc15_19: init () = converted %.loc15_18.1, %.loc15_18.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.var.loc15, %.loc15_19 -// CHECK:STDOUT: %x.ref: ref () = name_ref x, %x.loc15 -// CHECK:STDOUT: %.loc18_10.1: () = tuple_literal () -// CHECK:STDOUT: %.loc18_10.2: init () = tuple_init () to %x.ref [template = constants.%tuple] -// CHECK:STDOUT: %.loc18_7: init () = converted %.loc18_10.1, %.loc18_10.2 [template = constants.%tuple] -// CHECK:STDOUT: assign %x.ref, %.loc18_7 +// CHECK:STDOUT: %.loc19_13.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_13.2: type = converted %.loc19_13.1, constants.%.1 [template = constants.%.1] +// CHECK:STDOUT: %x.var.loc19: ref () = var x +// CHECK:STDOUT: %x.loc19: ref () = bind_name x, %x.var.loc19 +// CHECK:STDOUT: %.loc19_18.1: () = tuple_literal () +// CHECK:STDOUT: %.loc19_18.2: init () = tuple_init () to %x.var.loc19 [template = constants.%tuple] +// CHECK:STDOUT: %.loc19_19: init () = converted %.loc19_18.1, %.loc19_18.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.var.loc19, %.loc19_19 +// CHECK:STDOUT: %x.ref: ref () = name_ref x, %x.loc19 +// CHECK:STDOUT: %.loc22_10.1: () = tuple_literal () +// CHECK:STDOUT: %.loc22_10.2: init () = tuple_init () to %x.ref [template = constants.%tuple] +// CHECK:STDOUT: %.loc22_7: init () = converted %.loc22_10.1, %.loc22_10.2 [template = constants.%tuple] +// CHECK:STDOUT: assign %x.ref, %.loc22_7 // CHECK:STDOUT: br !if.else // CHECK:STDOUT: // CHECK:STDOUT: !if.else: diff --git a/toolchain/check/testdata/while/break_continue.carbon b/toolchain/check/testdata/while/break_continue.carbon index a40a5163775e..b0f20934fbd5 100644 --- a/toolchain/check/testdata/while/break_continue.carbon +++ b/toolchain/check/testdata/while/break_continue.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/while/break_continue.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/while/break_continue.carbon fn A() -> bool; fn B() -> bool; @@ -68,58 +72,58 @@ fn While() { // CHECK:STDOUT: %Core: = namespace [template] {} // CHECK:STDOUT: %import_ref.1: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %A.decl: A = fn_decl @A [template = constants.%struct.2] { -// CHECK:STDOUT: %bool.make_type.loc7: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_11.1: type = value_of_initializer %bool.make_type.loc7 [template = bool] -// CHECK:STDOUT: %.loc7_11.2: type = converted %bool.make_type.loc7, %.loc7_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] +// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] // CHECK:STDOUT: @A.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.2: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %B.decl: B = fn_decl @B [template = constants.%struct.3] { -// CHECK:STDOUT: %bool.make_type.loc8: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc8_11.1: type = value_of_initializer %bool.make_type.loc8 [template = bool] -// CHECK:STDOUT: %.loc8_11.2: type = converted %bool.make_type.loc8, %.loc8_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] +// CHECK:STDOUT: %.loc12_11.2: type = converted %bool.make_type.loc12, %.loc12_11.1 [template = bool] // CHECK:STDOUT: @B.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.3: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %C.decl: C = fn_decl @C [template = constants.%struct.4] { -// CHECK:STDOUT: %bool.make_type.loc9: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc9_11.1: type = value_of_initializer %bool.make_type.loc9 [template = bool] -// CHECK:STDOUT: %.loc9_11.2: type = converted %bool.make_type.loc9, %.loc9_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc13: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %bool.make_type.loc13 [template = bool] +// CHECK:STDOUT: %.loc13_11.2: type = converted %bool.make_type.loc13, %.loc13_11.1 [template = bool] // CHECK:STDOUT: @C.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.4: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %D.decl: D = fn_decl @D [template = constants.%struct.5] { -// CHECK:STDOUT: %bool.make_type.loc10: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc10_11.1: type = value_of_initializer %bool.make_type.loc10 [template = bool] -// CHECK:STDOUT: %.loc10_11.2: type = converted %bool.make_type.loc10, %.loc10_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] +// CHECK:STDOUT: %.loc14_11.2: type = converted %bool.make_type.loc14, %.loc14_11.1 [template = bool] // CHECK:STDOUT: @D.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.5: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %E.decl: E = fn_decl @E [template = constants.%struct.6] { -// CHECK:STDOUT: %bool.make_type.loc11: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %bool.make_type.loc11 [template = bool] -// CHECK:STDOUT: %.loc11_11.2: type = converted %bool.make_type.loc11, %.loc11_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc15: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc15_11.1: type = value_of_initializer %bool.make_type.loc15 [template = bool] +// CHECK:STDOUT: %.loc15_11.2: type = converted %bool.make_type.loc15, %.loc15_11.1 [template = bool] // CHECK:STDOUT: @E.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.6: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.7] { -// CHECK:STDOUT: %bool.make_type.loc12: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc12_11.1: type = value_of_initializer %bool.make_type.loc12 [template = bool] -// CHECK:STDOUT: %.loc12_11.2: type = converted %bool.make_type.loc12, %.loc12_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc16: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc16_11.1: type = value_of_initializer %bool.make_type.loc16 [template = bool] +// CHECK:STDOUT: %.loc16_11.2: type = converted %bool.make_type.loc16, %.loc16_11.1 [template = bool] // CHECK:STDOUT: @F.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.7: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %G.decl: G = fn_decl @G [template = constants.%struct.8] { -// CHECK:STDOUT: %bool.make_type.loc13: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc13_11.1: type = value_of_initializer %bool.make_type.loc13 [template = bool] -// CHECK:STDOUT: %.loc13_11.2: type = converted %bool.make_type.loc13, %.loc13_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc17: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc17_11.1: type = value_of_initializer %bool.make_type.loc17 [template = bool] +// CHECK:STDOUT: %.loc17_11.2: type = converted %bool.make_type.loc17, %.loc17_11.1 [template = bool] // CHECK:STDOUT: @G.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %import_ref.8: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %H.decl: H = fn_decl @H [template = constants.%struct.9] { -// CHECK:STDOUT: %bool.make_type.loc14: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc14_11.1: type = value_of_initializer %bool.make_type.loc14 [template = bool] -// CHECK:STDOUT: %.loc14_11.2: type = converted %bool.make_type.loc14, %.loc14_11.1 [template = bool] +// CHECK:STDOUT: %bool.make_type.loc18: init type = call constants.%struct.1() [template = bool] +// CHECK:STDOUT: %.loc18_11.1: type = value_of_initializer %bool.make_type.loc18 [template = bool] +// CHECK:STDOUT: %.loc18_11.2: type = converted %bool.make_type.loc18, %.loc18_11.1 [template = bool] // CHECK:STDOUT: @H.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %While.decl: While = fn_decl @While [template = constants.%struct.10] {} @@ -145,92 +149,92 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: fn @While() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: br !while.cond.loc17 +// CHECK:STDOUT: br !while.cond.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: !while.cond.loc17: +// CHECK:STDOUT: !while.cond.loc21: // CHECK:STDOUT: %A.ref: A = name_ref A, file.%A.decl [template = constants.%struct.2] // CHECK:STDOUT: %A.call: init bool = call %A.ref() -// CHECK:STDOUT: %.loc17_13.1: bool = value_of_initializer %A.call -// CHECK:STDOUT: %.loc17_13.2: bool = converted %A.call, %.loc17_13.1 -// CHECK:STDOUT: if %.loc17_13.2 br !while.body.loc17 else br !while.done.loc17 +// CHECK:STDOUT: %.loc21_13.1: bool = value_of_initializer %A.call +// CHECK:STDOUT: %.loc21_13.2: bool = converted %A.call, %.loc21_13.1 +// CHECK:STDOUT: if %.loc21_13.2 br !while.body.loc21 else br !while.done.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: !while.body.loc17: +// CHECK:STDOUT: !while.body.loc21: // CHECK:STDOUT: %B.ref: B = name_ref B, file.%B.decl [template = constants.%struct.3] // CHECK:STDOUT: %B.call: init bool = call %B.ref() -// CHECK:STDOUT: %.loc18_12.1: bool = value_of_initializer %B.call -// CHECK:STDOUT: %.loc18_12.2: bool = converted %B.call, %.loc18_12.1 -// CHECK:STDOUT: if %.loc18_12.2 br !if.then.loc18 else br !if.else.loc18 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc18: -// CHECK:STDOUT: br !while.cond.loc17 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc18: -// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4] -// CHECK:STDOUT: %C.call: init bool = call %C.ref() -// CHECK:STDOUT: %.loc19_12.1: bool = value_of_initializer %C.call -// CHECK:STDOUT: %.loc19_12.2: bool = converted %C.call, %.loc19_12.1 -// CHECK:STDOUT: if %.loc19_12.2 br !if.then.loc19 else br !if.else.loc19 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc19: -// CHECK:STDOUT: br !while.done.loc17 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc19: -// CHECK:STDOUT: br !while.cond.loc20 -// CHECK:STDOUT: -// CHECK:STDOUT: !while.cond.loc20: -// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5] -// CHECK:STDOUT: %D.call: init bool = call %D.ref() -// CHECK:STDOUT: %.loc20_15.1: bool = value_of_initializer %D.call -// CHECK:STDOUT: %.loc20_15.2: bool = converted %D.call, %.loc20_15.1 -// CHECK:STDOUT: if %.loc20_15.2 br !while.body.loc20 else br !while.done.loc20 -// CHECK:STDOUT: -// CHECK:STDOUT: !while.body.loc20: -// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6] -// CHECK:STDOUT: %E.call: init bool = call %E.ref() -// CHECK:STDOUT: %.loc21_14.1: bool = value_of_initializer %E.call -// CHECK:STDOUT: %.loc21_14.2: bool = converted %E.call, %.loc21_14.1 -// CHECK:STDOUT: if %.loc21_14.2 br !if.then.loc21 else br !if.else.loc21 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc21: -// CHECK:STDOUT: br !while.cond.loc20 -// CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc21: -// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.7] -// CHECK:STDOUT: %F.call: init bool = call %F.ref() -// CHECK:STDOUT: %.loc22_14.1: bool = value_of_initializer %F.call -// CHECK:STDOUT: %.loc22_14.2: bool = converted %F.call, %.loc22_14.1 -// CHECK:STDOUT: if %.loc22_14.2 br !if.then.loc22 else br !if.else.loc22 +// CHECK:STDOUT: %.loc22_12.1: bool = value_of_initializer %B.call +// CHECK:STDOUT: %.loc22_12.2: bool = converted %B.call, %.loc22_12.1 +// CHECK:STDOUT: if %.loc22_12.2 br !if.then.loc22 else br !if.else.loc22 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc22: -// CHECK:STDOUT: br !while.done.loc20 +// CHECK:STDOUT: br !while.cond.loc21 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc22: -// CHECK:STDOUT: br !while.cond.loc20 +// CHECK:STDOUT: %C.ref: C = name_ref C, file.%C.decl [template = constants.%struct.4] +// CHECK:STDOUT: %C.call: init bool = call %C.ref() +// CHECK:STDOUT: %.loc23_12.1: bool = value_of_initializer %C.call +// CHECK:STDOUT: %.loc23_12.2: bool = converted %C.call, %.loc23_12.1 +// CHECK:STDOUT: if %.loc23_12.2 br !if.then.loc23 else br !if.else.loc23 // CHECK:STDOUT: -// CHECK:STDOUT: !while.done.loc20: -// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.8] -// CHECK:STDOUT: %G.call: init bool = call %G.ref() -// CHECK:STDOUT: %.loc24_12.1: bool = value_of_initializer %G.call -// CHECK:STDOUT: %.loc24_12.2: bool = converted %G.call, %.loc24_12.1 -// CHECK:STDOUT: if %.loc24_12.2 br !if.then.loc24 else br !if.else.loc24 +// CHECK:STDOUT: !if.then.loc23: +// CHECK:STDOUT: br !while.done.loc21 // CHECK:STDOUT: -// CHECK:STDOUT: !if.then.loc24: -// CHECK:STDOUT: br !while.cond.loc17 +// CHECK:STDOUT: !if.else.loc23: +// CHECK:STDOUT: br !while.cond.loc24 // CHECK:STDOUT: -// CHECK:STDOUT: !if.else.loc24: -// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.9] -// CHECK:STDOUT: %H.call: init bool = call %H.ref() -// CHECK:STDOUT: %.loc25_12.1: bool = value_of_initializer %H.call -// CHECK:STDOUT: %.loc25_12.2: bool = converted %H.call, %.loc25_12.1 -// CHECK:STDOUT: if %.loc25_12.2 br !if.then.loc25 else br !if.else.loc25 +// CHECK:STDOUT: !while.cond.loc24: +// CHECK:STDOUT: %D.ref: D = name_ref D, file.%D.decl [template = constants.%struct.5] +// CHECK:STDOUT: %D.call: init bool = call %D.ref() +// CHECK:STDOUT: %.loc24_15.1: bool = value_of_initializer %D.call +// CHECK:STDOUT: %.loc24_15.2: bool = converted %D.call, %.loc24_15.1 +// CHECK:STDOUT: if %.loc24_15.2 br !while.body.loc24 else br !while.done.loc24 +// CHECK:STDOUT: +// CHECK:STDOUT: !while.body.loc24: +// CHECK:STDOUT: %E.ref: E = name_ref E, file.%E.decl [template = constants.%struct.6] +// CHECK:STDOUT: %E.call: init bool = call %E.ref() +// CHECK:STDOUT: %.loc25_14.1: bool = value_of_initializer %E.call +// CHECK:STDOUT: %.loc25_14.2: bool = converted %E.call, %.loc25_14.1 +// CHECK:STDOUT: if %.loc25_14.2 br !if.then.loc25 else br !if.else.loc25 // CHECK:STDOUT: // CHECK:STDOUT: !if.then.loc25: -// CHECK:STDOUT: br !while.done.loc17 +// CHECK:STDOUT: br !while.cond.loc24 // CHECK:STDOUT: // CHECK:STDOUT: !if.else.loc25: -// CHECK:STDOUT: br !while.cond.loc17 +// CHECK:STDOUT: %F.ref: F = name_ref F, file.%F.decl [template = constants.%struct.7] +// CHECK:STDOUT: %F.call: init bool = call %F.ref() +// CHECK:STDOUT: %.loc26_14.1: bool = value_of_initializer %F.call +// CHECK:STDOUT: %.loc26_14.2: bool = converted %F.call, %.loc26_14.1 +// CHECK:STDOUT: if %.loc26_14.2 br !if.then.loc26 else br !if.else.loc26 // CHECK:STDOUT: -// CHECK:STDOUT: !while.done.loc17: +// CHECK:STDOUT: !if.then.loc26: +// CHECK:STDOUT: br !while.done.loc24 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.else.loc26: +// CHECK:STDOUT: br !while.cond.loc24 +// CHECK:STDOUT: +// CHECK:STDOUT: !while.done.loc24: +// CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.8] +// CHECK:STDOUT: %G.call: init bool = call %G.ref() +// CHECK:STDOUT: %.loc28_12.1: bool = value_of_initializer %G.call +// CHECK:STDOUT: %.loc28_12.2: bool = converted %G.call, %.loc28_12.1 +// CHECK:STDOUT: if %.loc28_12.2 br !if.then.loc28 else br !if.else.loc28 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.then.loc28: +// CHECK:STDOUT: br !while.cond.loc21 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.else.loc28: +// CHECK:STDOUT: %H.ref: H = name_ref H, file.%H.decl [template = constants.%struct.9] +// CHECK:STDOUT: %H.call: init bool = call %H.ref() +// CHECK:STDOUT: %.loc29_12.1: bool = value_of_initializer %H.call +// CHECK:STDOUT: %.loc29_12.2: bool = converted %H.call, %.loc29_12.1 +// CHECK:STDOUT: if %.loc29_12.2 br !if.then.loc29 else br !if.else.loc29 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.then.loc29: +// CHECK:STDOUT: br !while.done.loc21 +// CHECK:STDOUT: +// CHECK:STDOUT: !if.else.loc29: +// CHECK:STDOUT: br !while.cond.loc21 +// CHECK:STDOUT: +// CHECK:STDOUT: !while.done.loc21: // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/while/fail_bad_condition.carbon b/toolchain/check/testdata/while/fail_bad_condition.carbon index 8603a59a1fa5..df85366b82f2 100644 --- a/toolchain/check/testdata/while/fail_bad_condition.carbon +++ b/toolchain/check/testdata/while/fail_bad_condition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/while/fail_bad_condition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/while/fail_bad_condition.carbon fn While() { // CHECK:STDERR: fail_bad_condition.carbon:[[@LINE+3]]:9: ERROR: Cannot implicitly convert from `String` to `bool`. @@ -35,7 +39,7 @@ fn While() { // CHECK:STDOUT: br !while.cond // CHECK:STDOUT: // CHECK:STDOUT: !while.cond: -// CHECK:STDOUT: %.loc11: String = string_literal "Hello" [template = constants.%.3] +// CHECK:STDOUT: %.loc15: String = string_literal "Hello" [template = constants.%.3] // CHECK:STDOUT: if br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: diff --git a/toolchain/check/testdata/while/fail_break_continue.carbon b/toolchain/check/testdata/while/fail_break_continue.carbon index d6b13ad8bb9e..5ae9347d836d 100644 --- a/toolchain/check/testdata/while/fail_break_continue.carbon +++ b/toolchain/check/testdata/while/fail_break_continue.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/while/fail_break_continue.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/while/fail_break_continue.carbon fn While() { // CHECK:STDERR: fail_break_continue.carbon:[[@LINE+4]]:3: ERROR: `continue` can only be used in a loop. diff --git a/toolchain/check/testdata/while/unreachable_end.carbon b/toolchain/check/testdata/while/unreachable_end.carbon index 46c298d3d6c3..bf547e23787a 100644 --- a/toolchain/check/testdata/while/unreachable_end.carbon +++ b/toolchain/check/testdata/while/unreachable_end.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/while/unreachable_end.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/while/unreachable_end.carbon fn Cond() -> bool; @@ -50,8 +54,8 @@ fn While() { // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.2] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_14.2: type = converted %bool.make_type, %.loc7_14.1 [template = bool] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_14.2: type = converted %bool.make_type, %.loc11_14.1 [template = bool] // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} @@ -79,9 +83,9 @@ fn While() { // CHECK:STDOUT: !while.cond: // CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.2] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() -// CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call -// CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 -// CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done +// CHECK:STDOUT: %.loc19_16.1: bool = value_of_initializer %Cond.call +// CHECK:STDOUT: %.loc19_16.2: bool = converted %Cond.call, %.loc19_16.1 +// CHECK:STDOUT: if %.loc19_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.4] diff --git a/toolchain/check/testdata/while/while.carbon b/toolchain/check/testdata/while/while.carbon index d84cd00bddc6..3b28716770e7 100644 --- a/toolchain/check/testdata/while/while.carbon +++ b/toolchain/check/testdata/while/while.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/while/while.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/while/while.carbon fn Cond() -> bool; @@ -49,8 +53,8 @@ fn While() { // CHECK:STDOUT: %import_ref: Bool = import_ref ir7, inst+2, loaded [template = constants.%struct.1] // CHECK:STDOUT: %Cond.decl: Cond = fn_decl @Cond [template = constants.%struct.2] { // CHECK:STDOUT: %bool.make_type: init type = call constants.%struct.1() [template = bool] -// CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %bool.make_type [template = bool] -// CHECK:STDOUT: %.loc7_14.2: type = converted %bool.make_type, %.loc7_14.1 [template = bool] +// CHECK:STDOUT: %.loc11_14.1: type = value_of_initializer %bool.make_type [template = bool] +// CHECK:STDOUT: %.loc11_14.2: type = converted %bool.make_type, %.loc11_14.1 [template = bool] // CHECK:STDOUT: @Cond.%return: ref bool = var // CHECK:STDOUT: } // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct.3] {} @@ -78,9 +82,9 @@ fn While() { // CHECK:STDOUT: !while.cond: // CHECK:STDOUT: %Cond.ref: Cond = name_ref Cond, file.%Cond.decl [template = constants.%struct.2] // CHECK:STDOUT: %Cond.call: init bool = call %Cond.ref() -// CHECK:STDOUT: %.loc15_16.1: bool = value_of_initializer %Cond.call -// CHECK:STDOUT: %.loc15_16.2: bool = converted %Cond.call, %.loc15_16.1 -// CHECK:STDOUT: if %.loc15_16.2 br !while.body else br !while.done +// CHECK:STDOUT: %.loc19_16.1: bool = value_of_initializer %Cond.call +// CHECK:STDOUT: %.loc19_16.2: bool = converted %Cond.call, %.loc19_16.1 +// CHECK:STDOUT: if %.loc19_16.2 br !while.body else br !while.done // CHECK:STDOUT: // CHECK:STDOUT: !while.body: // CHECK:STDOUT: %G.ref: G = name_ref G, file.%G.decl [template = constants.%struct.4] diff --git a/toolchain/codegen/testdata/objcode/basic.carbon b/toolchain/codegen/testdata/objcode/basic.carbon index 5c4e8dd8a77c..2e253c32689f 100644 --- a/toolchain/codegen/testdata/objcode/basic.carbon +++ b/toolchain/codegen/testdata/objcode/basic.carbon @@ -6,5 +6,9 @@ // // TODO: Add a way to write some basic tests for object file outputs. // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/codegen/testdata/objcode/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/codegen/testdata/objcode/basic.carbon fn Main() {} diff --git a/toolchain/diagnostics/testdata/fail_multiline_token.carbon b/toolchain/diagnostics/testdata/fail_multiline_token.carbon index b45357289caa..83f428e51b8c 100644 --- a/toolchain/diagnostics/testdata/fail_multiline_token.carbon +++ b/toolchain/diagnostics/testdata/fail_multiline_token.carbon @@ -5,6 +5,10 @@ // ARGS: compile --phase=parse %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/diagnostics/testdata/fail_multiline_token.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/diagnostics/testdata/fail_multiline_token.carbon // CHECK:STDERR: fail_multiline_token.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: ''' diff --git a/toolchain/driver/testdata/dump_shared_values.carbon b/toolchain/driver/testdata/dump_shared_values.carbon index b2d4b95cd30f..14106f23db71 100644 --- a/toolchain/driver/testdata/dump_shared_values.carbon +++ b/toolchain/driver/testdata/dump_shared_values.carbon @@ -5,6 +5,10 @@ // ARGS: compile --phase=lex --dump-shared-values %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/dump_shared_values.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/dump_shared_values.carbon // The value 8 is significant because it can show as negative due to APInt. var int1: i32 = 1; diff --git a/toolchain/driver/testdata/fail_errors_in_two_files.carbon b/toolchain/driver/testdata/fail_errors_in_two_files.carbon index 3a8d10f514a2..56d0b1423d33 100644 --- a/toolchain/driver/testdata/fail_errors_in_two_files.carbon +++ b/toolchain/driver/testdata/fail_errors_in_two_files.carbon @@ -5,6 +5,10 @@ // ARGS: compile --phase=lex %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_errors_in_two_files.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_errors_in_two_files.carbon // --- fail_file1.carbon diff --git a/toolchain/driver/testdata/fail_errors_sorted.carbon b/toolchain/driver/testdata/fail_errors_sorted.carbon index d8d0714f3af1..256d7168a7f0 100644 --- a/toolchain/driver/testdata/fail_errors_sorted.carbon +++ b/toolchain/driver/testdata/fail_errors_sorted.carbon @@ -5,6 +5,10 @@ // ARGS: compile --phase=lex %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_errors_sorted.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_errors_sorted.carbon // CHECK:STDERR: fail_errors_sorted.carbon:[[@LINE+4]]:24: ERROR: Opening symbol without a corresponding closing symbol. // CHECK:STDERR: fn run(String program) { diff --git a/toolchain/driver/testdata/fail_errors_streamed.carbon b/toolchain/driver/testdata/fail_errors_streamed.carbon index e720f33b15df..a052c0e7a399 100644 --- a/toolchain/driver/testdata/fail_errors_streamed.carbon +++ b/toolchain/driver/testdata/fail_errors_streamed.carbon @@ -5,6 +5,10 @@ // ARGS: compile --phase=lex --stream-errors %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_errors_streamed.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_errors_streamed.carbon fn run(String program) { return True; diff --git a/toolchain/driver/testdata/fail_flush_errors.carbon b/toolchain/driver/testdata/fail_flush_errors.carbon index 02208a8a96cd..8245ac5749b7 100644 --- a/toolchain/driver/testdata/fail_flush_errors.carbon +++ b/toolchain/driver/testdata/fail_flush_errors.carbon @@ -5,6 +5,10 @@ // ARGS: compile --no-prelude-import %s // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_flush_errors.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_flush_errors.carbon fn F() { // Create diagnostics containing string references, and trigger reallocation diff --git a/toolchain/driver/testdata/fail_input_is_directory.carbon b/toolchain/driver/testdata/fail_input_is_directory.carbon index 6f496a4b4ca5..1425b976c64c 100644 --- a/toolchain/driver/testdata/fail_input_is_directory.carbon +++ b/toolchain/driver/testdata/fail_input_is_directory.carbon @@ -5,4 +5,8 @@ // ARGS: compile . // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_input_is_directory.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_input_is_directory.carbon // CHECK:STDERR: .: ERROR: Error opening file for read: Invalid argument diff --git a/toolchain/driver/testdata/fail_missing_file.carbon b/toolchain/driver/testdata/fail_missing_file.carbon index ada4d3149a56..9aabadeaa904 100644 --- a/toolchain/driver/testdata/fail_missing_file.carbon +++ b/toolchain/driver/testdata/fail_missing_file.carbon @@ -5,4 +5,8 @@ // ARGS: compile not_file.carbon // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_missing_file.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_missing_file.carbon // CHECK:STDERR: not_file.carbon: ERROR: Error opening file for read: No such file or directory diff --git a/toolchain/driver/testdata/fail_missing_stdin_output.carbon b/toolchain/driver/testdata/fail_missing_stdin_output.carbon index 4aba91f3e3e1..6dd31bdbead9 100644 --- a/toolchain/driver/testdata/fail_missing_stdin_output.carbon +++ b/toolchain/driver/testdata/fail_missing_stdin_output.carbon @@ -5,4 +5,8 @@ // ARGS: compile --no-prelude-import - // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/fail_missing_stdin_output.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/fail_missing_stdin_output.carbon // CHECK:STDERR: ERROR: Output file name must be specified for input '-' that is not a regular file. diff --git a/toolchain/driver/testdata/stdin.carbon b/toolchain/driver/testdata/stdin.carbon index fb2ff26da605..247cc27ce8a9 100644 --- a/toolchain/driver/testdata/stdin.carbon +++ b/toolchain/driver/testdata/stdin.carbon @@ -5,6 +5,10 @@ // ARGS: compile - --no-prelude-import --phase=check --dump-sem-ir // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/stdin.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/stdin.carbon // CHECK:STDOUT: --- // CHECK:STDOUT: diff --git a/toolchain/lex/testdata/basic_syntax.carbon b/toolchain/lex/testdata/basic_syntax.carbon index c208c454a3d9..17e473305f65 100644 --- a/toolchain/lex/testdata/basic_syntax.carbon +++ b/toolchain/lex/testdata/basic_syntax.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/basic_syntax.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/basic_syntax.carbon // CHECK:STDOUT: - filename: basic_syntax.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/fail_bad_comment_introducers.carbon b/toolchain/lex/testdata/fail_bad_comment_introducers.carbon index 20dae3d2edf4..1f33ee0a4000 100644 --- a/toolchain/lex/testdata/fail_bad_comment_introducers.carbon +++ b/toolchain/lex/testdata/fail_bad_comment_introducers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_bad_comment_introducers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_bad_comment_introducers.carbon // CHECK:STDOUT: - filename: fail_bad_comment_introducers.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon b/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon index 0710517b88ac..e460b90b1ac8 100644 --- a/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon +++ b/toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon @@ -19,15 +19,19 @@ // We move the auto-update marker to the end to ensure that the added CHECKs // don't interrupt the specific block structures above. // AUTOUPDATE -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-13]]:3: ERROR: Whitespace is required after '//'. +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_bad_comment_introducers_mid_block_indent_change.carbon +// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-17]]:3: ERROR: Whitespace is required after '//'. // CHECK:STDERR: //abc // CHECK:STDERR: ^ // CHECK:STDERR: -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-14]]:5: ERROR: Whitespace is required after '//'. +// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-18]]:5: ERROR: Whitespace is required after '//'. // CHECK:STDERR: //abc // CHECK:STDERR: ^ // CHECK:STDERR: -// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-15]]:3: ERROR: Whitespace is required after '//'. +// CHECK:STDERR: fail_bad_comment_introducers_mid_block_indent_change.carbon:[[@LINE-19]]:3: ERROR: Whitespace is required after '//'. // CHECK:STDERR: //abc // CHECK:STDERR: ^ // CHECK:STDOUT: - filename: fail_bad_comment_introducers_mid_block_indent_change.carbon diff --git a/toolchain/lex/testdata/fail_bad_raw_identifier.carbon b/toolchain/lex/testdata/fail_bad_raw_identifier.carbon index 6874f3c35d01..f8207f213b5c 100644 --- a/toolchain/lex/testdata/fail_bad_raw_identifier.carbon +++ b/toolchain/lex/testdata/fail_bad_raw_identifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_bad_raw_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_bad_raw_identifier.carbon // --- fail_bad_raw_identifier.carbon // CHECK:STDOUT: - filename: fail_bad_raw_identifier.carbon diff --git a/toolchain/lex/testdata/fail_block_string_second_line.carbon b/toolchain/lex/testdata/fail_block_string_second_line.carbon index 4ec42449196b..94d78eb6d1c5 100644 --- a/toolchain/lex/testdata/fail_block_string_second_line.carbon +++ b/toolchain/lex/testdata/fail_block_string_second_line.carbon @@ -9,18 +9,22 @@ var s: String = ''' // the block string. // // AUTOUPDATE -// CHECK:STDERR: fail_block_string_second_line.carbon:[[@LINE-6]]:3: ERROR: Only whitespace is permitted before the closing `'''` of a multi-line string. +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_block_string_second_line.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_block_string_second_line.carbon +// CHECK:STDERR: fail_block_string_second_line.carbon:[[@LINE-10]]:3: ERROR: Only whitespace is permitted before the closing `'''` of a multi-line string. // CHECK:STDERR: error here: ''' // CHECK:STDERR: ^ // CHECK:STDOUT: - filename: fail_block_string_second_line.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, -// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-13]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, -// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-14]], column: 5, indent: 1, spelling: 's', identifier: 0 }, -// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-15]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, -// CHECK:STDOUT: { index: 4, kind: 'StringTypeLiteral', line: {{ *}}[[@LINE-16]], column: 8, indent: 1, spelling: 'String', has_trailing_space: true }, -// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-17]], column: 15, indent: 1, spelling: '=', has_trailing_space: true }, -// CHECK:STDOUT: { index: 6, kind: 'StringLiteral', line: {{ *}}[[@LINE-18]], column: 17, indent: 1, spelling: '''' +// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-17]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, +// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-18]], column: 5, indent: 1, spelling: 's', identifier: 0 }, +// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-19]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, +// CHECK:STDOUT: { index: 4, kind: 'StringTypeLiteral', line: {{ *}}[[@LINE-20]], column: 8, indent: 1, spelling: 'String', has_trailing_space: true }, +// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-21]], column: 15, indent: 1, spelling: '=', has_trailing_space: true }, +// CHECK:STDOUT: { index: 6, kind: 'StringLiteral', line: {{ *}}[[@LINE-22]], column: 17, indent: 1, spelling: '''' // CHECK:STDOUT: error here: '''', value: `error here: `, has_trailing_space: true }, // CHECK:STDOUT: { index: 7, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' }, diff --git a/toolchain/lex/testdata/fail_mismatched_brackets.carbon b/toolchain/lex/testdata/fail_mismatched_brackets.carbon index f5b75ce1eb6f..4f0a30c914ba 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_mismatched_brackets.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_mismatched_brackets.carbon // CHECK:STDOUT: - filename: fail_mismatched_brackets.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/fail_mismatched_brackets_2.carbon b/toolchain/lex/testdata/fail_mismatched_brackets_2.carbon index 317807a60625..b501b90340df 100644 --- a/toolchain/lex/testdata/fail_mismatched_brackets_2.carbon +++ b/toolchain/lex/testdata/fail_mismatched_brackets_2.carbon @@ -14,25 +14,29 @@ fn F() { // The check lines are inserted at the end so that they don't disrupt the // indentation of lines in the text. // AUTOUPDATE -// CHECK:STDERR: fail_mismatched_brackets_2.carbon:[[@LINE-5]]:1: ERROR: Closing symbol without a corresponding opening symbol. +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_mismatched_brackets_2.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_mismatched_brackets_2.carbon +// CHECK:STDERR: fail_mismatched_brackets_2.carbon:[[@LINE-9]]:1: ERROR: Closing symbol without a corresponding opening symbol. // CHECK:STDERR: } // CHECK:STDERR: ^ // CHECK:STDOUT: - filename: fail_mismatched_brackets_2.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, -// CHECK:STDOUT: { index: 1, kind: 'Fn', line: {{ *}}[[@LINE-15]], column: 1, indent: 1, spelling: 'fn', has_trailing_space: true }, -// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-16]], column: 4, indent: 1, spelling: 'F', identifier: 0 }, -// CHECK:STDOUT: { index: 3, kind: 'OpenParen', line: {{ *}}[[@LINE-17]], column: 5, indent: 1, spelling: '(', closing_token: 4 }, -// CHECK:STDOUT: { index: 4, kind: 'CloseParen', line: {{ *}}[[@LINE-18]], column: 6, indent: 1, spelling: ')', opening_token: 3, has_trailing_space: true }, -// CHECK:STDOUT: { index: 5, kind: 'OpenCurlyBrace', line: {{ *}}[[@LINE-19]], column: 8, indent: 1, spelling: '{', closing_token: 12, has_trailing_space: true }, -// CHECK:STDOUT: { index: 6, kind: 'If', line: {{ *}}[[@LINE-19]], column: 3, indent: 3, spelling: 'if', has_trailing_space: true }, -// CHECK:STDOUT: { index: 7, kind: 'OpenParen', line: {{ *}}[[@LINE-20]], column: 6, indent: 3, spelling: '(', closing_token: 9 }, -// CHECK:STDOUT: { index: 8, kind: 'Identifier', line: {{ *}}[[@LINE-21]], column: 7, indent: 3, spelling: 'thing1', identifier: 1 }, -// CHECK:STDOUT: { index: 9, kind: 'CloseParen', line: {{ *}}[[@LINE-22]], column: 13, indent: 3, spelling: ')', opening_token: 7, has_trailing_space: true }, -// CHECK:STDOUT: { index: 10, kind: 'Identifier', line: {{ *}}[[@LINE-22]], column: 5, indent: 5, spelling: 'thing2', identifier: 2 }, -// CHECK:STDOUT: { index: 11, kind: 'Semi', line: {{ *}}[[@LINE-23]], column: 11, indent: 5, spelling: ';', has_trailing_space: true }, -// CHECK:STDOUT: { index: 12, kind: 'CloseCurlyBrace', line: {{ *}}[[@LINE-23]], column: 3, indent: 3, spelling: '}', opening_token: 5, has_trailing_space: true }, -// CHECK:STDOUT: { index: 13, kind: 'Error', line: {{ *}}[[@LINE-23]], column: 1, indent: 1, spelling: '}', has_trailing_space: true }, +// CHECK:STDOUT: { index: 1, kind: 'Fn', line: {{ *}}[[@LINE-19]], column: 1, indent: 1, spelling: 'fn', has_trailing_space: true }, +// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-20]], column: 4, indent: 1, spelling: 'F', identifier: 0 }, +// CHECK:STDOUT: { index: 3, kind: 'OpenParen', line: {{ *}}[[@LINE-21]], column: 5, indent: 1, spelling: '(', closing_token: 4 }, +// CHECK:STDOUT: { index: 4, kind: 'CloseParen', line: {{ *}}[[@LINE-22]], column: 6, indent: 1, spelling: ')', opening_token: 3, has_trailing_space: true }, +// CHECK:STDOUT: { index: 5, kind: 'OpenCurlyBrace', line: {{ *}}[[@LINE-23]], column: 8, indent: 1, spelling: '{', closing_token: 12, has_trailing_space: true }, +// CHECK:STDOUT: { index: 6, kind: 'If', line: {{ *}}[[@LINE-23]], column: 3, indent: 3, spelling: 'if', has_trailing_space: true }, +// CHECK:STDOUT: { index: 7, kind: 'OpenParen', line: {{ *}}[[@LINE-24]], column: 6, indent: 3, spelling: '(', closing_token: 9 }, +// CHECK:STDOUT: { index: 8, kind: 'Identifier', line: {{ *}}[[@LINE-25]], column: 7, indent: 3, spelling: 'thing1', identifier: 1 }, +// CHECK:STDOUT: { index: 9, kind: 'CloseParen', line: {{ *}}[[@LINE-26]], column: 13, indent: 3, spelling: ')', opening_token: 7, has_trailing_space: true }, +// CHECK:STDOUT: { index: 10, kind: 'Identifier', line: {{ *}}[[@LINE-26]], column: 5, indent: 5, spelling: 'thing2', identifier: 2 }, +// CHECK:STDOUT: { index: 11, kind: 'Semi', line: {{ *}}[[@LINE-27]], column: 11, indent: 5, spelling: ';', has_trailing_space: true }, +// CHECK:STDOUT: { index: 12, kind: 'CloseCurlyBrace', line: {{ *}}[[@LINE-27]], column: 3, indent: 3, spelling: '}', opening_token: 5, has_trailing_space: true }, +// CHECK:STDOUT: { index: 13, kind: 'Error', line: {{ *}}[[@LINE-27]], column: 1, indent: 1, spelling: '}', has_trailing_space: true }, // CHECK:STDOUT: { index: 14, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' }, // CHECK:STDOUT: ] diff --git a/toolchain/lex/testdata/fail_multifile.carbon b/toolchain/lex/testdata/fail_multifile.carbon index a87c9028790a..e3ab12f23edf 100644 --- a/toolchain/lex/testdata/fail_multifile.carbon +++ b/toolchain/lex/testdata/fail_multifile.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_multifile.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_multifile.carbon // --- fail_a.carbon // CHECK:STDOUT: - filename: fail_a.carbon diff --git a/toolchain/lex/testdata/fail_trailing_comments.carbon b/toolchain/lex/testdata/fail_trailing_comments.carbon index 2a39528f6148..096e5f751dcf 100644 --- a/toolchain/lex/testdata/fail_trailing_comments.carbon +++ b/toolchain/lex/testdata/fail_trailing_comments.carbon @@ -12,41 +12,45 @@ var c: i32 = 0.4; // still more trailing comment // We keep the auto-update marker below the above so check lines don't disrupt // the trailing comment lines with similar prefixes. // AUTOUPDATE -// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-7]]:19: ERROR: Trailing comments are not permitted. +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/fail_trailing_comments.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/fail_trailing_comments.carbon +// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-11]]:19: ERROR: Trailing comments are not permitted. // CHECK:STDERR: var a: i32 = 1; // trailing comment // CHECK:STDERR: ^ // CHECK:STDERR: -// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-10]]:19: ERROR: Trailing comments are not permitted. +// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-14]]:19: ERROR: Trailing comments are not permitted. // CHECK:STDERR: var b: 32 = 13; // more trailing comment // CHECK:STDERR: ^ // CHECK:STDERR: -// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-13]]:19: ERROR: Trailing comments are not permitted. +// CHECK:STDERR: fail_trailing_comments.carbon:[[@LINE-17]]:19: ERROR: Trailing comments are not permitted. // CHECK:STDERR: var c: i32 = 0.4; // still more trailing comment // CHECK:STDERR: ^ // CHECK:STDOUT: - filename: fail_trailing_comments.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, -// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-21]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, -// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-22]], column: 5, indent: 1, spelling: 'a', identifier: 0 }, -// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-23]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, -// CHECK:STDOUT: { index: 4, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-24]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true }, -// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-25]], column: 12, indent: 1, spelling: '=', has_trailing_space: true }, -// CHECK:STDOUT: { index: 6, kind: 'IntLiteral', line: {{ *}}[[@LINE-26]], column: 14, indent: 1, spelling: '1', value: `1` }, -// CHECK:STDOUT: { index: 7, kind: 'Semi', line: {{ *}}[[@LINE-27]], column: 15, indent: 1, spelling: ';', has_trailing_space: true }, -// CHECK:STDOUT: { index: 8, kind: 'Var', line: {{ *}}[[@LINE-27]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, -// CHECK:STDOUT: { index: 9, kind: 'Identifier', line: {{ *}}[[@LINE-28]], column: 5, indent: 1, spelling: 'b', identifier: 1 }, -// CHECK:STDOUT: { index: 10, kind: 'Colon', line: {{ *}}[[@LINE-29]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, -// CHECK:STDOUT: { index: 11, kind: 'IntLiteral', line: {{ *}}[[@LINE-30]], column: 8, indent: 1, spelling: '32', value: `32`, has_trailing_space: true }, -// CHECK:STDOUT: { index: 12, kind: 'Equal', line: {{ *}}[[@LINE-31]], column: 11, indent: 1, spelling: '=', has_trailing_space: true }, -// CHECK:STDOUT: { index: 13, kind: 'IntLiteral', line: {{ *}}[[@LINE-32]], column: 13, indent: 1, spelling: '13', value: `13` }, -// CHECK:STDOUT: { index: 14, kind: 'Semi', line: {{ *}}[[@LINE-33]], column: 15, indent: 1, spelling: ';', has_trailing_space: true }, -// CHECK:STDOUT: { index: 15, kind: 'Var', line: {{ *}}[[@LINE-33]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, -// CHECK:STDOUT: { index: 16, kind: 'Identifier', line: {{ *}}[[@LINE-34]], column: 5, indent: 1, spelling: 'c', identifier: 2 }, -// CHECK:STDOUT: { index: 17, kind: 'Colon', line: {{ *}}[[@LINE-35]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, -// CHECK:STDOUT: { index: 18, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-36]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true }, -// CHECK:STDOUT: { index: 19, kind: 'Equal', line: {{ *}}[[@LINE-37]], column: 12, indent: 1, spelling: '=', has_trailing_space: true }, -// CHECK:STDOUT: { index: 20, kind: 'RealLiteral', line: {{ *}}[[@LINE-38]], column: 14, indent: 1, spelling: '0.4', value: `4*10^-1` }, -// CHECK:STDOUT: { index: 21, kind: 'Semi', line: {{ *}}[[@LINE-39]], column: 17, indent: 1, spelling: ';', has_trailing_space: true }, +// CHECK:STDOUT: { index: 1, kind: 'Var', line: {{ *}}[[@LINE-25]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, +// CHECK:STDOUT: { index: 2, kind: 'Identifier', line: {{ *}}[[@LINE-26]], column: 5, indent: 1, spelling: 'a', identifier: 0 }, +// CHECK:STDOUT: { index: 3, kind: 'Colon', line: {{ *}}[[@LINE-27]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, +// CHECK:STDOUT: { index: 4, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-28]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true }, +// CHECK:STDOUT: { index: 5, kind: 'Equal', line: {{ *}}[[@LINE-29]], column: 12, indent: 1, spelling: '=', has_trailing_space: true }, +// CHECK:STDOUT: { index: 6, kind: 'IntLiteral', line: {{ *}}[[@LINE-30]], column: 14, indent: 1, spelling: '1', value: `1` }, +// CHECK:STDOUT: { index: 7, kind: 'Semi', line: {{ *}}[[@LINE-31]], column: 15, indent: 1, spelling: ';', has_trailing_space: true }, +// CHECK:STDOUT: { index: 8, kind: 'Var', line: {{ *}}[[@LINE-31]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, +// CHECK:STDOUT: { index: 9, kind: 'Identifier', line: {{ *}}[[@LINE-32]], column: 5, indent: 1, spelling: 'b', identifier: 1 }, +// CHECK:STDOUT: { index: 10, kind: 'Colon', line: {{ *}}[[@LINE-33]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, +// CHECK:STDOUT: { index: 11, kind: 'IntLiteral', line: {{ *}}[[@LINE-34]], column: 8, indent: 1, spelling: '32', value: `32`, has_trailing_space: true }, +// CHECK:STDOUT: { index: 12, kind: 'Equal', line: {{ *}}[[@LINE-35]], column: 11, indent: 1, spelling: '=', has_trailing_space: true }, +// CHECK:STDOUT: { index: 13, kind: 'IntLiteral', line: {{ *}}[[@LINE-36]], column: 13, indent: 1, spelling: '13', value: `13` }, +// CHECK:STDOUT: { index: 14, kind: 'Semi', line: {{ *}}[[@LINE-37]], column: 15, indent: 1, spelling: ';', has_trailing_space: true }, +// CHECK:STDOUT: { index: 15, kind: 'Var', line: {{ *}}[[@LINE-37]], column: 1, indent: 1, spelling: 'var', has_trailing_space: true }, +// CHECK:STDOUT: { index: 16, kind: 'Identifier', line: {{ *}}[[@LINE-38]], column: 5, indent: 1, spelling: 'c', identifier: 2 }, +// CHECK:STDOUT: { index: 17, kind: 'Colon', line: {{ *}}[[@LINE-39]], column: 6, indent: 1, spelling: ':', has_trailing_space: true }, +// CHECK:STDOUT: { index: 18, kind: 'IntTypeLiteral', line: {{ *}}[[@LINE-40]], column: 8, indent: 1, spelling: 'i32', has_trailing_space: true }, +// CHECK:STDOUT: { index: 19, kind: 'Equal', line: {{ *}}[[@LINE-41]], column: 12, indent: 1, spelling: '=', has_trailing_space: true }, +// CHECK:STDOUT: { index: 20, kind: 'RealLiteral', line: {{ *}}[[@LINE-42]], column: 14, indent: 1, spelling: '0.4', value: `4*10^-1` }, +// CHECK:STDOUT: { index: 21, kind: 'Semi', line: {{ *}}[[@LINE-43]], column: 17, indent: 1, spelling: ';', has_trailing_space: true }, // CHECK:STDOUT: { index: 22, kind: 'FileEnd', line: {{ *}}[[@LINE+1]], column: {{ *\d+}}, indent: 1, spelling: '' }, // CHECK:STDOUT: ] diff --git a/toolchain/lex/testdata/keywords.carbon b/toolchain/lex/testdata/keywords.carbon index e107eba99f3e..c56f1da7f25f 100644 --- a/toolchain/lex/testdata/keywords.carbon +++ b/toolchain/lex/testdata/keywords.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/keywords.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/keywords.carbon // --- indented.carbon // CHECK:STDOUT: - filename: indented.carbon diff --git a/toolchain/lex/testdata/multifile.carbon b/toolchain/lex/testdata/multifile.carbon index 42745b56b789..45f0177459eb 100644 --- a/toolchain/lex/testdata/multifile.carbon +++ b/toolchain/lex/testdata/multifile.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/multifile.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/multifile.carbon // --- a.carbon // CHECK:STDOUT: - filename: a.carbon diff --git a/toolchain/lex/testdata/numeric_literals.carbon b/toolchain/lex/testdata/numeric_literals.carbon index ebce216f1a3c..fd0ee666b2de 100644 --- a/toolchain/lex/testdata/numeric_literals.carbon +++ b/toolchain/lex/testdata/numeric_literals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/numeric_literals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/numeric_literals.carbon // CHECK:STDOUT: - filename: numeric_literals.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/printing_digit_padding.carbon b/toolchain/lex/testdata/printing_digit_padding.carbon index a7fec13d08f0..12431c564fe9 100644 --- a/toolchain/lex/testdata/printing_digit_padding.carbon +++ b/toolchain/lex/testdata/printing_digit_padding.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/printing_digit_padding.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/printing_digit_padding.carbon // CHECK:STDOUT: - filename: printing_digit_padding.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/printing_integer_literal.carbon b/toolchain/lex/testdata/printing_integer_literal.carbon index e7fe138909f5..1d95ad61cdbc 100644 --- a/toolchain/lex/testdata/printing_integer_literal.carbon +++ b/toolchain/lex/testdata/printing_integer_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/printing_integer_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/printing_integer_literal.carbon // CHECK:STDOUT: - filename: printing_integer_literal.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/printing_real_literal.carbon b/toolchain/lex/testdata/printing_real_literal.carbon index 60aebaec149b..674032301bfe 100644 --- a/toolchain/lex/testdata/printing_real_literal.carbon +++ b/toolchain/lex/testdata/printing_real_literal.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/printing_real_literal.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/printing_real_literal.carbon // CHECK:STDOUT: - filename: printing_real_literal.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/printing_token.carbon b/toolchain/lex/testdata/printing_token.carbon index eb2a978ae0e6..a985a75f9902 100644 --- a/toolchain/lex/testdata/printing_token.carbon +++ b/toolchain/lex/testdata/printing_token.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/printing_token.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/printing_token.carbon // CHECK:STDOUT: - filename: printing_token.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lex/testdata/raw_identifier.carbon b/toolchain/lex/testdata/raw_identifier.carbon index 6e25bfd8227f..0312fc04666d 100644 --- a/toolchain/lex/testdata/raw_identifier.carbon +++ b/toolchain/lex/testdata/raw_identifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lex/testdata/raw_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lex/testdata/raw_identifier.carbon // CHECK:STDOUT: - filename: raw_identifier.carbon // CHECK:STDOUT: tokens: [ // CHECK:STDOUT: { index: 0, kind: 'FileStart', line: {{ *\d+}}, column: 1, indent: 1, spelling: '', has_trailing_space: true }, diff --git a/toolchain/lower/testdata/alias/local.carbon b/toolchain/lower/testdata/alias/local.carbon index 1606efec7c04..24f6f8378976 100644 --- a/toolchain/lower/testdata/alias/local.carbon +++ b/toolchain/lower/testdata/alias/local.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/alias/local.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/alias/local.carbon fn F() -> i32 { var a: i32 = 0; @@ -17,6 +21,6 @@ fn F() -> i32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4 // CHECK:STDOUT: store i32 0, ptr %a.var, align 4 -// CHECK:STDOUT: %.loc10 = load i32, ptr %a.var, align 4 -// CHECK:STDOUT: ret i32 %.loc10 +// CHECK:STDOUT: %.loc14 = load i32, ptr %a.var, align 4 +// CHECK:STDOUT: ret i32 %.loc14 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/array_in_place.carbon b/toolchain/lower/testdata/array/array_in_place.carbon index 14acb2dc3593..0fa4a80255a0 100644 --- a/toolchain/lower/testdata/array/array_in_place.carbon +++ b/toolchain/lower/testdata/array/array_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/array/array_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/array/array_in_place.carbon fn F() -> (i32, i32, i32); @@ -18,9 +22,9 @@ fn G() { // CHECK:STDOUT: define void @G() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca [2 x { i32, i32, i32 }], align 8 -// CHECK:STDOUT: %.loc10_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc10_42.2.array.index) -// CHECK:STDOUT: %.loc10_42.5.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc10_42.5.array.index) +// CHECK:STDOUT: %.loc14_42.2.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc14_42.2.array.index) +// CHECK:STDOUT: %.loc14_42.5.array.index = getelementptr inbounds [2 x { i32, i32, i32 }], ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc14_42.5.array.index) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/array/assign_return_value.carbon b/toolchain/lower/testdata/array/assign_return_value.carbon index 57f405d8a6ca..bc66ecdd9eb2 100644 --- a/toolchain/lower/testdata/array/assign_return_value.carbon +++ b/toolchain/lower/testdata/array/assign_return_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/array/assign_return_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/array/assign_return_value.carbon fn F() -> (i32, i32) { return (12, 24); } @@ -13,29 +17,29 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'assign_return_value.carbon' // CHECK:STDOUT: source_filename = "assign_return_value.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc7_39 = internal constant { i32, i32 } { i32 12, i32 24 } +// CHECK:STDOUT: @tuple.loc11_39 = internal constant { i32, i32 } { i32 12, i32 24 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc7_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc7_39, i64 8, i1 false) +// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t.var = alloca [2 x i32], align 4 -// CHECK:STDOUT: %.loc10_22.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc10_22.1.temp) -// CHECK:STDOUT: %.loc10_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc10_22.1.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_22.4 = load i32, ptr %.loc10_22.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc10_22.6.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc10_22.4, ptr %.loc10_22.6.array.index, align 4 -// CHECK:STDOUT: %.loc10_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc10_22.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc10_22.9 = load i32, ptr %.loc10_22.8.tuple.elem, align 4 -// CHECK:STDOUT: %.loc10_22.11.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc10_22.9, ptr %.loc10_22.11.array.index, align 4 +// CHECK:STDOUT: %.loc14_22.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @F(ptr %.loc14_22.1.temp) +// CHECK:STDOUT: %.loc14_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc14_22.4 = load i32, ptr %.loc14_22.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc14_22.6.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc14_22.4, ptr %.loc14_22.6.array.index, align 4 +// CHECK:STDOUT: %.loc14_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc14_22.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_22.9 = load i32, ptr %.loc14_22.8.tuple.elem, align 4 +// CHECK:STDOUT: %.loc14_22.11.array.index = getelementptr inbounds [2 x i32], ptr %t.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc14_22.9, ptr %.loc14_22.11.array.index, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/array/base.carbon b/toolchain/lower/testdata/array/base.carbon index dc882a500845..e6f86ed0e3dd 100644 --- a/toolchain/lower/testdata/array/base.carbon +++ b/toolchain/lower/testdata/array/base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/array/base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/array/base.carbon fn Run() { var a: [i32; 1] = (1,); @@ -15,45 +19,45 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'base.carbon' // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.1.loc8_25 = internal constant [1 x i32] [i32 1] -// CHECK:STDOUT: @array.2.loc9_33 = internal constant [2 x double] [double 0x4026333333333334, double 2.200000e+00] -// CHECK:STDOUT: @array.3.loc10_41 = internal constant [5 x {}] zeroinitializer -// CHECK:STDOUT: @tuple.2.loc11_37 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } +// CHECK:STDOUT: @array.1.loc12_25 = internal constant [1 x i32] [i32 1] +// CHECK:STDOUT: @array.2.loc13_33 = internal constant [2 x double] [double 0x4026333333333334, double 2.200000e+00] +// CHECK:STDOUT: @array.3.loc14_41 = internal constant [5 x {}] zeroinitializer +// CHECK:STDOUT: @tuple.2.loc15_37 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca [1 x i32], align 4 -// CHECK:STDOUT: %.loc8_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.1.loc8_25, i64 4, i1 false) +// CHECK:STDOUT: %.loc12_24.3.array.index = getelementptr inbounds [1 x i32], ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @array.1.loc12_25, i64 4, i1 false) // CHECK:STDOUT: %b.var = alloca [2 x double], align 8 -// CHECK:STDOUT: %.loc9_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_32.6.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.2.loc9_33, i64 16, i1 false) +// CHECK:STDOUT: %.loc13_32.3.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_32.6.array.index = getelementptr inbounds [2 x double], ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %b.var, ptr align 8 @array.2.loc13_33, i64 16, i1 false) // CHECK:STDOUT: %c.var = alloca [5 x {}], align 8 -// CHECK:STDOUT: %.loc10_40.3.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_40.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc10_40.9.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc10_40.12.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 3 -// CHECK:STDOUT: %.loc10_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.3.loc10_41, i64 0, i1 false) +// CHECK:STDOUT: %.loc14_40.3.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc14_40.6.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_40.9.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc14_40.12.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 3 +// CHECK:STDOUT: %.loc14_40.15.array.index = getelementptr inbounds [5 x {}], ptr %c.var, i32 0, i32 4 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 1 %c.var, ptr align 1 @array.3.loc14_41, i64 0, i1 false) // CHECK:STDOUT: %d.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc11_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc11_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc11_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.2.loc11_37, i64 12, i1 false) +// CHECK:STDOUT: %.loc15_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %d.var, ptr align 4 @tuple.2.loc15_37, i64 12, i1 false) // CHECK:STDOUT: %e.var = alloca [3 x i32], align 4 -// CHECK:STDOUT: %.loc12_21.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_21.2 = load i32, ptr %.loc12_21.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_21.4.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc12_21.2, ptr %.loc12_21.4.array.index, align 4 -// CHECK:STDOUT: %.loc12_21.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_21.7 = load i32, ptr %.loc12_21.6.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_21.9.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc12_21.7, ptr %.loc12_21.9.array.index, align 4 -// CHECK:STDOUT: %.loc12_21.11.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc12_21.12 = load i32, ptr %.loc12_21.11.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_21.14.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc12_21.12, ptr %.loc12_21.14.array.index, align 4 +// CHECK:STDOUT: %.loc16_21.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_21.2 = load i32, ptr %.loc16_21.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_21.4.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc16_21.2, ptr %.loc16_21.4.array.index, align 4 +// CHECK:STDOUT: %.loc16_21.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc16_21.7 = load i32, ptr %.loc16_21.6.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_21.9.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc16_21.7, ptr %.loc16_21.9.array.index, align 4 +// CHECK:STDOUT: %.loc16_21.11.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %d.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc16_21.12 = load i32, ptr %.loc16_21.11.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_21.14.array.index = getelementptr inbounds [3 x i32], ptr %e.var, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc16_21.12, ptr %.loc16_21.14.array.index, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/array/function_param.carbon b/toolchain/lower/testdata/array/function_param.carbon index 6857542537bd..1759f8df4868 100644 --- a/toolchain/lower/testdata/array/function_param.carbon +++ b/toolchain/lower/testdata/array/function_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/array/function_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/array/function_param.carbon fn F(arr: [i32; 3], i: i32) -> i32 { return arr[i]; @@ -15,23 +19,23 @@ fn G() -> i32 { // CHECK:STDOUT: ; ModuleID = 'function_param.carbon' // CHECK:STDOUT: source_filename = "function_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.loc12_11.1 = internal constant [3 x i32] [i32 1, i32 2, i32 3] +// CHECK:STDOUT: @array.loc16_11.1 = internal constant [3 x i32] [i32 1, i32 2, i32 3] // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i -// CHECK:STDOUT: %.loc8_15.3 = load i32, ptr %.loc8_15.2.array.index, align 4 -// CHECK:STDOUT: ret i32 %.loc8_15.3 +// CHECK:STDOUT: %.loc12_15.2.array.index = getelementptr inbounds [3 x i32], ptr %arr, i32 0, i32 %i +// CHECK:STDOUT: %.loc12_15.3 = load i32, ptr %.loc12_15.2.array.index, align 4 +// CHECK:STDOUT: ret i32 %.loc12_15.3 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_20.2.temp = alloca [3 x i32], align 4 -// CHECK:STDOUT: %.loc12_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc12_20.2.temp, ptr align 4 @array.loc12_11.1, i64 12, i1 false) -// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc12_20.2.temp, i32 1) +// CHECK:STDOUT: %.loc16_20.2.temp = alloca [3 x i32], align 4 +// CHECK:STDOUT: %.loc16_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc16_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc16_20.2.temp, i32 0, i32 2 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc16_20.2.temp, ptr align 4 @array.loc16_11.1, i64 12, i1 false) +// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc16_20.2.temp, i32 1) // CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/basics/empty.carbon b/toolchain/lower/testdata/basics/empty.carbon index a736c969ed63..ef5076eab179 100644 --- a/toolchain/lower/testdata/basics/empty.carbon +++ b/toolchain/lower/testdata/basics/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/empty.carbon // CHECK:STDOUT: ; ModuleID = 'empty.carbon' // CHECK:STDOUT: source_filename = "empty.carbon" diff --git a/toolchain/lower/testdata/basics/fail_before_lowering.carbon b/toolchain/lower/testdata/basics/fail_before_lowering.carbon index 2844ff3448ba..6053a57f0da0 100644 --- a/toolchain/lower/testdata/basics/fail_before_lowering.carbon +++ b/toolchain/lower/testdata/basics/fail_before_lowering.carbon @@ -4,6 +4,10 @@ // // This validates that earlier errors prevent lowering, without crashing. // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/fail_before_lowering.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/fail_before_lowering.carbon // CHECK:STDERR: fail_before_lowering.carbon:[[@LINE+7]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: a; diff --git a/toolchain/lower/testdata/basics/false_true.carbon b/toolchain/lower/testdata/basics/false_true.carbon index 9d20f1ab2421..650d65e4fb3d 100644 --- a/toolchain/lower/testdata/basics/false_true.carbon +++ b/toolchain/lower/testdata/basics/false_true.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/false_true.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/false_true.carbon fn F() -> bool { return false; diff --git a/toolchain/lower/testdata/basics/int_types.carbon b/toolchain/lower/testdata/basics/int_types.carbon index 5080fbb0417e..adeb6e701d26 100644 --- a/toolchain/lower/testdata/basics/int_types.carbon +++ b/toolchain/lower/testdata/basics/int_types.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/int_types.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/int_types.carbon fn F_i8(a: i8) -> i8 { return a; } fn F_u16(a: u16) -> u16 { return a; } diff --git a/toolchain/lower/testdata/basics/numeric_literals.carbon b/toolchain/lower/testdata/basics/numeric_literals.carbon index 3b8094ffbefc..d6dbe772fd98 100644 --- a/toolchain/lower/testdata/basics/numeric_literals.carbon +++ b/toolchain/lower/testdata/basics/numeric_literals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/numeric_literals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/numeric_literals.carbon fn F() { // 8 and 9 trigger special behavior in APInt when mishandling signed versus @@ -26,25 +30,25 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'numeric_literals.carbon' // CHECK:STDOUT: source_filename = "numeric_literals.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @array.1.loc15_4 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8] -// CHECK:STDOUT: @array.2.loc23_4 = internal constant [6 x double] [double 9.000000e-01, double 8.000000e+00, double 8.000000e+01, double 1.000000e+07, double 1.000000e+08, double 1.000000e-08] +// CHECK:STDOUT: @array.1.loc19_4 = internal constant [4 x i32] [i32 8, i32 9, i32 8, i32 8] +// CHECK:STDOUT: @array.2.loc27_4 = internal constant [6 x double] [double 9.000000e-01, double 8.000000e+00, double 8.000000e+01, double 1.000000e+07, double 1.000000e+08, double 1.000000e-08] // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %ints.var = alloca [4 x i32], align 4 -// CHECK:STDOUT: %.loc15_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc15_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.1.loc15_4, i64 16, i1 false) +// CHECK:STDOUT: %.loc19_3.3.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc19_3.6.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc19_3.9.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc19_3.12.array.index = getelementptr inbounds [4 x i32], ptr %ints.var, i32 0, i32 3 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %ints.var, ptr align 4 @array.1.loc19_4, i64 16, i1 false) // CHECK:STDOUT: %floats.var = alloca [6 x double], align 8 -// CHECK:STDOUT: %.loc23_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc23_3.6.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc23_3.9.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc23_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 3 -// CHECK:STDOUT: %.loc23_3.15.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 4 -// CHECK:STDOUT: %.loc23_3.18.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 5 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.2.loc23_4, i64 48, i1 false) +// CHECK:STDOUT: %.loc27_3.3.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc27_3.6.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc27_3.9.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc27_3.12.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 3 +// CHECK:STDOUT: %.loc27_3.15.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 4 +// CHECK:STDOUT: %.loc27_3.18.array.index = getelementptr inbounds [6 x double], ptr %floats.var, i32 0, i32 5 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %floats.var, ptr align 8 @array.2.loc27_4, i64 48, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/basics/type_values.carbon b/toolchain/lower/testdata/basics/type_values.carbon index 08dfeb5be1e1..0c3eb0c00c5e 100644 --- a/toolchain/lower/testdata/basics/type_values.carbon +++ b/toolchain/lower/testdata/basics/type_values.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/type_values.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/type_values.carbon // TODO: It would be nice to treat these functions as returning `void` instead // of `{}`. diff --git a/toolchain/lower/testdata/basics/zero.carbon b/toolchain/lower/testdata/basics/zero.carbon index 593899e11e34..ced60aa37b4d 100644 --- a/toolchain/lower/testdata/basics/zero.carbon +++ b/toolchain/lower/testdata/basics/zero.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/basics/zero.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/basics/zero.carbon fn Main() -> i32 { return 0; diff --git a/toolchain/lower/testdata/builtins/float.carbon b/toolchain/lower/testdata/builtins/float.carbon index edff184de95f..ef3c4f7c493c 100644 --- a/toolchain/lower/testdata/builtins/float.carbon +++ b/toolchain/lower/testdata/builtins/float.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/float.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/float.carbon fn Negate(a: f64) -> f64 = "float.negate"; fn TestNegate(a: f64) -> f64 { return Negate(a); } diff --git a/toolchain/lower/testdata/builtins/int.carbon b/toolchain/lower/testdata/builtins/int.carbon index c7d28b853a7b..2ac1dbf323dc 100644 --- a/toolchain/lower/testdata/builtins/int.carbon +++ b/toolchain/lower/testdata/builtins/int.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/int.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/int.carbon fn Negate(a: i32) -> i32 = "int.snegate"; fn TestNegate(a: i32) -> i32 { return Negate(a); } diff --git a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon index cf4637d86d2c..fa5065c0cbd5 100644 --- a/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon +++ b/toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/method_vs_nonmethod.carbon fn AddNonmethod(a: i32, b: i32) -> i32 = "int.sadd"; fn AddMethod[self: i32](b: i32) -> i32 = "int.sadd"; diff --git a/toolchain/lower/testdata/builtins/overloaded_operator.carbon b/toolchain/lower/testdata/builtins/overloaded_operator.carbon index 58d45f685bd7..f732a993c310 100644 --- a/toolchain/lower/testdata/builtins/overloaded_operator.carbon +++ b/toolchain/lower/testdata/builtins/overloaded_operator.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/overloaded_operator.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/overloaded_operator.carbon // TODO: Move this into prelude.carbon when possible. For now, impl lookup only // looks in the current file. @@ -19,10 +23,10 @@ fn AddThreeIntegers(a: i32, b: i32, c: i32) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @AddThreeIntegers(i32 %a, i32 %b, i32 %c) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %int.sadd.loc14_12 = add i32 %a, %b -// CHECK:STDOUT: %.loc14_12.2.temp = alloca i32, align 4 -// CHECK:STDOUT: store i32 %int.sadd.loc14_12, ptr %.loc14_12.2.temp, align 4 -// CHECK:STDOUT: %.loc14_12.4 = load i32, ptr %.loc14_12.2.temp, align 4 -// CHECK:STDOUT: %int.sadd.loc14_16 = add i32 %.loc14_12.4, %c -// CHECK:STDOUT: ret i32 %int.sadd.loc14_16 +// CHECK:STDOUT: %int.sadd.loc18_12 = add i32 %a, %b +// CHECK:STDOUT: %.loc18_12.2.temp = alloca i32, align 4 +// CHECK:STDOUT: store i32 %int.sadd.loc18_12, ptr %.loc18_12.2.temp, align 4 +// CHECK:STDOUT: %.loc18_12.4 = load i32, ptr %.loc18_12.2.temp, align 4 +// CHECK:STDOUT: %int.sadd.loc18_16 = add i32 %.loc18_12.4, %c +// CHECK:STDOUT: ret i32 %int.sadd.loc18_16 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/builtins/types.carbon b/toolchain/lower/testdata/builtins/types.carbon index d2c75509cad0..81b08095a348 100644 --- a/toolchain/lower/testdata/builtins/types.carbon +++ b/toolchain/lower/testdata/builtins/types.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/types.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/types.carbon fn Int() -> type = "int.make_type_32"; fn Float(size: i32) -> type = "float.make_type"; diff --git a/toolchain/lower/testdata/builtins/uint.carbon b/toolchain/lower/testdata/builtins/uint.carbon index 69149ee4dc8c..d57b6367873d 100644 --- a/toolchain/lower/testdata/builtins/uint.carbon +++ b/toolchain/lower/testdata/builtins/uint.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/builtins/uint.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/builtins/uint.carbon fn Negate(a: u64) -> u64 = "int.unegate"; fn TestNegate(a: u64) -> u64 { return Negate(a); } diff --git a/toolchain/lower/testdata/class/adapt.carbon b/toolchain/lower/testdata/class/adapt.carbon index e6a266f51071..957d5fb3faeb 100644 --- a/toolchain/lower/testdata/class/adapt.carbon +++ b/toolchain/lower/testdata/class/adapt.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/adapt.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/adapt.carbon // --- adapt_class.carbon diff --git a/toolchain/lower/testdata/class/base.carbon b/toolchain/lower/testdata/class/base.carbon index 420dc9869f3d..d63e3fcdb5bf 100644 --- a/toolchain/lower/testdata/class/base.carbon +++ b/toolchain/lower/testdata/class/base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/base.carbon base class Base { var b: i32; @@ -29,35 +33,35 @@ fn Convert(p: Derived*) -> Base* { // CHECK:STDOUT: ; ModuleID = 'base.carbon' // CHECK:STDOUT: source_filename = "base.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.4.loc18_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } +// CHECK:STDOUT: @struct.4.loc22_36 = internal constant { { i32 }, i32 } { { i32 } { i32 4 }, i32 7 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ { i32 }, i32 }) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc18_35.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_26.2.b = getelementptr inbounds { i32 }, ptr %.loc18_35.2.base, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_35.4.d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.4.loc18_36, i64 8, i1 false) +// CHECK:STDOUT: %.loc22_35.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_26.2.b = getelementptr inbounds { i32 }, ptr %.loc22_35.2.base, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_35.4.d = getelementptr inbounds { { i32 }, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @struct.4.loc22_36, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Access(ptr sret({ i32, i32 }) %return, ptr %d) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc22_12.1.d = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 1 -// CHECK:STDOUT: %.loc22_12.2 = load i32, ptr %.loc22_12.1.d, align 4 -// CHECK:STDOUT: %.loc22_17.1.base = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_22.1.b = getelementptr inbounds { i32 }, ptr %.loc22_17.1.base, i32 0, i32 0 -// CHECK:STDOUT: %.loc22_22.2 = load i32, ptr %.loc22_22.1.b, align 4 -// CHECK:STDOUT: %.loc22_24.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc22_12.2, ptr %.loc22_24.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc22_24.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc22_22.2, ptr %.loc22_24.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc26_12.1.d = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 1 +// CHECK:STDOUT: %.loc26_12.2 = load i32, ptr %.loc26_12.1.d, align 4 +// CHECK:STDOUT: %.loc26_17.1.base = getelementptr inbounds { { i32 }, i32 }, ptr %d, i32 0, i32 0 +// CHECK:STDOUT: %.loc26_22.1.b = getelementptr inbounds { i32 }, ptr %.loc26_17.1.base, i32 0, i32 0 +// CHECK:STDOUT: %.loc26_22.2 = load i32, ptr %.loc26_22.1.b, align 4 +// CHECK:STDOUT: %.loc26_24.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc26_12.2, ptr %.loc26_24.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc26_24.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc26_22.2, ptr %.loc26_24.4.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define ptr @Convert(ptr %p) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc26_11.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %p, i32 0, i32 0 -// CHECK:STDOUT: ret ptr %.loc26_11.2.base +// CHECK:STDOUT: %.loc30_11.2.base = getelementptr inbounds { { i32 }, i32 }, ptr %p, i32 0, i32 0 +// CHECK:STDOUT: ret ptr %.loc30_11.2.base // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) diff --git a/toolchain/lower/testdata/class/basic.carbon b/toolchain/lower/testdata/class/basic.carbon index 5d98dbc401fe..be0d3d12df96 100644 --- a/toolchain/lower/testdata/class/basic.carbon +++ b/toolchain/lower/testdata/class/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/basic.carbon class C { var a: i32; diff --git a/toolchain/lower/testdata/class/field.carbon b/toolchain/lower/testdata/class/field.carbon index 528782c6bc36..cb7f1f62906e 100644 --- a/toolchain/lower/testdata/class/field.carbon +++ b/toolchain/lower/testdata/class/field.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/field.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/field.carbon class C { var a: i32; @@ -25,20 +29,20 @@ fn Run() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc13_13.1.b = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %.loc13_13.2 = load ptr, ptr %.loc13_13.1.b, align 8 -// CHECK:STDOUT: %.loc13_16.1.a = getelementptr inbounds { i32, ptr }, ptr %.loc13_13.2, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_16.2 = load i32, ptr %.loc13_16.1.a, align 4 -// CHECK:STDOUT: ret i32 %.loc13_16.2 +// CHECK:STDOUT: %.loc17_13.1.b = getelementptr inbounds { i32, ptr }, ptr %c, i32 0, i32 1 +// CHECK:STDOUT: %.loc17_13.2 = load ptr, ptr %.loc17_13.1.b, align 8 +// CHECK:STDOUT: %.loc17_16.1.a = getelementptr inbounds { i32, ptr }, ptr %.loc17_13.2, i32 0, i32 0 +// CHECK:STDOUT: %.loc17_16.2 = load i32, ptr %.loc17_16.1.a, align 4 +// CHECK:STDOUT: ret i32 %.loc17_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %c.var = alloca { i32, ptr }, align 8 -// CHECK:STDOUT: %.loc18_4.a = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %.loc18_4.a, align 4 -// CHECK:STDOUT: %.loc19_4.b = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 1 -// CHECK:STDOUT: store ptr %c.var, ptr %.loc19_4.b, align 8 +// CHECK:STDOUT: %.loc22_4.a = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc22_4.a, align 4 +// CHECK:STDOUT: %.loc23_4.b = getelementptr inbounds { i32, ptr }, ptr %c.var, i32 0, i32 1 +// CHECK:STDOUT: store ptr %c.var, ptr %.loc23_4.b, align 8 // CHECK:STDOUT: %F.call = call i32 @F(ptr %c.var) // CHECK:STDOUT: ret i32 %F.call // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/method.carbon b/toolchain/lower/testdata/class/method.carbon index 9a0af81a8b49..a52aba42fd32 100644 --- a/toolchain/lower/testdata/class/method.carbon +++ b/toolchain/lower/testdata/class/method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/method.carbon class C { var a: i32; diff --git a/toolchain/lower/testdata/class/self.carbon b/toolchain/lower/testdata/class/self.carbon index a73b6ab6e802..53e33bc99dea 100644 --- a/toolchain/lower/testdata/class/self.carbon +++ b/toolchain/lower/testdata/class/self.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/self.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/self.carbon class C { var a: i32; @@ -24,14 +28,14 @@ fn C.Set[addr self: C*]() { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Get(ptr %self) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc15_14.1.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_14.2 = load i32, ptr %.loc15_14.1.a, align 4 -// CHECK:STDOUT: ret i32 %.loc15_14.2 +// CHECK:STDOUT: %.loc19_14.1.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc19_14.2 = load i32, ptr %.loc19_14.1.a, align 4 +// CHECK:STDOUT: ret i32 %.loc19_14.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Set(ptr %self) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc19_10.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: store i32 1, ptr %.loc19_10.a, align 4 +// CHECK:STDOUT: %.loc23_10.a = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: store i32 1, ptr %.loc23_10.a, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/class/value_access.carbon b/toolchain/lower/testdata/class/value_access.carbon index f630bf720bf0..d9774f6c3a31 100644 --- a/toolchain/lower/testdata/class/value_access.carbon +++ b/toolchain/lower/testdata/class/value_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/class/value_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/class/value_access.carbon class C { var a: (i32, i32, i32); @@ -20,21 +24,21 @@ fn F(c: C) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %c) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc15_11.1.a = getelementptr inbounds { { i32, i32, i32 } }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_11.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 0 -// CHECK:STDOUT: %.loc15_11.3 = load i32, ptr %.loc15_11.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc15_11.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_11.5 = load i32, ptr %.loc15_11.4.tuple.elem, align 4 -// CHECK:STDOUT: %.loc15_11.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc15_11.1.a, i32 0, i32 2 -// CHECK:STDOUT: %.loc15_11.7 = load i32, ptr %.loc15_11.6.tuple.elem, align 4 +// CHECK:STDOUT: %.loc19_11.1.a = getelementptr inbounds { { i32, i32, i32 } }, ptr %c, i32 0, i32 0 +// CHECK:STDOUT: %.loc19_11.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 0 +// CHECK:STDOUT: %.loc19_11.3 = load i32, ptr %.loc19_11.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc19_11.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 1 +// CHECK:STDOUT: %.loc19_11.5 = load i32, ptr %.loc19_11.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc19_11.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %.loc19_11.1.a, i32 0, i32 2 +// CHECK:STDOUT: %.loc19_11.7 = load i32, ptr %.loc19_11.6.tuple.elem, align 4 // CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8 // CHECK:STDOUT: %tuple1 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc15_11.3, ptr %tuple1, align 4 +// CHECK:STDOUT: store i32 %.loc19_11.3, ptr %tuple1, align 4 // CHECK:STDOUT: %tuple2 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc15_11.5, ptr %tuple2, align 4 +// CHECK:STDOUT: store i32 %.loc19_11.5, ptr %tuple2, align 4 // CHECK:STDOUT: %tuple3 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc15_11.7, ptr %tuple3, align 4 -// CHECK:STDOUT: %.loc15_15.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 -// CHECK:STDOUT: %.loc15_15.tuple.index.load = load i32, ptr %.loc15_15.tuple.index, align 4 -// CHECK:STDOUT: ret i32 %.loc15_15.tuple.index.load +// CHECK:STDOUT: store i32 %.loc19_11.7, ptr %tuple3, align 4 +// CHECK:STDOUT: %.loc19_15.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1 +// CHECK:STDOUT: %.loc19_15.tuple.index.load = load i32, ptr %.loc19_15.tuple.index, align 4 +// CHECK:STDOUT: ret i32 %.loc19_15.tuple.index.load // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/empty_struct.carbon b/toolchain/lower/testdata/function/call/empty_struct.carbon index b918fe664d45..bc3e91a1000e 100644 --- a/toolchain/lower/testdata/function/call/empty_struct.carbon +++ b/toolchain/lower/testdata/function/call/empty_struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/empty_struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/empty_struct.carbon fn Echo(a: {}) -> {} { return {}; diff --git a/toolchain/lower/testdata/function/call/empty_tuple.carbon b/toolchain/lower/testdata/function/call/empty_tuple.carbon index 71232010014c..33f4ed2b16d3 100644 --- a/toolchain/lower/testdata/function/call/empty_tuple.carbon +++ b/toolchain/lower/testdata/function/call/empty_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/empty_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/empty_tuple.carbon fn Echo(a: ()) -> () { return a; diff --git a/toolchain/lower/testdata/function/call/i32.carbon b/toolchain/lower/testdata/function/call/i32.carbon index dc787d4d93e9..bb89e3befe91 100644 --- a/toolchain/lower/testdata/function/call/i32.carbon +++ b/toolchain/lower/testdata/function/call/i32.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/i32.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/i32.carbon fn Echo(a: i32) -> i32 { return a; diff --git a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon index 4fbf462d3a39..ed9267995c62 100644 --- a/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon +++ b/toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/implicit_empty_tuple_as_arg.carbon fn Foo() {} @@ -30,7 +34,7 @@ fn Main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca {}, align 8 // CHECK:STDOUT: call void @Foo() -// CHECK:STDOUT: %.loc13_22.1.temp = alloca {}, align 8 +// CHECK:STDOUT: %.loc17_22.1.temp = alloca {}, align 8 // CHECK:STDOUT: call void @Bar() // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/params_one.carbon b/toolchain/lower/testdata/function/call/params_one.carbon index 8bcea8317d6a..d3d2b266676b 100644 --- a/toolchain/lower/testdata/function/call/params_one.carbon +++ b/toolchain/lower/testdata/function/call/params_one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/params_one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/params_one.carbon fn Foo(a: i32) {} diff --git a/toolchain/lower/testdata/function/call/params_one_comma.carbon b/toolchain/lower/testdata/function/call/params_one_comma.carbon index c6fb30c4b1cd..4aa6e9625f88 100644 --- a/toolchain/lower/testdata/function/call/params_one_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_one_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/params_one_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/params_one_comma.carbon fn Foo(a: i32,) {} diff --git a/toolchain/lower/testdata/function/call/params_two.carbon b/toolchain/lower/testdata/function/call/params_two.carbon index 2a5ece658136..65b46932c1ee 100644 --- a/toolchain/lower/testdata/function/call/params_two.carbon +++ b/toolchain/lower/testdata/function/call/params_two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/params_two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/params_two.carbon fn Foo(a: i32, b: i32) {} diff --git a/toolchain/lower/testdata/function/call/params_two_comma.carbon b/toolchain/lower/testdata/function/call/params_two_comma.carbon index 77c562374383..1661fa6e2dbf 100644 --- a/toolchain/lower/testdata/function/call/params_two_comma.carbon +++ b/toolchain/lower/testdata/function/call/params_two_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/params_two_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/params_two_comma.carbon fn Foo(a: i32, b: i32,) {} diff --git a/toolchain/lower/testdata/function/call/params_zero.carbon b/toolchain/lower/testdata/function/call/params_zero.carbon index 0e8d34dae8eb..3acb0f8c4d6d 100644 --- a/toolchain/lower/testdata/function/call/params_zero.carbon +++ b/toolchain/lower/testdata/function/call/params_zero.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/params_zero.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/params_zero.carbon fn Foo() {} diff --git a/toolchain/lower/testdata/function/call/return_implicit.carbon b/toolchain/lower/testdata/function/call/return_implicit.carbon index 51c67b33c94e..0ba263d46f72 100644 --- a/toolchain/lower/testdata/function/call/return_implicit.carbon +++ b/toolchain/lower/testdata/function/call/return_implicit.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/return_implicit.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/return_implicit.carbon fn MakeImplicitEmptyTuple() { diff --git a/toolchain/lower/testdata/function/call/struct_param.carbon b/toolchain/lower/testdata/function/call/struct_param.carbon index edd23d34b913..1082d69b1271 100644 --- a/toolchain/lower/testdata/function/call/struct_param.carbon +++ b/toolchain/lower/testdata/function/call/struct_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/struct_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/struct_param.carbon fn F(a: {}, b: {.a: i32}, c: {.a: i32, .b: i32}) {} @@ -13,7 +17,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'struct_param.carbon' // CHECK:STDOUT: source_filename = "struct_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.6.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @struct.6.loc14_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { // CHECK:STDOUT: entry: @@ -22,6 +26,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.6.loc10_4.3) +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @struct.6.loc14_4.3) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/tuple_param.carbon b/toolchain/lower/testdata/function/call/tuple_param.carbon index ccacbb630a55..1fb50b91186c 100644 --- a/toolchain/lower/testdata/function/call/tuple_param.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/tuple_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/tuple_param.carbon fn F(a: (), b: (i32,), c: (i32, i32)) {} @@ -13,7 +17,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'tuple_param.carbon' // CHECK:STDOUT: source_filename = "tuple_param.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.3.loc10_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @tuple.3.loc14_4.3 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) { // CHECK:STDOUT: entry: @@ -22,6 +26,6 @@ fn Main() { // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @tuple.3.loc10_4.3) +// CHECK:STDOUT: call void @F({ i32 } { i32 1 }, ptr @tuple.3.loc14_4.3) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon index 83782e84a504..20ed9d875c33 100644 --- a/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon +++ b/toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/tuple_param_with_return_slot.carbon fn F(a: (), b: (i32,), c: (i32, i32)) -> (i32, i32, i32) { return (b[0], c[0], c[1]); @@ -15,28 +19,28 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'tuple_param_with_return_slot.carbon' // CHECK:STDOUT: source_filename = "tuple_param_with_return_slot.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.3.loc12_4.4 = internal constant { i32, i32 } { i32 2, i32 3 } +// CHECK:STDOUT: @tuple.3.loc16_4.4 = internal constant { i32, i32 } { i32 2, i32 3 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8_14.tuple.index = extractvalue { i32 } %b, 0 -// CHECK:STDOUT: %.loc8_20.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_20.tuple.index.load = load i32, ptr %.loc8_20.tuple.index, align 4 -// CHECK:STDOUT: %.loc8_26.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 1 -// CHECK:STDOUT: %.loc8_26.tuple.index.load = load i32, ptr %.loc8_26.tuple.index, align 4 -// CHECK:STDOUT: %.loc8_27.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc8_14.tuple.index, ptr %.loc8_27.2.tuple.elem, align 4 -// CHECK:STDOUT: %.loc8_27.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc8_20.tuple.index.load, ptr %.loc8_27.4.tuple.elem, align 4 -// CHECK:STDOUT: %.loc8_27.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc8_26.tuple.index.load, ptr %.loc8_27.6.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_14.tuple.index = extractvalue { i32 } %b, 0 +// CHECK:STDOUT: %.loc12_20.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_20.tuple.index.load = load i32, ptr %.loc12_20.tuple.index, align 4 +// CHECK:STDOUT: %.loc12_26.tuple.index = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_26.tuple.index.load = load i32, ptr %.loc12_26.tuple.index, align 4 +// CHECK:STDOUT: %.loc12_27.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc12_14.tuple.index, ptr %.loc12_27.2.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_27.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc12_20.tuple.index.load, ptr %.loc12_27.4.tuple.elem, align 4 +// CHECK:STDOUT: %.loc12_27.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %return, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc12_26.tuple.index.load, ptr %.loc12_27.6.tuple.elem, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc12_4.1.temp = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc12_4.1.temp, { i32 } { i32 1 }, ptr @tuple.3.loc12_4.4) +// CHECK:STDOUT: %.loc16_4.1.temp = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: call void @F(ptr %.loc16_4.1.temp, { i32 } { i32 1 }, ptr @tuple.3.loc16_4.4) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/function/call/var_param.carbon b/toolchain/lower/testdata/function/call/var_param.carbon index dc7aa2bc6aaf..941dcbbc99a3 100644 --- a/toolchain/lower/testdata/function/call/var_param.carbon +++ b/toolchain/lower/testdata/function/call/var_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/call/var_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/call/var_param.carbon fn DoNothing(a: i32) {} @@ -23,7 +27,7 @@ fn Main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca i32, align 4 // CHECK:STDOUT: store i32 0, ptr %a.var, align 4 -// CHECK:STDOUT: %.loc11 = load i32, ptr %a.var, align 4 -// CHECK:STDOUT: call void @DoNothing(i32 %.loc11) +// CHECK:STDOUT: %.loc15 = load i32, ptr %a.var, align 4 +// CHECK:STDOUT: call void @DoNothing(i32 %.loc15) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/function/declaration/simple.carbon b/toolchain/lower/testdata/function/declaration/simple.carbon index 756e7e06a9cf..50d8f01dbd7b 100644 --- a/toolchain/lower/testdata/function/declaration/simple.carbon +++ b/toolchain/lower/testdata/function/declaration/simple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/declaration/simple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/declaration/simple.carbon fn F(n: i32); diff --git a/toolchain/lower/testdata/function/definition/empty_struct.carbon b/toolchain/lower/testdata/function/definition/empty_struct.carbon index c204a4143268..211dbf21a0e6 100644 --- a/toolchain/lower/testdata/function/definition/empty_struct.carbon +++ b/toolchain/lower/testdata/function/definition/empty_struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/definition/empty_struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/definition/empty_struct.carbon fn Echo(a: {}) { } diff --git a/toolchain/lower/testdata/function/definition/params_one.carbon b/toolchain/lower/testdata/function/definition/params_one.carbon index 84038f9b6bf3..7e181e7eb59f 100644 --- a/toolchain/lower/testdata/function/definition/params_one.carbon +++ b/toolchain/lower/testdata/function/definition/params_one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/definition/params_one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/definition/params_one.carbon fn Foo(a: i32) {} diff --git a/toolchain/lower/testdata/function/definition/params_two.carbon b/toolchain/lower/testdata/function/definition/params_two.carbon index 9751893a3d9a..06952a090331 100644 --- a/toolchain/lower/testdata/function/definition/params_two.carbon +++ b/toolchain/lower/testdata/function/definition/params_two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/definition/params_two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/definition/params_two.carbon fn Foo(a: i32, b: i32) {} diff --git a/toolchain/lower/testdata/function/definition/params_zero.carbon b/toolchain/lower/testdata/function/definition/params_zero.carbon index 01f6581c3342..287fa7209533 100644 --- a/toolchain/lower/testdata/function/definition/params_zero.carbon +++ b/toolchain/lower/testdata/function/definition/params_zero.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/definition/params_zero.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/definition/params_zero.carbon fn Foo() {} diff --git a/toolchain/lower/testdata/function/generic/type_param.carbon b/toolchain/lower/testdata/function/generic/type_param.carbon index a9e7bc22e5f1..1ec8520e1de8 100644 --- a/toolchain/lower/testdata/function/generic/type_param.carbon +++ b/toolchain/lower/testdata/function/generic/type_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/function/generic/type_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/function/generic/type_param.carbon fn F(T:! type) { var p: T*; @@ -17,7 +21,7 @@ fn F(T:! type) { // CHECK:STDOUT: define void @F(%type %T) { // CHECK:STDOUT: entry: // CHECK:STDOUT: %p.var = alloca ptr, align 8 -// CHECK:STDOUT: %.loc9_15 = load ptr, ptr %p.var, align 8 -// CHECK:STDOUT: %.loc9_14.2 = load {}, ptr %.loc9_15, align 1 +// CHECK:STDOUT: %.loc13_15 = load ptr, ptr %p.var, align 8 +// CHECK:STDOUT: %.loc13_14.2 = load {}, ptr %.loc13_15, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/if/else.carbon b/toolchain/lower/testdata/if/else.carbon index f40a44f918da..4903751e373c 100644 --- a/toolchain/lower/testdata/if/else.carbon +++ b/toolchain/lower/testdata/if/else.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/if/else.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/if/else.carbon fn F() {} fn G() {} diff --git a/toolchain/lower/testdata/if/no_else.carbon b/toolchain/lower/testdata/if/no_else.carbon index fe8299cc524e..80759aa4aabc 100644 --- a/toolchain/lower/testdata/if/no_else.carbon +++ b/toolchain/lower/testdata/if/no_else.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/if/no_else.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/if/no_else.carbon fn F() {} fn G() {} diff --git a/toolchain/lower/testdata/if_expr/basic.carbon b/toolchain/lower/testdata/if_expr/basic.carbon index fa9c93680415..360828e84746 100644 --- a/toolchain/lower/testdata/if_expr/basic.carbon +++ b/toolchain/lower/testdata/if_expr/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/if_expr/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/if_expr/basic.carbon fn F() -> i32 { return 1; } fn G() -> i32 { return 2; } diff --git a/toolchain/lower/testdata/if_expr/empty_block.carbon b/toolchain/lower/testdata/if_expr/empty_block.carbon index 53bceecd9fda..28addd0bd21c 100644 --- a/toolchain/lower/testdata/if_expr/empty_block.carbon +++ b/toolchain/lower/testdata/if_expr/empty_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/if_expr/empty_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/if_expr/empty_block.carbon fn Select(b: bool, c: bool, d: bool) -> i32 { return if b then if c then 1 else 2 else if d then 3 else 4; @@ -13,35 +17,35 @@ fn Select(b: bool, c: bool, d: bool) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Select(i1 %b, i1 %c, i1 %d) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br i1 %b, label %if.expr.then.loc8_10, label %if.expr.else.loc8_10 +// CHECK:STDOUT: br i1 %b, label %if.expr.then.loc12_10, label %if.expr.else.loc12_10 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.then.loc8_10: ; preds = %entry -// CHECK:STDOUT: br i1 %c, label %if.expr.then.loc8_20, label %if.expr.else.loc8_20 +// CHECK:STDOUT: if.expr.then.loc12_10: ; preds = %entry +// CHECK:STDOUT: br i1 %c, label %if.expr.then.loc12_20, label %if.expr.else.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.then.loc8_20: ; preds = %if.expr.then.loc8_10 -// CHECK:STDOUT: br label %if.expr.result.loc8_20 +// CHECK:STDOUT: if.expr.then.loc12_20: ; preds = %if.expr.then.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.else.loc8_20: ; preds = %if.expr.then.loc8_10 -// CHECK:STDOUT: br label %if.expr.result.loc8_20 +// CHECK:STDOUT: if.expr.else.loc12_20: ; preds = %if.expr.then.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_20 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.result.loc8_20: ; preds = %if.expr.else.loc8_20, %if.expr.then.loc8_20 -// CHECK:STDOUT: %0 = phi i32 [ 1, %if.expr.then.loc8_20 ], [ 2, %if.expr.else.loc8_20 ] -// CHECK:STDOUT: br label %if.expr.result.loc8_10 +// CHECK:STDOUT: if.expr.result.loc12_20: ; preds = %if.expr.else.loc12_20, %if.expr.then.loc12_20 +// CHECK:STDOUT: %0 = phi i32 [ 1, %if.expr.then.loc12_20 ], [ 2, %if.expr.else.loc12_20 ] +// CHECK:STDOUT: br label %if.expr.result.loc12_10 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.else.loc8_10: ; preds = %entry -// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc8_44, label %if.expr.else.loc8_44 +// CHECK:STDOUT: if.expr.else.loc12_10: ; preds = %entry +// CHECK:STDOUT: br i1 %d, label %if.expr.then.loc12_44, label %if.expr.else.loc12_44 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.then.loc8_44: ; preds = %if.expr.else.loc8_10 -// CHECK:STDOUT: br label %if.expr.result.loc8_44 +// CHECK:STDOUT: if.expr.then.loc12_44: ; preds = %if.expr.else.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_44 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.else.loc8_44: ; preds = %if.expr.else.loc8_10 -// CHECK:STDOUT: br label %if.expr.result.loc8_44 +// CHECK:STDOUT: if.expr.else.loc12_44: ; preds = %if.expr.else.loc12_10 +// CHECK:STDOUT: br label %if.expr.result.loc12_44 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.result.loc8_44: ; preds = %if.expr.else.loc8_44, %if.expr.then.loc8_44 -// CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc8_44 ], [ 4, %if.expr.else.loc8_44 ] -// CHECK:STDOUT: br label %if.expr.result.loc8_10 +// CHECK:STDOUT: if.expr.result.loc12_44: ; preds = %if.expr.else.loc12_44, %if.expr.then.loc12_44 +// CHECK:STDOUT: %1 = phi i32 [ 3, %if.expr.then.loc12_44 ], [ 4, %if.expr.else.loc12_44 ] +// CHECK:STDOUT: br label %if.expr.result.loc12_10 // CHECK:STDOUT: -// CHECK:STDOUT: if.expr.result.loc8_10: ; preds = %if.expr.result.loc8_44, %if.expr.result.loc8_20 -// CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc8_20 ], [ %1, %if.expr.result.loc8_44 ] +// CHECK:STDOUT: if.expr.result.loc12_10: ; preds = %if.expr.result.loc12_44, %if.expr.result.loc12_20 +// CHECK:STDOUT: %2 = phi i32 [ %0, %if.expr.result.loc12_20 ], [ %1, %if.expr.result.loc12_44 ] // CHECK:STDOUT: ret i32 %2 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon index cdf524403014..1f8d9d683be7 100644 --- a/toolchain/lower/testdata/impl/assoc_fn_alias.carbon +++ b/toolchain/lower/testdata/impl/assoc_fn_alias.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/assoc_fn_alias.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/assoc_fn_alias.carbon interface I { fn F[self: Self]() -> i32; @@ -28,9 +32,9 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc18_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_16.2 = load i32, ptr %.loc18_16.1.n, align 4 -// CHECK:STDOUT: ret i32 %.loc18_16.2 +// CHECK:STDOUT: %.loc22_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_16.2 = load i32, ptr %.loc22_16.1.n, align 4 +// CHECK:STDOUT: ret i32 %.loc22_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { diff --git a/toolchain/lower/testdata/impl/extend_impl.carbon b/toolchain/lower/testdata/impl/extend_impl.carbon index 243892c70570..7bf5d812987b 100644 --- a/toolchain/lower/testdata/impl/extend_impl.carbon +++ b/toolchain/lower/testdata/impl/extend_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/extend_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/extend_impl.carbon interface I { fn F() -> i32; diff --git a/toolchain/lower/testdata/impl/impl.carbon b/toolchain/lower/testdata/impl/impl.carbon index 8532b25a9e21..90c55a1d8fdd 100644 --- a/toolchain/lower/testdata/impl/impl.carbon +++ b/toolchain/lower/testdata/impl/impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/impl.carbon interface I { fn F[self: Self]() -> i32; @@ -27,9 +31,9 @@ fn Call(a: A) -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F(ptr %self) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc17_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc17_16.2 = load i32, ptr %.loc17_16.1.n, align 4 -// CHECK:STDOUT: ret i32 %.loc17_16.2 +// CHECK:STDOUT: %.loc21_16.1.n = getelementptr inbounds { i32 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc21_16.2 = load i32, ptr %.loc21_16.1.n, align 4 +// CHECK:STDOUT: ret i32 %.loc21_16.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @Call(ptr %a) { diff --git a/toolchain/lower/testdata/impl/instance_method.carbon b/toolchain/lower/testdata/impl/instance_method.carbon index a36bd9763173..fe5edb73657c 100644 --- a/toolchain/lower/testdata/impl/instance_method.carbon +++ b/toolchain/lower/testdata/impl/instance_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/impl/instance_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/impl/instance_method.carbon class A; diff --git a/toolchain/lower/testdata/index/array_element_access.carbon b/toolchain/lower/testdata/index/array_element_access.carbon index ae9d17e9358c..6148769ae494 100644 --- a/toolchain/lower/testdata/index/array_element_access.carbon +++ b/toolchain/lower/testdata/index/array_element_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/index/array_element_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/index/array_element_access.carbon fn A() -> (i32, i32) { return (1, 2); } fn B() -> [i32; 2] { return (1, 2); } @@ -17,55 +21,55 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'array_element_access.carbon' // CHECK:STDOUT: source_filename = "array_element_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc6_37 = internal constant { i32, i32 } { i32 1, i32 2 } -// CHECK:STDOUT: @array.loc8_35 = internal constant [2 x i32] [i32 1, i32 2] +// CHECK:STDOUT: @tuple.loc10_37 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @array.loc12_35 = internal constant [2 x i32] [i32 1, i32 2] // CHECK:STDOUT: // CHECK:STDOUT: define void @A(ptr sret({ i32, i32 }) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc6_36.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc6_36.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc6_37, i64 8, i1 false) +// CHECK:STDOUT: %.loc10_36.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc10_36.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc10_37, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @B(ptr sret([2 x i32]) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @array.loc8_35, i64 8, i1 false) +// CHECK:STDOUT: %.loc12_34.3.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_34.6.array.index = getelementptr inbounds [2 x i32], ptr %return, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @array.loc12_35, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca [2 x i32], align 4 -// CHECK:STDOUT: %.loc11_22.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @A(ptr %.loc11_22.1.temp) -// CHECK:STDOUT: %.loc11_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc11_22.1.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc11_22.4 = load i32, ptr %.loc11_22.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc11_22.6.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc11_22.4, ptr %.loc11_22.6.array.index, align 4 -// CHECK:STDOUT: %.loc11_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc11_22.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc11_22.9 = load i32, ptr %.loc11_22.8.tuple.elem, align 4 -// CHECK:STDOUT: %.loc11_22.11.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc11_22.9, ptr %.loc11_22.11.array.index, align 4 +// CHECK:STDOUT: %.loc15_22.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @A(ptr %.loc15_22.1.temp) +// CHECK:STDOUT: %.loc15_22.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_22.4 = load i32, ptr %.loc15_22.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc15_22.6.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc15_22.4, ptr %.loc15_22.6.array.index, align 4 +// CHECK:STDOUT: %.loc15_22.8.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %.loc15_22.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_22.9 = load i32, ptr %.loc15_22.8.tuple.elem, align 4 +// CHECK:STDOUT: %.loc15_22.11.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc15_22.9, ptr %.loc15_22.11.array.index, align 4 // CHECK:STDOUT: %b.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc12_17.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @A(ptr %.loc12_17.1.temp) -// CHECK:STDOUT: %.loc12_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc12_17.1.temp, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_21.2 = load i32, ptr %.loc12_21.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc12_21.2, ptr %b.var, align 4 +// CHECK:STDOUT: %.loc16_17.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @A(ptr %.loc16_17.1.temp) +// CHECK:STDOUT: %.loc16_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc16_17.1.temp, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_21.2 = load i32, ptr %.loc16_21.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc16_21.2, ptr %b.var, align 4 // CHECK:STDOUT: %c.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc13_18 = load i32, ptr %b.var, align 4 -// CHECK:STDOUT: %.loc13_19.1.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 %.loc13_18 -// CHECK:STDOUT: %.loc13_19.2 = load i32, ptr %.loc13_19.1.array.index, align 4 -// CHECK:STDOUT: store i32 %.loc13_19.2, ptr %c.var, align 4 +// CHECK:STDOUT: %.loc17_18 = load i32, ptr %b.var, align 4 +// CHECK:STDOUT: %.loc17_19.1.array.index = getelementptr inbounds [2 x i32], ptr %a.var, i32 0, i32 %.loc17_18 +// CHECK:STDOUT: %.loc17_19.2 = load i32, ptr %.loc17_19.1.array.index, align 4 +// CHECK:STDOUT: store i32 %.loc17_19.2, ptr %c.var, align 4 // CHECK:STDOUT: %d.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc14_17.1.temp = alloca [2 x i32], align 4 -// CHECK:STDOUT: call void @B(ptr %.loc14_17.1.temp) -// CHECK:STDOUT: %.loc14_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc14_17.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc14_21.2 = load i32, ptr %.loc14_21.1.array.index, align 4 -// CHECK:STDOUT: store i32 %.loc14_21.2, ptr %d.var, align 4 +// CHECK:STDOUT: %.loc18_17.1.temp = alloca [2 x i32], align 4 +// CHECK:STDOUT: call void @B(ptr %.loc18_17.1.temp) +// CHECK:STDOUT: %.loc18_21.1.array.index = getelementptr inbounds [2 x i32], ptr %.loc18_17.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc18_21.2 = load i32, ptr %.loc18_21.1.array.index, align 4 +// CHECK:STDOUT: store i32 %.loc18_21.2, ptr %d.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/index/tuple_element_access.carbon b/toolchain/lower/testdata/index/tuple_element_access.carbon index 186ead4980a1..a045dba4add0 100644 --- a/toolchain/lower/testdata/index/tuple_element_access.carbon +++ b/toolchain/lower/testdata/index/tuple_element_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/index/tuple_element_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/index/tuple_element_access.carbon fn Run() -> i32 { var a: (i32, i32, i32) = (0, 1, 2); @@ -14,23 +18,23 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'tuple_element_access.carbon' // CHECK:STDOUT: source_filename = "tuple_element_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc8_37 = internal constant { i32, i32, i32 } { i32 0, i32 1, i32 2 } +// CHECK:STDOUT: @tuple.loc12_37 = internal constant { i32, i32, i32 } { i32 0, i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc8_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc8_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.loc8_37, i64 12, i1 false) +// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.loc12_37, i64 12, i1 false) // CHECK:STDOUT: %b.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc9_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_19.2 = load i32, ptr %.loc9_19.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc9_19.2, ptr %b.var, align 4 +// CHECK:STDOUT: %.loc13_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_19.2 = load i32, ptr %.loc13_19.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc13_19.2, ptr %b.var, align 4 // CHECK:STDOUT: %c.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc10_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc10_19.2 = load i32, ptr %.loc10_19.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc10_19.2, ptr %c.var, align 4 +// CHECK:STDOUT: %.loc14_19.1.tuple.index = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc14_19.2 = load i32, ptr %.loc14_19.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc14_19.2, ptr %c.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/index/tuple_return_value_access.carbon b/toolchain/lower/testdata/index/tuple_return_value_access.carbon index dd7d6e9d3eda..35630114dbda 100644 --- a/toolchain/lower/testdata/index/tuple_return_value_access.carbon +++ b/toolchain/lower/testdata/index/tuple_return_value_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/index/tuple_return_value_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/index/tuple_return_value_access.carbon fn F() -> (i32, i32) { return (12, 24); } @@ -13,24 +17,24 @@ fn Run() { // CHECK:STDOUT: ; ModuleID = 'tuple_return_value_access.carbon' // CHECK:STDOUT: source_filename = "tuple_return_value_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc7_39 = internal constant { i32, i32 } { i32 12, i32 24 } +// CHECK:STDOUT: @tuple.loc11_39 = internal constant { i32, i32 } { i32 12, i32 24 } // CHECK:STDOUT: // CHECK:STDOUT: define void @F(ptr sret({ i32, i32 }) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc7_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc7_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc7_39, i64 8, i1 false) +// CHECK:STDOUT: %.loc11_38.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc11_38.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %return, ptr align 4 @tuple.loc11_39, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %t.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc10_17.1.temp = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: call void @F(ptr %.loc10_17.1.temp) -// CHECK:STDOUT: %.loc10_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc10_17.1.temp, i32 0, i32 1 -// CHECK:STDOUT: %.loc10_21.2 = load i32, ptr %.loc10_21.1.tuple.index, align 4 -// CHECK:STDOUT: store i32 %.loc10_21.2, ptr %t.var, align 4 +// CHECK:STDOUT: %.loc14_17.1.temp = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: call void @F(ptr %.loc14_17.1.temp) +// CHECK:STDOUT: %.loc14_21.1.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc14_17.1.temp, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_21.2 = load i32, ptr %.loc14_21.1.tuple.index, align 4 +// CHECK:STDOUT: store i32 %.loc14_21.2, ptr %t.var, align 4 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/interface/assoc.carbon b/toolchain/lower/testdata/interface/assoc.carbon index 00d7e432707f..9c228855224d 100644 --- a/toolchain/lower/testdata/interface/assoc.carbon +++ b/toolchain/lower/testdata/interface/assoc.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/interface/assoc.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/interface/assoc.carbon interface I { fn Assoc(); diff --git a/toolchain/lower/testdata/interface/basic.carbon b/toolchain/lower/testdata/interface/basic.carbon index 624a1c38e65b..dd624d6bba27 100644 --- a/toolchain/lower/testdata/interface/basic.carbon +++ b/toolchain/lower/testdata/interface/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/interface/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/interface/basic.carbon interface I { fn Assoc(); diff --git a/toolchain/lower/testdata/let/local.carbon b/toolchain/lower/testdata/let/local.carbon index 6aefe2da1d02..edf5eb251d28 100644 --- a/toolchain/lower/testdata/let/local.carbon +++ b/toolchain/lower/testdata/let/local.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/let/local.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/let/local.carbon fn Run() -> i32 { let n: i32 = 1; diff --git a/toolchain/lower/testdata/let/tuple.carbon b/toolchain/lower/testdata/let/tuple.carbon index 723bfa3f83b8..3affa6586e60 100644 --- a/toolchain/lower/testdata/let/tuple.carbon +++ b/toolchain/lower/testdata/let/tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/let/tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/let/tuple.carbon fn F() -> i32 { var a: (i32, i32, i32) = (1, 2, 3); @@ -14,52 +18,52 @@ fn F() -> i32 { // CHECK:STDOUT: ; ModuleID = 'tuple.carbon' // CHECK:STDOUT: source_filename = "tuple.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.1.loc8_37 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } -// CHECK:STDOUT: @tuple.2.loc9_29 = internal constant { i32, i32 } { i32 4, i32 5 } +// CHECK:STDOUT: @tuple.1.loc12_37 = internal constant { i32, i32, i32 } { i32 1, i32 2, i32 3 } +// CHECK:STDOUT: @tuple.2.loc13_29 = internal constant { i32, i32 } { i32 4, i32 5 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc8_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc8_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.1.loc8_37, i64 12, i1 false) +// CHECK:STDOUT: %.loc12_36.2.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_36.4.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc12_36.6.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %a.var, ptr align 4 @tuple.1.loc12_37, i64 12, i1 false) // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc9_28.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_28.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.2.loc9_29, i64 8, i1 false) -// CHECK:STDOUT: %.loc10_43.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_43.2 = load i32, ptr %.loc10_43.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc10_43.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc10_43.4 = load i32, ptr %.loc10_43.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc10_43.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc10_43.6 = load i32, ptr %.loc10_43.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc10_43 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc10_431 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc10_43, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc10_43.2, ptr %tuple.loc10_431, align 4 -// CHECK:STDOUT: %tuple.loc10_432 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc10_43, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc10_43.4, ptr %tuple.loc10_432, align 4 -// CHECK:STDOUT: %tuple.loc10_433 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc10_43, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc10_43.6, ptr %tuple.loc10_433, align 4 -// CHECK:STDOUT: %.loc10_46.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_46.2 = load i32, ptr %.loc10_46.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc10_46.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc10_46.4 = load i32, ptr %.loc10_46.3.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc10_46 = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc10_464 = getelementptr inbounds { i32, i32 }, ptr %tuple.loc10_46, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc10_46.2, ptr %tuple.loc10_464, align 4 -// CHECK:STDOUT: %tuple.loc10_465 = getelementptr inbounds { i32, i32 }, ptr %tuple.loc10_46, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc10_46.4, ptr %tuple.loc10_465, align 4 -// CHECK:STDOUT: %tuple.loc10_47 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %tuple.loc10_476 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc10_47, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple.loc10_43, ptr %tuple.loc10_476, align 8 -// CHECK:STDOUT: %tuple.loc10_477 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc10_47, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple.loc10_46, ptr %tuple.loc10_477, align 8 -// CHECK:STDOUT: %.loc11_13.tuple.index = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc10_47, i32 0, i32 1 -// CHECK:STDOUT: %.loc11_13.tuple.index.load = load ptr, ptr %.loc11_13.tuple.index, align 8 -// CHECK:STDOUT: %.loc11_16.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc11_13.tuple.index.load, i32 0, i32 1 -// CHECK:STDOUT: %.loc11_16.tuple.index.load = load i32, ptr %.loc11_16.tuple.index, align 4 -// CHECK:STDOUT: ret i32 %.loc11_16.tuple.index.load +// CHECK:STDOUT: %.loc13_28.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_28.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.2.loc13_29, i64 8, i1 false) +// CHECK:STDOUT: %.loc14_43.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc14_43.2 = load i32, ptr %.loc14_43.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc14_43.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_43.4 = load i32, ptr %.loc14_43.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc14_43.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc14_43.6 = load i32, ptr %.loc14_43.5.tuple.elem, align 4 +// CHECK:STDOUT: %tuple.loc14_43 = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %tuple.loc14_431 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc14_43.2, ptr %tuple.loc14_431, align 4 +// CHECK:STDOUT: %tuple.loc14_432 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc14_43.4, ptr %tuple.loc14_432, align 4 +// CHECK:STDOUT: %tuple.loc14_433 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc14_43, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc14_43.6, ptr %tuple.loc14_433, align 4 +// CHECK:STDOUT: %.loc14_46.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc14_46.2 = load i32, ptr %.loc14_46.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc14_46.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc14_46.4 = load i32, ptr %.loc14_46.3.tuple.elem, align 4 +// CHECK:STDOUT: %tuple.loc14_46 = alloca { i32, i32 }, align 8 +// CHECK:STDOUT: %tuple.loc14_464 = getelementptr inbounds { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc14_46.2, ptr %tuple.loc14_464, align 4 +// CHECK:STDOUT: %tuple.loc14_465 = getelementptr inbounds { i32, i32 }, ptr %tuple.loc14_46, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc14_46.4, ptr %tuple.loc14_465, align 4 +// CHECK:STDOUT: %tuple.loc14_47 = alloca { ptr, ptr }, align 8 +// CHECK:STDOUT: %tuple.loc14_476 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 0 +// CHECK:STDOUT: store ptr %tuple.loc14_43, ptr %tuple.loc14_476, align 8 +// CHECK:STDOUT: %tuple.loc14_477 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1 +// CHECK:STDOUT: store ptr %tuple.loc14_46, ptr %tuple.loc14_477, align 8 +// CHECK:STDOUT: %.loc15_13.tuple.index = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc14_47, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_13.tuple.index.load = load ptr, ptr %.loc15_13.tuple.index, align 8 +// CHECK:STDOUT: %.loc15_16.tuple.index = getelementptr inbounds { i32, i32 }, ptr %.loc15_13.tuple.index.load, i32 0, i32 1 +// CHECK:STDOUT: %.loc15_16.tuple.index.load = load i32, ptr %.loc15_16.tuple.index, align 4 +// CHECK:STDOUT: ret i32 %.loc15_16.tuple.index.load // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite) diff --git a/toolchain/lower/testdata/namespace/function.carbon b/toolchain/lower/testdata/namespace/function.carbon index 2af350fcde4c..275c8c689ead 100644 --- a/toolchain/lower/testdata/namespace/function.carbon +++ b/toolchain/lower/testdata/namespace/function.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/namespace/function.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/namespace/function.carbon namespace Foo; diff --git a/toolchain/lower/testdata/namespace/nested.carbon b/toolchain/lower/testdata/namespace/nested.carbon index 276aba4a6ebc..072d7d36aa68 100644 --- a/toolchain/lower/testdata/namespace/nested.carbon +++ b/toolchain/lower/testdata/namespace/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/namespace/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/namespace/nested.carbon namespace Foo; namespace Foo.Bar; diff --git a/toolchain/lower/testdata/operators/and.carbon b/toolchain/lower/testdata/operators/and.carbon index b60d40c5f2c4..babe6a123bb1 100644 --- a/toolchain/lower/testdata/operators/and.carbon +++ b/toolchain/lower/testdata/operators/and.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/and.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/and.carbon fn F() -> bool { return true; } fn G() -> bool { return true; } diff --git a/toolchain/lower/testdata/operators/and_empty_block.carbon b/toolchain/lower/testdata/operators/and_empty_block.carbon index c8518536710c..6393f4c750b0 100644 --- a/toolchain/lower/testdata/operators/and_empty_block.carbon +++ b/toolchain/lower/testdata/operators/and_empty_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/and_empty_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/and_empty_block.carbon fn And(b: bool, c: bool) -> bool { // Note that in this case, we must generate an empty block so that the `phi` diff --git a/toolchain/lower/testdata/operators/assignment.carbon b/toolchain/lower/testdata/operators/assignment.carbon index 77a5ffd9a2b4..9160fbefe5bf 100644 --- a/toolchain/lower/testdata/operators/assignment.carbon +++ b/toolchain/lower/testdata/operators/assignment.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/assignment.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/assignment.carbon fn Main() { var a: i32 = 12; @@ -14,7 +18,7 @@ fn Main() { // CHECK:STDOUT: ; ModuleID = 'assignment.carbon' // CHECK:STDOUT: source_filename = "assignment.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc11_5 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @tuple.loc15_5 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define void @Main() { // CHECK:STDOUT: entry: @@ -22,9 +26,9 @@ fn Main() { // CHECK:STDOUT: store i32 12, ptr %a.var, align 4 // CHECK:STDOUT: store i32 9, ptr %a.var, align 4 // CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc11_12.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc11_12.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc11_5, i64 8, i1 false) +// CHECK:STDOUT: %.loc15_12.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc15_12.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc15_5, i64 8, i1 false) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/operators/not.carbon b/toolchain/lower/testdata/operators/not.carbon index c4fa3e6b3863..bbd19c3c6b4e 100644 --- a/toolchain/lower/testdata/operators/not.carbon +++ b/toolchain/lower/testdata/operators/not.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/not.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/not.carbon fn Not(b: bool) -> bool { return not b; @@ -13,6 +17,6 @@ fn Not(b: bool) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Not(i1 %b) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8 = xor i1 %b, true -// CHECK:STDOUT: ret i1 %.loc8 +// CHECK:STDOUT: %.loc12 = xor i1 %b, true +// CHECK:STDOUT: ret i1 %.loc12 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/operators/or.carbon b/toolchain/lower/testdata/operators/or.carbon index f79d3363153a..0d28c26cc60f 100644 --- a/toolchain/lower/testdata/operators/or.carbon +++ b/toolchain/lower/testdata/operators/or.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/or.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/or.carbon fn F() -> bool { return true; } fn G() -> bool { return true; } @@ -27,8 +31,8 @@ fn Or() -> bool { // CHECK:STDOUT: define i1 @Or() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %F.call = call i1 @F() -// CHECK:STDOUT: %.loc11_14.3 = xor i1 %F.call, true -// CHECK:STDOUT: br i1 %.loc11_14.3, label %or.rhs, label %or.result +// CHECK:STDOUT: %.loc15_14.3 = xor i1 %F.call, true +// CHECK:STDOUT: br i1 %.loc15_14.3, label %or.rhs, label %or.result // CHECK:STDOUT: // CHECK:STDOUT: or.rhs: ; preds = %entry // CHECK:STDOUT: %G.call = call i1 @G() diff --git a/toolchain/lower/testdata/operators/or_empty_block.carbon b/toolchain/lower/testdata/operators/or_empty_block.carbon index aa3afdd9bed8..cc9ec1bda6ba 100644 --- a/toolchain/lower/testdata/operators/or_empty_block.carbon +++ b/toolchain/lower/testdata/operators/or_empty_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/or_empty_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/or_empty_block.carbon fn Or(b: bool, c: bool) -> bool { // Note that in this case, we must generate an empty block so that the `phi` @@ -15,8 +19,8 @@ fn Or(b: bool, c: bool) -> bool { // CHECK:STDOUT: // CHECK:STDOUT: define i1 @Or(i1 %b, i1 %c) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc10_12.1 = xor i1 %b, true -// CHECK:STDOUT: br i1 %.loc10_12.1, label %or.rhs, label %or.result +// CHECK:STDOUT: %.loc14_12.1 = xor i1 %b, true +// CHECK:STDOUT: br i1 %.loc14_12.1, label %or.rhs, label %or.result // CHECK:STDOUT: // CHECK:STDOUT: or.rhs: ; preds = %entry // CHECK:STDOUT: br label %or.result diff --git a/toolchain/lower/testdata/operators/overloaded.carbon b/toolchain/lower/testdata/operators/overloaded.carbon index fff10b1d6481..a4847f14cfce 100644 --- a/toolchain/lower/testdata/operators/overloaded.carbon +++ b/toolchain/lower/testdata/operators/overloaded.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/operators/overloaded.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/overloaded.carbon class Number { var is_positive: bool; @@ -29,58 +33,58 @@ fn Calculate(a: Number, b: Number) -> Number { // CHECK:STDOUT: // CHECK:STDOUT: define void @Op(ptr sret({ i1 }) %return, ptr %self) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc13_36.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc13_36.2 = load i1, ptr %.loc13_36.1.is_positive, align 1 -// CHECK:STDOUT: %.loc13_28 = xor i1 %.loc13_36.2, true -// CHECK:STDOUT: %.loc13_48.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %.loc13_28, ptr %.loc13_48.2.is_positive, align 1 +// CHECK:STDOUT: %.loc17_36.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc17_36.2 = load i1, ptr %.loc17_36.1.is_positive, align 1 +// CHECK:STDOUT: %.loc17_28 = xor i1 %.loc17_36.2, true +// CHECK:STDOUT: %.loc17_48.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i1 %.loc17_28, ptr %.loc17_48.2.is_positive, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Op.1(ptr sret({ i1 }) %return, ptr %self, ptr %other) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc18_33.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_33.2 = load i1, ptr %.loc18_33.1.is_positive, align 1 -// CHECK:STDOUT: br i1 %.loc18_33.2, label %and.rhs.loc18, label %and.result.loc18 +// CHECK:STDOUT: %.loc22_33.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_33.2 = load i1, ptr %.loc22_33.1.is_positive, align 1 +// CHECK:STDOUT: br i1 %.loc22_33.2, label %and.rhs.loc22, label %and.result.loc22 // CHECK:STDOUT: -// CHECK:STDOUT: and.rhs.loc18: ; preds = %entry -// CHECK:STDOUT: %.loc18_55.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %.loc18_55.2 = load i1, ptr %.loc18_55.1.is_positive, align 1 -// CHECK:STDOUT: br label %and.result.loc18 +// CHECK:STDOUT: and.rhs.loc22: ; preds = %entry +// CHECK:STDOUT: %.loc22_55.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 +// CHECK:STDOUT: %.loc22_55.2 = load i1, ptr %.loc22_55.1.is_positive, align 1 +// CHECK:STDOUT: br label %and.result.loc22 // CHECK:STDOUT: -// CHECK:STDOUT: and.result.loc18: ; preds = %and.rhs.loc18, %entry -// CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %.loc18_55.2, %and.rhs.loc18 ] -// CHECK:STDOUT: %.loc18_69.1 = xor i1 %0, true -// CHECK:STDOUT: br i1 %.loc18_69.1, label %or.rhs, label %or.result +// CHECK:STDOUT: and.result.loc22: ; preds = %and.rhs.loc22, %entry +// CHECK:STDOUT: %0 = phi i1 [ false, %entry ], [ %.loc22_55.2, %and.rhs.loc22 ] +// CHECK:STDOUT: %.loc22_69.1 = xor i1 %0, true +// CHECK:STDOUT: br i1 %.loc22_69.1, label %or.rhs, label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: or.rhs: ; preds = %and.result.loc18 -// CHECK:STDOUT: %.loc19_38.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_38.2 = load i1, ptr %.loc19_38.1.is_positive, align 1 -// CHECK:STDOUT: %.loc19_30 = xor i1 %.loc19_38.2, true -// CHECK:STDOUT: br i1 %.loc19_30, label %and.rhs.loc19, label %and.result.loc19 +// CHECK:STDOUT: or.rhs: ; preds = %and.result.loc22 +// CHECK:STDOUT: %.loc23_38.1.is_positive = getelementptr inbounds { i1 }, ptr %self, i32 0, i32 0 +// CHECK:STDOUT: %.loc23_38.2 = load i1, ptr %.loc23_38.1.is_positive, align 1 +// CHECK:STDOUT: %.loc23_30 = xor i1 %.loc23_38.2, true +// CHECK:STDOUT: br i1 %.loc23_30, label %and.rhs.loc23, label %and.result.loc23 // CHECK:STDOUT: -// CHECK:STDOUT: and.rhs.loc19: ; preds = %or.rhs -// CHECK:STDOUT: %.loc19_64.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 -// CHECK:STDOUT: %.loc19_64.2 = load i1, ptr %.loc19_64.1.is_positive, align 1 -// CHECK:STDOUT: %.loc19_55 = xor i1 %.loc19_64.2, true -// CHECK:STDOUT: br label %and.result.loc19 +// CHECK:STDOUT: and.rhs.loc23: ; preds = %or.rhs +// CHECK:STDOUT: %.loc23_64.1.is_positive = getelementptr inbounds { i1 }, ptr %other, i32 0, i32 0 +// CHECK:STDOUT: %.loc23_64.2 = load i1, ptr %.loc23_64.1.is_positive, align 1 +// CHECK:STDOUT: %.loc23_55 = xor i1 %.loc23_64.2, true +// CHECK:STDOUT: br label %and.result.loc23 // CHECK:STDOUT: -// CHECK:STDOUT: and.result.loc19: ; preds = %and.rhs.loc19, %or.rhs -// CHECK:STDOUT: %1 = phi i1 [ false, %or.rhs ], [ %.loc19_55, %and.rhs.loc19 ] +// CHECK:STDOUT: and.result.loc23: ; preds = %and.rhs.loc23, %or.rhs +// CHECK:STDOUT: %1 = phi i1 [ false, %or.rhs ], [ %.loc23_55, %and.rhs.loc23 ] // CHECK:STDOUT: br label %or.result // CHECK:STDOUT: -// CHECK:STDOUT: or.result: ; preds = %and.result.loc19, %and.result.loc18 -// CHECK:STDOUT: %2 = phi i1 [ true, %and.result.loc18 ], [ %1, %and.result.loc19 ] -// CHECK:STDOUT: %.loc19_77.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: store i1 %2, ptr %.loc19_77.2.is_positive, align 1 +// CHECK:STDOUT: or.result: ; preds = %and.result.loc23, %and.result.loc22 +// CHECK:STDOUT: %2 = phi i1 [ true, %and.result.loc22 ], [ %1, %and.result.loc23 ] +// CHECK:STDOUT: %.loc23_77.2.is_positive = getelementptr inbounds { i1 }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: store i1 %2, ptr %.loc23_77.2.is_positive, align 1 // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define void @Calculate(ptr sret({ i1 }) %return, ptr %a, ptr %b) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc24_10.2.temp = alloca { i1 }, align 8 -// CHECK:STDOUT: call void @Op(ptr %.loc24_10.2.temp, ptr %a) -// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %.loc24_10.2.temp, ptr %b) +// CHECK:STDOUT: %.loc28_10.2.temp = alloca { i1 }, align 8 +// CHECK:STDOUT: call void @Op(ptr %.loc28_10.2.temp, ptr %a) +// CHECK:STDOUT: call void @Op.1(ptr %return, ptr %.loc28_10.2.temp, ptr %b) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/packages/cross_package_call.carbon b/toolchain/lower/testdata/packages/cross_package_call.carbon index f7a089b88526..6c2b4e76142e 100644 --- a/toolchain/lower/testdata/packages/cross_package_call.carbon +++ b/toolchain/lower/testdata/packages/cross_package_call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/packages/cross_package_call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/packages/cross_package_call.carbon // --- a.carbon diff --git a/toolchain/lower/testdata/pointer/address_of_field.carbon b/toolchain/lower/testdata/pointer/address_of_field.carbon index 82dee5f62fa1..343640f9df39 100644 --- a/toolchain/lower/testdata/pointer/address_of_field.carbon +++ b/toolchain/lower/testdata/pointer/address_of_field.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/pointer/address_of_field.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/pointer/address_of_field.carbon fn G(p: i32*); @@ -14,18 +18,18 @@ fn F() { // CHECK:STDOUT: ; ModuleID = 'address_of_field.carbon' // CHECK:STDOUT: source_filename = "address_of_field.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.4.loc10_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.4.loc14_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: declare void @G(ptr) // CHECK:STDOUT: // CHECK:STDOUT: define void @F() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %s.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc10_46.2.a = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc10_46.4.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.4.loc10_47, i64 8, i1 false) -// CHECK:STDOUT: %.loc11_7.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 -// CHECK:STDOUT: call void @G(ptr %.loc11_7.b) +// CHECK:STDOUT: %.loc14_46.2.a = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc14_46.4.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %s.var, ptr align 4 @struct.4.loc14_47, i64 8, i1 false) +// CHECK:STDOUT: %.loc15_7.b = getelementptr inbounds { i32, i32 }, ptr %s.var, i32 0, i32 1 +// CHECK:STDOUT: call void @G(ptr %.loc15_7.b) // CHECK:STDOUT: ret void // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/pointer/address_of_unused.carbon b/toolchain/lower/testdata/pointer/address_of_unused.carbon index a5fb0e31e4b2..9bd6024c6bf0 100644 --- a/toolchain/lower/testdata/pointer/address_of_unused.carbon +++ b/toolchain/lower/testdata/pointer/address_of_unused.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/pointer/address_of_unused.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/pointer/address_of_unused.carbon fn F() { var n: i32 = 0; diff --git a/toolchain/lower/testdata/pointer/basic.carbon b/toolchain/lower/testdata/pointer/basic.carbon index ee266bad8ced..8d94914bdd40 100644 --- a/toolchain/lower/testdata/pointer/basic.carbon +++ b/toolchain/lower/testdata/pointer/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/pointer/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/pointer/basic.carbon fn G(p: i32*) -> i32 { return *p; @@ -18,8 +22,8 @@ fn F() -> i32 { // CHECK:STDOUT: // CHECK:STDOUT: define i32 @G(ptr %p) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc8_10.2 = load i32, ptr %p, align 4 -// CHECK:STDOUT: ret i32 %.loc8_10.2 +// CHECK:STDOUT: %.loc12_10.2 = load i32, ptr %p, align 4 +// CHECK:STDOUT: ret i32 %.loc12_10.2 // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @F() { diff --git a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon index d5f7ae37683f..a9b2ed1f4aab 100644 --- a/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon +++ b/toolchain/lower/testdata/pointer/pointer_to_pointer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/pointer/pointer_to_pointer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/pointer/pointer_to_pointer.carbon fn F(p: i32**) -> i32 { var a: i32** = p; @@ -19,12 +23,12 @@ fn F(p: i32**) -> i32 { // CHECK:STDOUT: %a.var = alloca ptr, align 8 // CHECK:STDOUT: store ptr %p, ptr %a.var, align 8 // CHECK:STDOUT: %b.var = alloca ptr, align 8 -// CHECK:STDOUT: %.loc9_17.2 = load ptr, ptr %p, align 8 -// CHECK:STDOUT: store ptr %.loc9_17.2, ptr %b.var, align 8 +// CHECK:STDOUT: %.loc13_17.2 = load ptr, ptr %p, align 8 +// CHECK:STDOUT: store ptr %.loc13_17.2, ptr %b.var, align 8 // CHECK:STDOUT: %c.var = alloca ptr, align 8 // CHECK:STDOUT: store ptr %b.var, ptr %c.var, align 8 -// CHECK:STDOUT: %.loc11_12 = load ptr, ptr %c.var, align 8 -// CHECK:STDOUT: %.loc11_11.2 = load ptr, ptr %.loc11_12, align 8 -// CHECK:STDOUT: %.loc11_10.2 = load i32, ptr %.loc11_11.2, align 4 -// CHECK:STDOUT: ret i32 %.loc11_10.2 +// CHECK:STDOUT: %.loc15_12 = load ptr, ptr %c.var, align 8 +// CHECK:STDOUT: %.loc15_11.2 = load ptr, ptr %.loc15_12, align 8 +// CHECK:STDOUT: %.loc15_10.2 = load i32, ptr %.loc15_11.2, align 4 +// CHECK:STDOUT: ret i32 %.loc15_10.2 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/code_after_return.carbon b/toolchain/lower/testdata/return/code_after_return.carbon index fab4640ea743..5ee26d112ee7 100644 --- a/toolchain/lower/testdata/return/code_after_return.carbon +++ b/toolchain/lower/testdata/return/code_after_return.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/code_after_return.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/code_after_return.carbon fn F() {} diff --git a/toolchain/lower/testdata/return/no_value.carbon b/toolchain/lower/testdata/return/no_value.carbon index 8af172e3e4ef..3be486fb1241 100644 --- a/toolchain/lower/testdata/return/no_value.carbon +++ b/toolchain/lower/testdata/return/no_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/no_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/no_value.carbon fn Main() { return; diff --git a/toolchain/lower/testdata/return/return_var.carbon b/toolchain/lower/testdata/return/return_var.carbon index cd87e964810d..bd6aabe91094 100644 --- a/toolchain/lower/testdata/return/return_var.carbon +++ b/toolchain/lower/testdata/return/return_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/return_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/return_var.carbon class C { var data: i32; @@ -20,8 +24,8 @@ fn Make() -> C { // CHECK:STDOUT: // CHECK:STDOUT: define void @Make(ptr sret({ i32, ptr }) %return) { // CHECK:STDOUT: entry: -// CHECK:STDOUT: %.loc14_30.2.data = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 0 -// CHECK:STDOUT: %.loc14_30.4.next = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 1 -// CHECK:STDOUT: store ptr %return, ptr %.loc14_30.4.next, align 8 +// CHECK:STDOUT: %.loc18_30.2.data = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 0 +// CHECK:STDOUT: %.loc18_30.4.next = getelementptr inbounds { i32, ptr }, ptr %return, i32 0, i32 1 +// CHECK:STDOUT: store ptr %return, ptr %.loc18_30.4.next, align 8 // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/return_var_byval.carbon b/toolchain/lower/testdata/return/return_var_byval.carbon index a81e8fee5d87..0214d853728a 100644 --- a/toolchain/lower/testdata/return/return_var_byval.carbon +++ b/toolchain/lower/testdata/return/return_var_byval.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/return_var_byval.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/return_var_byval.carbon fn Main() -> i32 { returned var x: i32 = 0; @@ -16,6 +20,6 @@ fn Main() -> i32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4 // CHECK:STDOUT: store i32 0, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc8_16 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc8_16 +// CHECK:STDOUT: %.loc12_16 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc12_16 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/return/value.carbon b/toolchain/lower/testdata/return/value.carbon index a3b3e899e701..05b9c7cdebef 100644 --- a/toolchain/lower/testdata/return/value.carbon +++ b/toolchain/lower/testdata/return/value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/value.carbon fn Main() -> i32 { return 0; diff --git a/toolchain/lower/testdata/return/var.carbon b/toolchain/lower/testdata/return/var.carbon index 43c2cda53afc..86f2e560904d 100644 --- a/toolchain/lower/testdata/return/var.carbon +++ b/toolchain/lower/testdata/return/var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/return/var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/return/var.carbon fn Main() -> i32 { var x: i32 = 0; @@ -16,6 +20,6 @@ fn Main() -> i32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4 // CHECK:STDOUT: store i32 0, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc9 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc9 +// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc13 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/empty.carbon b/toolchain/lower/testdata/struct/empty.carbon index bb712b99c9c4..f7364fd7fead 100644 --- a/toolchain/lower/testdata/struct/empty.carbon +++ b/toolchain/lower/testdata/struct/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/empty.carbon fn Run() -> i32 { var x: {} = {}; diff --git a/toolchain/lower/testdata/struct/member_access.carbon b/toolchain/lower/testdata/struct/member_access.carbon index 452aef63d5d0..8eb816567313 100644 --- a/toolchain/lower/testdata/struct/member_access.carbon +++ b/toolchain/lower/testdata/struct/member_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/member_access.carbon fn Run() -> i32 { var x: {.a: f64, .b: i32} = {.a = 0.0, .b = 1}; @@ -14,21 +18,21 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'member_access.carbon' // CHECK:STDOUT: source_filename = "member_access.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.4.loc8_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } +// CHECK:STDOUT: @struct.4.loc12_49 = internal constant { double, i32 } { double 0.000000e+00, i32 1 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { double, i32 }, align 8 -// CHECK:STDOUT: %.loc8_48.2.a = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_48.4.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.4.loc8_49, i64 16, i1 false) +// CHECK:STDOUT: %.loc12_48.2.a = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_48.4.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %x.var, ptr align 8 @struct.4.loc12_49, i64 16, i1 false) // CHECK:STDOUT: %y.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc9_17.1.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc9_17.2 = load i32, ptr %.loc9_17.1.b, align 4 -// CHECK:STDOUT: store i32 %.loc9_17.2, ptr %y.var, align 4 +// CHECK:STDOUT: %.loc13_17.1.b = getelementptr inbounds { double, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc13_17.2 = load i32, ptr %.loc13_17.1.b, align 4 +// CHECK:STDOUT: store i32 %.loc13_17.2, ptr %y.var, align 4 // CHECK:STDOUT: %z.var = alloca i32, align 4 -// CHECK:STDOUT: %.loc10_16 = load i32, ptr %y.var, align 4 -// CHECK:STDOUT: store i32 %.loc10_16, ptr %z.var, align 4 +// CHECK:STDOUT: %.loc14_16 = load i32, ptr %y.var, align 4 +// CHECK:STDOUT: store i32 %.loc14_16, ptr %z.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/struct/nested_struct.carbon b/toolchain/lower/testdata/struct/nested_struct.carbon index 437211359d6c..e5b49994a13e 100644 --- a/toolchain/lower/testdata/struct/nested_struct.carbon +++ b/toolchain/lower/testdata/struct/nested_struct.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/nested_struct.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/nested_struct.carbon fn Run() -> i32 { {.b = {.a: i32}}; diff --git a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon index 3753a93f8183..bab2e5dc51a4 100644 --- a/toolchain/lower/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/lower/testdata/struct/nested_struct_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/nested_struct_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/nested_struct_in_place.carbon fn F() -> (i32, i32, i32); @@ -18,9 +22,9 @@ fn G() { // CHECK:STDOUT: define void @G() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %.loc10_74.1.a = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc10_74.1.a) -// CHECK:STDOUT: %.loc10_74.2.b = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc10_74.2.b) +// CHECK:STDOUT: %.loc14_74.1.a = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc14_74.1.a) +// CHECK:STDOUT: %.loc14_74.2.b = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc14_74.2.b) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/one_entry.carbon b/toolchain/lower/testdata/struct/one_entry.carbon index 857e52fe6e49..2b714c2c9e8d 100644 --- a/toolchain/lower/testdata/struct/one_entry.carbon +++ b/toolchain/lower/testdata/struct/one_entry.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/one_entry.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/one_entry.carbon fn Run() -> i32 { var x: {.a: i32} = {.a = 4}; @@ -18,9 +22,9 @@ fn Run() -> i32 { // CHECK:STDOUT: %x.var = alloca { i32 }, align 8 // CHECK:STDOUT: store { i32 } { i32 4 }, ptr %x.var, align 4 // CHECK:STDOUT: %y.var = alloca { i32 }, align 8 -// CHECK:STDOUT: %.loc9_22.1.a = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_22.2 = load i32, ptr %.loc9_22.1.a, align 4 -// CHECK:STDOUT: %.loc9_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc9_22.2, 0 -// CHECK:STDOUT: store { i32 } %.loc9_22.3.struct.init, ptr %y.var, align 4 +// CHECK:STDOUT: %.loc13_22.1.a = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_22.2 = load i32, ptr %.loc13_22.1.a, align 4 +// CHECK:STDOUT: %.loc13_22.3.struct.init = insertvalue { i32 } poison, i32 %.loc13_22.2, 0 +// CHECK:STDOUT: store { i32 } %.loc13_22.3.struct.init, ptr %y.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/struct/two_entries.carbon b/toolchain/lower/testdata/struct/two_entries.carbon index 0d269e313e92..4ccd61ed0221 100644 --- a/toolchain/lower/testdata/struct/two_entries.carbon +++ b/toolchain/lower/testdata/struct/two_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/struct/two_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/struct/two_entries.carbon fn Run() -> i32 { var x: {.a: i32, .b: i32} = {.a = 1, .b = 2}; @@ -13,23 +17,23 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'two_entries.carbon' // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @struct.3.loc8_47 = internal constant { i32, i32 } { i32 1, i32 2 } +// CHECK:STDOUT: @struct.3.loc12_47 = internal constant { i32, i32 } { i32 1, i32 2 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc8_46.2.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_46.4.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.3.loc8_47, i64 8, i1 false) +// CHECK:STDOUT: %.loc12_46.2.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_46.4.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @struct.3.loc12_47, i64 8, i1 false) // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc9_31.1.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_31.2 = load i32, ptr %.loc9_31.1.a, align 4 -// CHECK:STDOUT: %.loc9_31.3.a = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc9_31.2, ptr %.loc9_31.3.a, align 4 -// CHECK:STDOUT: %.loc9_31.5.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc9_31.6 = load i32, ptr %.loc9_31.5.b, align 4 -// CHECK:STDOUT: %.loc9_31.7.b = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc9_31.6, ptr %.loc9_31.7.b, align 4 +// CHECK:STDOUT: %.loc13_31.1.a = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_31.2 = load i32, ptr %.loc13_31.1.a, align 4 +// CHECK:STDOUT: %.loc13_31.3.a = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc13_31.2, ptr %.loc13_31.3.a, align 4 +// CHECK:STDOUT: %.loc13_31.5.b = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc13_31.6 = load i32, ptr %.loc13_31.5.b, align 4 +// CHECK:STDOUT: %.loc13_31.7.b = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc13_31.6, ptr %.loc13_31.7.b, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/empty.carbon b/toolchain/lower/testdata/tuple/empty.carbon index 272502e8cc61..5b7d4801a5ca 100644 --- a/toolchain/lower/testdata/tuple/empty.carbon +++ b/toolchain/lower/testdata/tuple/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/empty.carbon fn Run() -> i32 { var x: () = (); diff --git a/toolchain/lower/testdata/tuple/nested_tuple.carbon b/toolchain/lower/testdata/tuple/nested_tuple.carbon index 224d059cc3d1..3a5888e017d9 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/nested_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/nested_tuple.carbon fn Run() -> i32 { ((i32,), ); diff --git a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon index a999e06bd021..50e9b6963526 100644 --- a/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +++ b/toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/nested_tuple_in_place.carbon fn F() -> (i32, i32, i32); @@ -18,9 +22,9 @@ fn G() { // CHECK:STDOUT: define void @G() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %v.var = alloca { { i32, i32, i32 }, { i32, i32, i32 } }, align 8 -// CHECK:STDOUT: %.loc10_56.1.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 -// CHECK:STDOUT: call void @F(ptr %.loc10_56.1.tuple.elem) -// CHECK:STDOUT: %.loc10_56.2.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 -// CHECK:STDOUT: call void @F(ptr %.loc10_56.2.tuple.elem) +// CHECK:STDOUT: %.loc14_56.1.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 0 +// CHECK:STDOUT: call void @F(ptr %.loc14_56.1.tuple.elem) +// CHECK:STDOUT: %.loc14_56.2.tuple.elem = getelementptr inbounds { { i32, i32, i32 }, { i32, i32, i32 } }, ptr %v.var, i32 0, i32 1 +// CHECK:STDOUT: call void @F(ptr %.loc14_56.2.tuple.elem) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/one_entry.carbon b/toolchain/lower/testdata/tuple/one_entry.carbon index c91ca789edfe..2fcfed24143b 100644 --- a/toolchain/lower/testdata/tuple/one_entry.carbon +++ b/toolchain/lower/testdata/tuple/one_entry.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/one_entry.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/one_entry.carbon fn Run() -> i32 { var x: (i32, ) = (1, ); @@ -18,10 +22,10 @@ fn Run() -> i32 { // CHECK:STDOUT: %x.var = alloca { i32 }, align 8 // CHECK:STDOUT: store { i32 } { i32 1 }, ptr %x.var, align 4 // CHECK:STDOUT: %y.var = alloca { i32 }, align 8 -// CHECK:STDOUT: %.loc9_20.1.tuple.elem = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_20.2 = load i32, ptr %.loc9_20.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc9_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc9_20.2, 0 -// CHECK:STDOUT: store { i32 } %.loc9_20.3.tuple.init, ptr %y.var, align 4 +// CHECK:STDOUT: %.loc13_20.1.tuple.elem = getelementptr inbounds { i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_20.2 = load i32, ptr %.loc13_20.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc13_20.3.tuple.init = insertvalue { i32 } poison, i32 %.loc13_20.2, 0 +// CHECK:STDOUT: store { i32 } %.loc13_20.3.tuple.init, ptr %y.var, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/two_entries.carbon b/toolchain/lower/testdata/tuple/two_entries.carbon index 32573092c081..f92c4e42289f 100644 --- a/toolchain/lower/testdata/tuple/two_entries.carbon +++ b/toolchain/lower/testdata/tuple/two_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/two_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/two_entries.carbon fn Run() -> i32 { var x: (i32, i32) = (12, 7); @@ -13,23 +17,23 @@ fn Run() -> i32 { // CHECK:STDOUT: ; ModuleID = 'two_entries.carbon' // CHECK:STDOUT: source_filename = "two_entries.carbon" // CHECK:STDOUT: -// CHECK:STDOUT: @tuple.loc8_30 = internal constant { i32, i32 } { i32 12, i32 7 } +// CHECK:STDOUT: @tuple.loc12_30 = internal constant { i32, i32 } { i32 12, i32 7 } // CHECK:STDOUT: // CHECK:STDOUT: define i32 @main() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc8_29.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc8_29.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @tuple.loc8_30, i64 8, i1 false) +// CHECK:STDOUT: %.loc12_29.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc12_29.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %x.var, ptr align 4 @tuple.loc12_30, i64 8, i1 false) // CHECK:STDOUT: %y.var = alloca { i32, i32 }, align 8 -// CHECK:STDOUT: %.loc9_23.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc9_23.2 = load i32, ptr %.loc9_23.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc9_23.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc9_23.2, ptr %.loc9_23.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc9_23.5.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc9_23.6 = load i32, ptr %.loc9_23.5.tuple.elem, align 4 -// CHECK:STDOUT: %.loc9_23.7.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc9_23.6, ptr %.loc9_23.7.tuple.elem, align 4 +// CHECK:STDOUT: %.loc13_23.1.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc13_23.2 = load i32, ptr %.loc13_23.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc13_23.3.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc13_23.2, ptr %.loc13_23.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc13_23.5.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %x.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc13_23.6 = load i32, ptr %.loc13_23.5.tuple.elem, align 4 +// CHECK:STDOUT: %.loc13_23.7.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %y.var, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc13_23.6, ptr %.loc13_23.7.tuple.elem, align 4 // CHECK:STDOUT: ret i32 0 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/lower/testdata/tuple/value_formation.carbon b/toolchain/lower/testdata/tuple/value_formation.carbon index bcdd152e567f..249b4a3ec5b8 100644 --- a/toolchain/lower/testdata/tuple/value_formation.carbon +++ b/toolchain/lower/testdata/tuple/value_formation.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/value_formation.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/value_formation.carbon fn G(ab: ((i32, i32, i32), (i32, i32, i32))); @@ -21,37 +25,37 @@ fn F() { // CHECK:STDOUT: entry: // CHECK:STDOUT: %a.var = alloca { i32, i32, i32 }, align 8 // CHECK:STDOUT: %b.var = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %.loc12_6.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_6.2 = load i32, ptr %.loc12_6.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_6.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_6.4 = load i32, ptr %.loc12_6.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_6.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc12_6.6 = load i32, ptr %.loc12_6.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc12_6 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc12_61 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_6, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc12_6.2, ptr %tuple.loc12_61, align 4 -// CHECK:STDOUT: %tuple.loc12_62 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_6, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc12_6.4, ptr %tuple.loc12_62, align 4 -// CHECK:STDOUT: %tuple.loc12_63 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_6, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc12_6.6, ptr %tuple.loc12_63, align 4 -// CHECK:STDOUT: %.loc12_9.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 0 -// CHECK:STDOUT: %.loc12_9.2 = load i32, ptr %.loc12_9.1.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_9.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 1 -// CHECK:STDOUT: %.loc12_9.4 = load i32, ptr %.loc12_9.3.tuple.elem, align 4 -// CHECK:STDOUT: %.loc12_9.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 2 -// CHECK:STDOUT: %.loc12_9.6 = load i32, ptr %.loc12_9.5.tuple.elem, align 4 -// CHECK:STDOUT: %tuple.loc12_9 = alloca { i32, i32, i32 }, align 8 -// CHECK:STDOUT: %tuple.loc12_94 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_9, i32 0, i32 0 -// CHECK:STDOUT: store i32 %.loc12_9.2, ptr %tuple.loc12_94, align 4 -// CHECK:STDOUT: %tuple.loc12_95 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_9, i32 0, i32 1 -// CHECK:STDOUT: store i32 %.loc12_9.4, ptr %tuple.loc12_95, align 4 -// CHECK:STDOUT: %tuple.loc12_96 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc12_9, i32 0, i32 2 -// CHECK:STDOUT: store i32 %.loc12_9.6, ptr %tuple.loc12_96, align 4 -// CHECK:STDOUT: %tuple.loc12_10 = alloca { ptr, ptr }, align 8 -// CHECK:STDOUT: %tuple.loc12_107 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc12_10, i32 0, i32 0 -// CHECK:STDOUT: store ptr %tuple.loc12_6, ptr %tuple.loc12_107, align 8 -// CHECK:STDOUT: %tuple.loc12_108 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc12_10, i32 0, i32 1 -// CHECK:STDOUT: store ptr %tuple.loc12_9, ptr %tuple.loc12_108, align 8 -// CHECK:STDOUT: call void @G(ptr %tuple.loc12_10) +// CHECK:STDOUT: %.loc16_6.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_6.2 = load i32, ptr %.loc16_6.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_6.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc16_6.4 = load i32, ptr %.loc16_6.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_6.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %a.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc16_6.6 = load i32, ptr %.loc16_6.5.tuple.elem, align 4 +// CHECK:STDOUT: %tuple.loc16_6 = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %tuple.loc16_61 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc16_6.2, ptr %tuple.loc16_61, align 4 +// CHECK:STDOUT: %tuple.loc16_62 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc16_6.4, ptr %tuple.loc16_62, align 4 +// CHECK:STDOUT: %tuple.loc16_63 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_6, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc16_6.6, ptr %tuple.loc16_63, align 4 +// CHECK:STDOUT: %.loc16_9.1.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 0 +// CHECK:STDOUT: %.loc16_9.2 = load i32, ptr %.loc16_9.1.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_9.3.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 1 +// CHECK:STDOUT: %.loc16_9.4 = load i32, ptr %.loc16_9.3.tuple.elem, align 4 +// CHECK:STDOUT: %.loc16_9.5.tuple.elem = getelementptr inbounds { i32, i32, i32 }, ptr %b.var, i32 0, i32 2 +// CHECK:STDOUT: %.loc16_9.6 = load i32, ptr %.loc16_9.5.tuple.elem, align 4 +// CHECK:STDOUT: %tuple.loc16_9 = alloca { i32, i32, i32 }, align 8 +// CHECK:STDOUT: %tuple.loc16_94 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 0 +// CHECK:STDOUT: store i32 %.loc16_9.2, ptr %tuple.loc16_94, align 4 +// CHECK:STDOUT: %tuple.loc16_95 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 1 +// CHECK:STDOUT: store i32 %.loc16_9.4, ptr %tuple.loc16_95, align 4 +// CHECK:STDOUT: %tuple.loc16_96 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple.loc16_9, i32 0, i32 2 +// CHECK:STDOUT: store i32 %.loc16_9.6, ptr %tuple.loc16_96, align 4 +// CHECK:STDOUT: %tuple.loc16_10 = alloca { ptr, ptr }, align 8 +// CHECK:STDOUT: %tuple.loc16_107 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 0 +// CHECK:STDOUT: store ptr %tuple.loc16_6, ptr %tuple.loc16_107, align 8 +// CHECK:STDOUT: %tuple.loc16_108 = getelementptr inbounds { ptr, ptr }, ptr %tuple.loc16_10, i32 0, i32 1 +// CHECK:STDOUT: store ptr %tuple.loc16_9, ptr %tuple.loc16_108, align 8 +// CHECK:STDOUT: call void @G(ptr %tuple.loc16_10) // CHECK:STDOUT: ret void // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/tuple/value_forwarding.carbon b/toolchain/lower/testdata/tuple/value_forwarding.carbon index 048b6dfd160e..8868f92ad09a 100644 --- a/toolchain/lower/testdata/tuple/value_forwarding.carbon +++ b/toolchain/lower/testdata/tuple/value_forwarding.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/tuple/value_forwarding.carbon fn G(ab: ((i32, i32, i32), (i32, i32, i32))); diff --git a/toolchain/lower/testdata/var/local.carbon b/toolchain/lower/testdata/var/local.carbon index 5f618cabae8d..8d34b2b29ed4 100644 --- a/toolchain/lower/testdata/var/local.carbon +++ b/toolchain/lower/testdata/var/local.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/var/local.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/var/local.carbon fn Run() -> i32 { var x: i32 = 1; @@ -16,6 +20,6 @@ fn Run() -> i32 { // CHECK:STDOUT: entry: // CHECK:STDOUT: %x.var = alloca i32, align 4 // CHECK:STDOUT: store i32 1, ptr %x.var, align 4 -// CHECK:STDOUT: %.loc9 = load i32, ptr %x.var, align 4 -// CHECK:STDOUT: ret i32 %.loc9 +// CHECK:STDOUT: %.loc13 = load i32, ptr %x.var, align 4 +// CHECK:STDOUT: ret i32 %.loc13 // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/break_continue.carbon b/toolchain/lower/testdata/while/break_continue.carbon index a1f5c1d35b50..7dbeca8ef07f 100644 --- a/toolchain/lower/testdata/while/break_continue.carbon +++ b/toolchain/lower/testdata/while/break_continue.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/while/break_continue.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/while/break_continue.carbon fn A() -> bool; fn B() -> bool; @@ -28,28 +32,28 @@ fn While() { // CHECK:STDOUT: entry: // CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: while.cond: ; preds = %entry, %if.else.loc14, %if.then.loc13 +// CHECK:STDOUT: while.cond: ; preds = %entry, %if.else.loc18, %if.then.loc17 // CHECK:STDOUT: %A.call = call i1 @A() // CHECK:STDOUT: br i1 %A.call, label %while.body, label %while.done // CHECK:STDOUT: // CHECK:STDOUT: while.body: ; preds = %while.cond // CHECK:STDOUT: %B.call = call i1 @B() -// CHECK:STDOUT: br i1 %B.call, label %if.then.loc13, label %if.else.loc13 +// CHECK:STDOUT: br i1 %B.call, label %if.then.loc17, label %if.else.loc17 // CHECK:STDOUT: -// CHECK:STDOUT: if.then.loc13: ; preds = %while.body +// CHECK:STDOUT: if.then.loc17: ; preds = %while.body // CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: if.else.loc13: ; preds = %while.body +// CHECK:STDOUT: if.else.loc17: ; preds = %while.body // CHECK:STDOUT: %C.call = call i1 @C() -// CHECK:STDOUT: br i1 %C.call, label %if.then.loc14, label %if.else.loc14 +// CHECK:STDOUT: br i1 %C.call, label %if.then.loc18, label %if.else.loc18 // CHECK:STDOUT: -// CHECK:STDOUT: if.then.loc14: ; preds = %if.else.loc13 +// CHECK:STDOUT: if.then.loc18: ; preds = %if.else.loc17 // CHECK:STDOUT: br label %while.done // CHECK:STDOUT: -// CHECK:STDOUT: if.else.loc14: ; preds = %if.else.loc13 +// CHECK:STDOUT: if.else.loc18: ; preds = %if.else.loc17 // CHECK:STDOUT: br label %while.cond // CHECK:STDOUT: -// CHECK:STDOUT: while.done: ; preds = %if.then.loc14, %while.cond +// CHECK:STDOUT: while.done: ; preds = %if.then.loc18, %while.cond // CHECK:STDOUT: ret void // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives diff --git a/toolchain/lower/testdata/while/preheader.carbon b/toolchain/lower/testdata/while/preheader.carbon index 39be6a3abc5d..5e19981371e4 100644 --- a/toolchain/lower/testdata/while/preheader.carbon +++ b/toolchain/lower/testdata/while/preheader.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/while/preheader.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/while/preheader.carbon fn Cond() -> bool; @@ -35,34 +39,34 @@ fn While() { // CHECK:STDOUT: // CHECK:STDOUT: define void @While() { // CHECK:STDOUT: entry: -// CHECK:STDOUT: br label %while.cond.loc16 +// CHECK:STDOUT: br label %while.cond.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: while.cond.loc16: ; preds = %entry, %while.body.loc16 -// CHECK:STDOUT: %Cond.call.loc16 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc16, label %while.body.loc16, label %while.done.loc16 -// CHECK:STDOUT: -// CHECK:STDOUT: while.body.loc16: ; preds = %while.cond.loc16 -// CHECK:STDOUT: call void @F() -// CHECK:STDOUT: br label %while.cond.loc16 -// CHECK:STDOUT: -// CHECK:STDOUT: while.done.loc16: ; preds = %while.cond.loc16 +// CHECK:STDOUT: while.cond.loc20: ; preds = %entry, %while.body.loc20 // CHECK:STDOUT: %Cond.call.loc20 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc20, label %while.cond.loc21, label %if.else +// CHECK:STDOUT: br i1 %Cond.call.loc20, label %while.body.loc20, label %while.done.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: while.cond.loc21: ; preds = %while.body.loc21, %while.done.loc16 -// CHECK:STDOUT: %Cond.call.loc21 = call i1 @Cond() -// CHECK:STDOUT: br i1 %Cond.call.loc21, label %while.body.loc21, label %while.done.loc21 +// CHECK:STDOUT: while.body.loc20: ; preds = %while.cond.loc20 +// CHECK:STDOUT: call void @F() +// CHECK:STDOUT: br label %while.cond.loc20 // CHECK:STDOUT: -// CHECK:STDOUT: while.body.loc21: ; preds = %while.cond.loc21 +// CHECK:STDOUT: while.done.loc20: ; preds = %while.cond.loc20 +// CHECK:STDOUT: %Cond.call.loc24 = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call.loc24, label %while.cond.loc25, label %if.else +// CHECK:STDOUT: +// CHECK:STDOUT: while.cond.loc25: ; preds = %while.body.loc25, %while.done.loc20 +// CHECK:STDOUT: %Cond.call.loc25 = call i1 @Cond() +// CHECK:STDOUT: br i1 %Cond.call.loc25, label %while.body.loc25, label %while.done.loc25 +// CHECK:STDOUT: +// CHECK:STDOUT: while.body.loc25: ; preds = %while.cond.loc25 // CHECK:STDOUT: call void @G() -// CHECK:STDOUT: br label %while.cond.loc21 +// CHECK:STDOUT: br label %while.cond.loc25 // CHECK:STDOUT: -// CHECK:STDOUT: while.done.loc21: ; preds = %while.cond.loc21 +// CHECK:STDOUT: while.done.loc25: ; preds = %while.cond.loc25 // CHECK:STDOUT: br label %if.else // CHECK:STDOUT: -// CHECK:STDOUT: if.else: ; preds = %while.done.loc21, %while.done.loc16 +// CHECK:STDOUT: if.else: ; preds = %while.done.loc25, %while.done.loc20 // CHECK:STDOUT: ret void // CHECK:STDOUT: // CHECK:STDOUT: ; uselistorder directives -// CHECK:STDOUT: uselistorder label %while.cond.loc16, { 1, 0 } +// CHECK:STDOUT: uselistorder label %while.cond.loc20, { 1, 0 } // CHECK:STDOUT: } diff --git a/toolchain/lower/testdata/while/unreachable_end.carbon b/toolchain/lower/testdata/while/unreachable_end.carbon index e6302316096f..d4d352efca5c 100644 --- a/toolchain/lower/testdata/while/unreachable_end.carbon +++ b/toolchain/lower/testdata/while/unreachable_end.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/while/unreachable_end.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/while/unreachable_end.carbon fn Cond() -> bool; diff --git a/toolchain/lower/testdata/while/while.carbon b/toolchain/lower/testdata/while/while.carbon index 2e2dde0a5e8f..763dea3f773d 100644 --- a/toolchain/lower/testdata/while/while.carbon +++ b/toolchain/lower/testdata/while/while.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/lower/testdata/while/while.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/while/while.carbon fn Cond() -> bool; diff --git a/toolchain/parse/testdata/alias/basic.carbon b/toolchain/parse/testdata/alias/basic.carbon index 7d33aded7f8b..d74c1db4e8a7 100644 --- a/toolchain/parse/testdata/alias/basic.carbon +++ b/toolchain/parse/testdata/alias/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/alias/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/alias/basic.carbon alias a = foo; alias b = 0; diff --git a/toolchain/parse/testdata/alias/fail_syntax.carbon b/toolchain/parse/testdata/alias/fail_syntax.carbon index 8c0ba8f9c8a8..9779d034d64a 100644 --- a/toolchain/parse/testdata/alias/fail_syntax.carbon +++ b/toolchain/parse/testdata/alias/fail_syntax.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/alias/fail_syntax.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/alias/fail_syntax.carbon // CHECK:STDERR: fail_syntax.carbon:[[@LINE+4]]:7: ERROR: `alias` introducer should be followed by a name. // CHECK:STDERR: alias = b; diff --git a/toolchain/parse/testdata/array/fail_require_close_bracket.carbon b/toolchain/parse/testdata/array/fail_require_close_bracket.carbon index aa4021d6e02c..16af719a5a1e 100644 --- a/toolchain/parse/testdata/array/fail_require_close_bracket.carbon +++ b/toolchain/parse/testdata/array/fail_require_close_bracket.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/array/fail_require_close_bracket.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/array/fail_require_close_bracket.carbon // TODO: It should emit only one error message. // CHECK:STDERR: fail_require_close_bracket.carbon:[[@LINE+7]]:8: ERROR: Opening symbol without a corresponding closing symbol. diff --git a/toolchain/parse/testdata/array/fail_require_semi.carbon b/toolchain/parse/testdata/array/fail_require_semi.carbon index 22e782518c48..0754ff04843e 100644 --- a/toolchain/parse/testdata/array/fail_require_semi.carbon +++ b/toolchain/parse/testdata/array/fail_require_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/array/fail_require_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/array/fail_require_semi.carbon // CHECK:STDERR: fail_require_semi.carbon:[[@LINE+3]]:12: ERROR: Expected `;` in array type. // CHECK:STDERR: var x: [i32]; diff --git a/toolchain/parse/testdata/array/fail_syntax.carbon b/toolchain/parse/testdata/array/fail_syntax.carbon index 8b2d6049d6b7..4df2f5a5fe54 100644 --- a/toolchain/parse/testdata/array/fail_syntax.carbon +++ b/toolchain/parse/testdata/array/fail_syntax.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/array/fail_syntax.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/array/fail_syntax.carbon // --- fail_type.carbon diff --git a/toolchain/parse/testdata/array/with_length.carbon b/toolchain/parse/testdata/array/with_length.carbon index 0b71ff2d3afb..84217ed5ba67 100644 --- a/toolchain/parse/testdata/array/with_length.carbon +++ b/toolchain/parse/testdata/array/with_length.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/array/with_length.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/array/with_length.carbon var x: [i32; 10]; diff --git a/toolchain/parse/testdata/array/without_length.carbon b/toolchain/parse/testdata/array/without_length.carbon index 30f278abf392..68d0ba0a027b 100644 --- a/toolchain/parse/testdata/array/without_length.carbon +++ b/toolchain/parse/testdata/array/without_length.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/array/without_length.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/array/without_length.carbon var x: [i32;]; diff --git a/toolchain/parse/testdata/auto/let.carbon b/toolchain/parse/testdata/auto/let.carbon index b20662bde226..1a71fa826d0e 100644 --- a/toolchain/parse/testdata/auto/let.carbon +++ b/toolchain/parse/testdata/auto/let.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/auto/let.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/auto/let.carbon let x: auto = 1; diff --git a/toolchain/parse/testdata/auto/match_case.carbon b/toolchain/parse/testdata/auto/match_case.carbon index 257b32dae5e1..af9345a09937 100644 --- a/toolchain/parse/testdata/auto/match_case.carbon +++ b/toolchain/parse/testdata/auto/match_case.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/auto/match_case.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/auto/match_case.carbon fn f() -> bool { match (true) { diff --git a/toolchain/parse/testdata/auto/return.carbon b/toolchain/parse/testdata/auto/return.carbon index cc2128ce7619..3b520bea5a57 100644 --- a/toolchain/parse/testdata/auto/return.carbon +++ b/toolchain/parse/testdata/auto/return.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/auto/return.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/auto/return.carbon fn f() -> auto { return true; diff --git a/toolchain/parse/testdata/auto/var.carbon b/toolchain/parse/testdata/auto/var.carbon index a756181b2641..7c4820fa9783 100644 --- a/toolchain/parse/testdata/auto/var.carbon +++ b/toolchain/parse/testdata/auto/var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/auto/var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/auto/var.carbon var y: auto = false; diff --git a/toolchain/parse/testdata/basics/builtin_types.carbon b/toolchain/parse/testdata/basics/builtin_types.carbon index 53cea4607d4b..afbe80ba1e0a 100644 --- a/toolchain/parse/testdata/basics/builtin_types.carbon +++ b/toolchain/parse/testdata/basics/builtin_types.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/builtin_types.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/builtin_types.carbon var test_i32: i32 = 0; var test_f64: f64 = 0.1; diff --git a/toolchain/parse/testdata/basics/empty.carbon b/toolchain/parse/testdata/basics/empty.carbon index 3329ba12087e..7c4cfae06efa 100644 --- a/toolchain/parse/testdata/basics/empty.carbon +++ b/toolchain/parse/testdata/basics/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/empty.carbon // CHECK:STDOUT: - filename: empty.carbon // CHECK:STDOUT: parse_tree: [ diff --git a/toolchain/parse/testdata/basics/empty_decl.carbon b/toolchain/parse/testdata/basics/empty_decl.carbon index 44d910612c2b..e5b725bddabe 100644 --- a/toolchain/parse/testdata/basics/empty_decl.carbon +++ b/toolchain/parse/testdata/basics/empty_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/empty_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/empty_decl.carbon ; diff --git a/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon b/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon index eb09cc712cb5..77596e0c9987 100644 --- a/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon +++ b/toolchain/parse/testdata/basics/fail_bracket_recovery.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_bracket_recovery.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_bracket_recovery.carbon // This is a valid parse tree even though the lex errors. fn F() { diff --git a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon index 79d124a9c27f..f789aec31958 100644 --- a/toolchain/parse/testdata/basics/fail_invalid_designators.carbon +++ b/toolchain/parse/testdata/basics/fail_invalid_designators.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_invalid_designators.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_invalid_designators.carbon // NOTE: Move to its own directory when more tests are added. fn F() { diff --git a/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon b/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon index 5ee62a625380..b402e2dd4ab1 100644 --- a/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_modifiers_before_semi.carbon // CHECK:STDERR: fail_modifiers_before_semi.carbon:[[@LINE+3]]:18: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: protected virtual; diff --git a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon index cf7d167d53dd..06fddaa882fe 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_no_intro_with_semi.carbon // CHECK:STDERR: fail_no_intro_with_semi.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: foo; diff --git a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon index a282093b766e..0a2262f5cb37 100644 --- a/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon +++ b/toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_no_intro_without_semi.carbon // CHECK:STDERR: fail_no_intro_without_semi.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: foo bar baz diff --git a/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon b/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon index 9ca9154bf6c5..acf3c05bb242 100644 --- a/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon +++ b/toolchain/parse/testdata/basics/fail_paren_match_regression.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/fail_paren_match_regression.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/fail_paren_match_regression.carbon // CHECK:STDERR: fail_paren_match_regression.carbon:[[@LINE+8]]:5: ERROR: Expected binding pattern. // CHECK:STDERR: var = (foo {}) diff --git a/toolchain/parse/testdata/basics/function_call.carbon b/toolchain/parse/testdata/basics/function_call.carbon index b8db6abae9ba..c6b875346055 100644 --- a/toolchain/parse/testdata/basics/function_call.carbon +++ b/toolchain/parse/testdata/basics/function_call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/function_call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/function_call.carbon // NOTE: Move to its own directory when more tests are added. fn F() { diff --git a/toolchain/parse/testdata/basics/multifile.carbon b/toolchain/parse/testdata/basics/multifile.carbon index 3cc042d76063..afe3328df11c 100644 --- a/toolchain/parse/testdata/basics/multifile.carbon +++ b/toolchain/parse/testdata/basics/multifile.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/multifile.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/multifile.carbon // --- a.carbon fn A() {} diff --git a/toolchain/parse/testdata/basics/numeric_literals.carbon b/toolchain/parse/testdata/basics/numeric_literals.carbon index 3a7398440115..63b92b669512 100644 --- a/toolchain/parse/testdata/basics/numeric_literals.carbon +++ b/toolchain/parse/testdata/basics/numeric_literals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/numeric_literals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/numeric_literals.carbon fn F() { // 8 and 9 trigger special behavior in APInt when mishandling signed versus diff --git a/toolchain/parse/testdata/basics/parens.carbon b/toolchain/parse/testdata/basics/parens.carbon index 65a4a51bec38..ad0a0c2b37b1 100644 --- a/toolchain/parse/testdata/basics/parens.carbon +++ b/toolchain/parse/testdata/basics/parens.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/basics/parens.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/basics/parens.carbon fn F(n: i32) -> i32 { return ((((n)))); diff --git a/toolchain/parse/testdata/choice/basic.carbon b/toolchain/parse/testdata/choice/basic.carbon index 52715941e2e9..74057417651e 100644 --- a/toolchain/parse/testdata/choice/basic.carbon +++ b/toolchain/parse/testdata/choice/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/basic.carbon choice Ordering { Less, diff --git a/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon b/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon index f6cc977dd79b..70f88f3ccaf5 100644 --- a/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon +++ b/toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_alternative_with_implicit_params.carbon choice X { // CHECK:STDERR: fail_alternative_with_implicit_params.carbon:[[@LINE+3]]:4: ERROR: Expected `,` or `}`. diff --git a/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon b/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon index faf6fb565b6b..dca47d89b3e5 100644 --- a/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon +++ b/toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_invalid_alternative_identifier.carbon choice InvalidAlternativeIdentifier { // CHECK:STDERR: fail_invalid_alternative_identifier.carbon:[[@LINE+4]]:5: ERROR: Expected choice alternative name. diff --git a/toolchain/parse/testdata/choice/fail_invalid_braces.carbon b/toolchain/parse/testdata/choice/fail_invalid_braces.carbon index cfd1afe8d0e3..1bfb0ffb6f0c 100644 --- a/toolchain/parse/testdata/choice/fail_invalid_braces.carbon +++ b/toolchain/parse/testdata/choice/fail_invalid_braces.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_invalid_braces.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_invalid_braces.carbon // CHECK:STDERR: fail_invalid_braces.carbon:[[@LINE+4]]:22: ERROR: Choice definition expected. // CHECK:STDERR: choice InvalidBraces | diff --git a/toolchain/parse/testdata/choice/fail_missing_definition.carbon b/toolchain/parse/testdata/choice/fail_missing_definition.carbon index 50f3f2ddb08d..b570bd299c01 100644 --- a/toolchain/parse/testdata/choice/fail_missing_definition.carbon +++ b/toolchain/parse/testdata/choice/fail_missing_definition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_missing_definition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_missing_definition.carbon // CHECK:STDERR: fail_missing_definition.carbon:[[@LINE+3]]:25: ERROR: Choice definition expected. // CHECK:STDERR: choice MissingDefinition; diff --git a/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon b/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon index 28f99bc6664e..b0f1bd8d343c 100644 --- a/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon +++ b/toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_missing_definition_parameterized.carbon // CHECK:STDERR: fail_missing_definition_parameterized.carbon:[[@LINE+3]]:35: ERROR: Choice definition expected. // CHECK:STDERR: choice MissingDefinition(T:! type); diff --git a/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon b/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon index 64bdd0523c53..634c71d8a7f7 100644 --- a/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon +++ b/toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/fail_qualified_alternative_name.carbon choice X { // CHECK:STDERR: fail_qualified_alternative_name.carbon:[[@LINE+3]]:4: ERROR: Expected `,` or `}`. diff --git a/toolchain/parse/testdata/choice/modifiers.carbon b/toolchain/parse/testdata/choice/modifiers.carbon index 729900968ab6..e365cb4d8536 100644 --- a/toolchain/parse/testdata/choice/modifiers.carbon +++ b/toolchain/parse/testdata/choice/modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/modifiers.carbon private choice Ordering { Less, diff --git a/toolchain/parse/testdata/choice/parameterized.carbon b/toolchain/parse/testdata/choice/parameterized.carbon index 27a91d5140d0..34d5ef2935be 100644 --- a/toolchain/parse/testdata/choice/parameterized.carbon +++ b/toolchain/parse/testdata/choice/parameterized.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/choice/parameterized.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/choice/parameterized.carbon choice OptionalElement(T:! type) { Element(value: T), diff --git a/toolchain/parse/testdata/class/adapt.carbon b/toolchain/parse/testdata/class/adapt.carbon index 2fcc5c694404..0d79cf70454d 100644 --- a/toolchain/parse/testdata/class/adapt.carbon +++ b/toolchain/parse/testdata/class/adapt.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/adapt.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/adapt.carbon // --- adapt.carbon diff --git a/toolchain/parse/testdata/class/base.carbon b/toolchain/parse/testdata/class/base.carbon index c05839786ec7..459bcde326f0 100644 --- a/toolchain/parse/testdata/class/base.carbon +++ b/toolchain/parse/testdata/class/base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/base.carbon base class B {} diff --git a/toolchain/parse/testdata/class/base_misplaced.carbon b/toolchain/parse/testdata/class/base_misplaced.carbon index 37e249673666..749eca717e75 100644 --- a/toolchain/parse/testdata/class/base_misplaced.carbon +++ b/toolchain/parse/testdata/class/base_misplaced.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/base_misplaced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/base_misplaced.carbon // This is rejected by check. base: i32; diff --git a/toolchain/parse/testdata/class/basic.carbon b/toolchain/parse/testdata/class/basic.carbon index 2b8e33c4c4a8..a344a2dd0ed4 100644 --- a/toolchain/parse/testdata/class/basic.carbon +++ b/toolchain/parse/testdata/class/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/basic.carbon class Foo { fn Baz(); diff --git a/toolchain/parse/testdata/class/fail_base.carbon b/toolchain/parse/testdata/class/fail_base.carbon index 6ae77227f2aa..1268b1fd931e 100644 --- a/toolchain/parse/testdata/class/fail_base.carbon +++ b/toolchain/parse/testdata/class/fail_base.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/fail_base.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fail_base.carbon class A { // CHECK:STDERR: fail_base.carbon:[[@LINE+4]]:7: ERROR: `class` or `:` expected after `base`. diff --git a/toolchain/parse/testdata/class/fail_base_misplaced.carbon b/toolchain/parse/testdata/class/fail_base_misplaced.carbon index b0757492675c..551fc27976b2 100644 --- a/toolchain/parse/testdata/class/fail_base_misplaced.carbon +++ b/toolchain/parse/testdata/class/fail_base_misplaced.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/fail_base_misplaced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fail_base_misplaced.carbon base class B {} diff --git a/toolchain/parse/testdata/class/fail_modifiers.carbon b/toolchain/parse/testdata/class/fail_modifiers.carbon index 8a28a3604ba2..863932b9a8d0 100644 --- a/toolchain/parse/testdata/class/fail_modifiers.carbon +++ b/toolchain/parse/testdata/class/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fail_modifiers.carbon // --- fail_virtual_class.carbon diff --git a/toolchain/parse/testdata/class/fn_definitions.carbon b/toolchain/parse/testdata/class/fn_definitions.carbon index c77fbf70eebf..32739f84b689 100644 --- a/toolchain/parse/testdata/class/fn_definitions.carbon +++ b/toolchain/parse/testdata/class/fn_definitions.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/fn_definitions.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/fn_definitions.carbon class Foo { fn Make() -> Self { return {.x = 0}; } diff --git a/toolchain/parse/testdata/class/introducer.carbon b/toolchain/parse/testdata/class/introducer.carbon index bff4b0367edb..60fac4891aef 100644 --- a/toolchain/parse/testdata/class/introducer.carbon +++ b/toolchain/parse/testdata/class/introducer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/introducer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/introducer.carbon class A; base class B; diff --git a/toolchain/parse/testdata/class/mismatched_introducer.carbon b/toolchain/parse/testdata/class/mismatched_introducer.carbon index d90b3936b0c3..620053f0b7f0 100644 --- a/toolchain/parse/testdata/class/mismatched_introducer.carbon +++ b/toolchain/parse/testdata/class/mismatched_introducer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/mismatched_introducer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/mismatched_introducer.carbon // Note: invalid modifiers are diagnosed in check not parse. abstract interface I; diff --git a/toolchain/parse/testdata/class/var.carbon b/toolchain/parse/testdata/class/var.carbon index a2ee00797845..d93cff0f43e5 100644 --- a/toolchain/parse/testdata/class/var.carbon +++ b/toolchain/parse/testdata/class/var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/class/var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/class/var.carbon class Foo { var x: i32; diff --git a/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon b/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon index e45b29091580..a887d09fe9fe 100644 --- a/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon +++ b/toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_colon_instead_of_in.carbon fn foo() { // CHECK:STDERR: fail_colon_instead_of_in.carbon:[[@LINE+3]]:19: ERROR: `:` should be replaced by `in`. diff --git a/toolchain/parse/testdata/for/fail_missing_cond.carbon b/toolchain/parse/testdata/for/fail_missing_cond.carbon index bcc683dc652b..ed416009d04b 100644 --- a/toolchain/parse/testdata/for/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/for/fail_missing_cond.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_missing_cond.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_missing_cond.carbon fn F() { // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+8]]:7: ERROR: Expected `(` after `for`. diff --git a/toolchain/parse/testdata/for/fail_missing_in.carbon b/toolchain/parse/testdata/for/fail_missing_in.carbon index 7b638c563316..90d074b24d4e 100644 --- a/toolchain/parse/testdata/for/fail_missing_in.carbon +++ b/toolchain/parse/testdata/for/fail_missing_in.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_missing_in.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_missing_in.carbon fn foo() { // CHECK:STDERR: fail_missing_in.carbon:[[@LINE+3]]:19: ERROR: Expected `in` after loop `var` declaration. diff --git a/toolchain/parse/testdata/for/fail_missing_var.carbon b/toolchain/parse/testdata/for/fail_missing_var.carbon index 44e7d7646081..5a0b89add7e6 100644 --- a/toolchain/parse/testdata/for/fail_missing_var.carbon +++ b/toolchain/parse/testdata/for/fail_missing_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_missing_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_missing_var.carbon fn foo() { // CHECK:STDERR: fail_missing_var.carbon:[[@LINE+3]]:8: ERROR: Expected `var` declaration. diff --git a/toolchain/parse/testdata/for/fail_returned_var.carbon b/toolchain/parse/testdata/for/fail_returned_var.carbon index 036895304d4d..ab24884804ec 100644 --- a/toolchain/parse/testdata/for/fail_returned_var.carbon +++ b/toolchain/parse/testdata/for/fail_returned_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_returned_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_returned_var.carbon fn foo() -> i32 { // TODO: Should we allow this? diff --git a/toolchain/parse/testdata/for/fail_square_brackets.carbon b/toolchain/parse/testdata/for/fail_square_brackets.carbon index b92bbd0a7435..f9f21e6bb628 100644 --- a/toolchain/parse/testdata/for/fail_square_brackets.carbon +++ b/toolchain/parse/testdata/for/fail_square_brackets.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/fail_square_brackets.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/fail_square_brackets.carbon fn F() { // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+15]]:7: ERROR: Expected `(` after `for`. diff --git a/toolchain/parse/testdata/for/nested.carbon b/toolchain/parse/testdata/for/nested.carbon index 603dabe0f732..d7ed13452212 100644 --- a/toolchain/parse/testdata/for/nested.carbon +++ b/toolchain/parse/testdata/for/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/nested.carbon fn foo() { for (var y: i32 in x) { diff --git a/toolchain/parse/testdata/for/simple.carbon b/toolchain/parse/testdata/for/simple.carbon index de3cc724ea01..48f63c17eb00 100644 --- a/toolchain/parse/testdata/for/simple.carbon +++ b/toolchain/parse/testdata/for/simple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/for/simple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/for/simple.carbon fn foo() { for (var x: i32 in y) { diff --git a/toolchain/parse/testdata/function/declaration/addr.carbon b/toolchain/parse/testdata/function/declaration/addr.carbon index 886c17377b53..ae55ee1967be 100644 --- a/toolchain/parse/testdata/function/declaration/addr.carbon +++ b/toolchain/parse/testdata/function/declaration/addr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/addr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/addr.carbon fn foo(addr a: i32*); diff --git a/toolchain/parse/testdata/function/declaration/basic.carbon b/toolchain/parse/testdata/function/declaration/basic.carbon index 2c7cb9a43281..38a051f9355a 100644 --- a/toolchain/parse/testdata/function/declaration/basic.carbon +++ b/toolchain/parse/testdata/function/declaration/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/basic.carbon fn F(); extern fn G(); diff --git a/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon b/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon index 858f0c692a3c..f06c59fd52f4 100644 --- a/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_identifier_instead_of_sig.carbon // CHECK:STDERR: fail_identifier_instead_of_sig.carbon:[[@LINE+3]]:8: ERROR: `fn` declarations must either end with a `;` or have a `{ ... }` block for a definition. // CHECK:STDERR: fn foo bar; diff --git a/toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon b/toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon index 20206c75be69..aa08ed2c1d36 100644 --- a/toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_missing_implicit_close.carbon // Fix and uncomment this to test error handling. // CHECK:STDERR: fail_missing_implicit_close.carbon:[[@LINE+7]]:7: ERROR: Opening symbol without a corresponding closing symbol. diff --git a/toolchain/parse/testdata/function/declaration/fail_missing_name.carbon b/toolchain/parse/testdata/function/declaration/fail_missing_name.carbon index 2f7b8907eeae..b9407b7c2c9e 100644 --- a/toolchain/parse/testdata/function/declaration/fail_missing_name.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_missing_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_missing_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_missing_name.carbon // CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn (); diff --git a/toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon index e3b8f8801e52..ebb055d8fd90 100644 --- a/toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_no_sig_or_semi.carbon fn foo diff --git a/toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon index 18bf799988c9..d7662234261c 100644 --- a/toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_only_fn_and_semi.carbon // CHECK:STDERR: fail_only_fn_and_semi.carbon:[[@LINE+3]]:3: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn; diff --git a/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon index 74f8f44e7528..ce1e8859963a 100644 --- a/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_repeated_fn_and_semi.carbon // CHECK:STDERR: fail_repeated_fn_and_semi.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn fn; diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon index aae332128695..070bb007957c 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_until_outdent.carbon // CHECK:STDERR: fail_skip_indented_newline_until_outdent.carbon:[[@LINE+3]]:6: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn (x, diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon index 8ab23f06381a..451a198cb448 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_with_semi.carbon // CHECK:STDERR: fail_skip_indented_newline_with_semi.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn (x, diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon index c87c5f97f2a1..2602e8fc87d1 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_indented_newline_without_semi.carbon // CHECK:STDERR: fail_skip_indented_newline_without_semi.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn (x, diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon index 102720884755..11d69d7cdd82 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_to_newline_without_semi.carbon // CHECK:STDERR: fail_skip_to_newline_without_semi.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn () diff --git a/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon b/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon index e095045ba12c..dad928424e01 100644 --- a/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_skip_without_semi_to_curly.carbon // CHECK:STDERR: fail_skip_without_semi_to_curly.carbon:[[@LINE+3]]:1: ERROR: Unrecognized declaration introducer. // CHECK:STDERR: struct X { fn () } diff --git a/toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon b/toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon index 0b3e5681c2eb..6ef9eab37733 100644 --- a/toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_with_identifier_as_param.carbon // CHECK:STDERR: fail_with_identifier_as_param.carbon:[[@LINE+3]]:11: ERROR: Expected binding pattern. // CHECK:STDERR: fn foo(bar); diff --git a/toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon b/toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon index 57577f0c3e83..e82c80fe21d9 100644 --- a/toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon +++ b/toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/fail_without_name_and_many_tokens_in_params.carbon // CHECK:STDERR: fail_without_name_and_many_tokens_in_params.carbon:[[@LINE+3]]:4: ERROR: `fn` introducer should be followed by a name. // CHECK:STDERR: fn (a tokens c d e f g h i j k l m n o p q r s t u v w x y z); diff --git a/toolchain/parse/testdata/function/declaration/impl_fn.carbon b/toolchain/parse/testdata/function/declaration/impl_fn.carbon index 9ba4f9767156..dd40b8018639 100644 --- a/toolchain/parse/testdata/function/declaration/impl_fn.carbon +++ b/toolchain/parse/testdata/function/declaration/impl_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/impl_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/impl_fn.carbon impl fn F(); abstract impl fn G(); diff --git a/toolchain/parse/testdata/function/declaration/implicit_empty.carbon b/toolchain/parse/testdata/function/declaration/implicit_empty.carbon index c97199e4b1a9..c8b4efd3b96f 100644 --- a/toolchain/parse/testdata/function/declaration/implicit_empty.carbon +++ b/toolchain/parse/testdata/function/declaration/implicit_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/implicit_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/implicit_empty.carbon fn foo[](); diff --git a/toolchain/parse/testdata/function/declaration/implicit_params.carbon b/toolchain/parse/testdata/function/declaration/implicit_params.carbon index c1f0ed21a2a8..8c1f096e44c7 100644 --- a/toolchain/parse/testdata/function/declaration/implicit_params.carbon +++ b/toolchain/parse/testdata/function/declaration/implicit_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/implicit_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/implicit_params.carbon fn foo[a: i32, b: i32](); diff --git a/toolchain/parse/testdata/function/declaration/no_params.carbon b/toolchain/parse/testdata/function/declaration/no_params.carbon index c4b833ca75c5..66eb3f845367 100644 --- a/toolchain/parse/testdata/function/declaration/no_params.carbon +++ b/toolchain/parse/testdata/function/declaration/no_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/no_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/no_params.carbon fn foo {} diff --git a/toolchain/parse/testdata/function/declaration/params.carbon b/toolchain/parse/testdata/function/declaration/params.carbon index ecb9876d6af5..5aad2495ec19 100644 --- a/toolchain/parse/testdata/function/declaration/params.carbon +++ b/toolchain/parse/testdata/function/declaration/params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/params.carbon fn foo(a: i32, b: i32); diff --git a/toolchain/parse/testdata/function/declaration/with_return_type.carbon b/toolchain/parse/testdata/function/declaration/with_return_type.carbon index 7a3ae20bda0c..82d49a414d9c 100644 --- a/toolchain/parse/testdata/function/declaration/with_return_type.carbon +++ b/toolchain/parse/testdata/function/declaration/with_return_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/declaration/with_return_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/declaration/with_return_type.carbon fn foo() -> u32; diff --git a/toolchain/parse/testdata/function/definition/basic.carbon b/toolchain/parse/testdata/function/definition/basic.carbon index e5c3b1c1e956..d4c42806db0c 100644 --- a/toolchain/parse/testdata/function/definition/basic.carbon +++ b/toolchain/parse/testdata/function/definition/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/basic.carbon fn F() {} extern fn G() {} diff --git a/toolchain/parse/testdata/function/definition/builtin.carbon b/toolchain/parse/testdata/function/definition/builtin.carbon index fbc52e6023ba..e4662a51b7bd 100644 --- a/toolchain/parse/testdata/function/definition/builtin.carbon +++ b/toolchain/parse/testdata/function/definition/builtin.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/builtin.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/builtin.carbon fn F() = "builtin"; diff --git a/toolchain/parse/testdata/function/definition/fail_builtin.carbon b/toolchain/parse/testdata/function/definition/fail_builtin.carbon index 8d40b8a3d4c3..a4e7fa5223b2 100644 --- a/toolchain/parse/testdata/function/definition/fail_builtin.carbon +++ b/toolchain/parse/testdata/function/definition/fail_builtin.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/fail_builtin.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/fail_builtin.carbon // CHECK:STDERR: fail_builtin.carbon:[[@LINE+4]]:18: ERROR: Expected builtin function name after `=`. // CHECK:STDERR: fn NotString() = banana; diff --git a/toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon b/toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon index 266bb001b09f..cdd7b3de02b2 100644 --- a/toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon +++ b/toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/fail_identifier_in_statements.carbon fn F() { // Note: this might become valid depending on the expression syntax. This test diff --git a/toolchain/parse/testdata/function/definition/with_params.carbon b/toolchain/parse/testdata/function/definition/with_params.carbon index 0b873289156d..99ee0a14a4ac 100644 --- a/toolchain/parse/testdata/function/definition/with_params.carbon +++ b/toolchain/parse/testdata/function/definition/with_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/with_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/with_params.carbon fn foo(bar: i64, baz: i64) { foo(baz, bar + baz); diff --git a/toolchain/parse/testdata/function/definition/with_return_type.carbon b/toolchain/parse/testdata/function/definition/with_return_type.carbon index fec60f6eb37d..76cc6b90fe28 100644 --- a/toolchain/parse/testdata/function/definition/with_return_type.carbon +++ b/toolchain/parse/testdata/function/definition/with_return_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/function/definition/with_return_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/function/definition/with_return_type.carbon fn foo() -> f64 { return 42; diff --git a/toolchain/parse/testdata/generics/deduced_params/empty.carbon b/toolchain/parse/testdata/generics/deduced_params/empty.carbon index 3604c7352073..278299b70916 100644 --- a/toolchain/parse/testdata/generics/deduced_params/empty.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/empty.carbon class Foo[](); diff --git a/toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon b/toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon index 9870dd2f8cc8..de5ebd4fb097 100644 --- a/toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/fail_no_parens.carbon // CHECK:STDERR: fail_no_parens.carbon:[[@LINE+4]]:12: ERROR: A `(` for parameters is required after implicit parameters. // CHECK:STDERR: class Foo[]; diff --git a/toolchain/parse/testdata/generics/deduced_params/one.carbon b/toolchain/parse/testdata/generics/deduced_params/one.carbon index faf03c86d61b..3f42add1cfe7 100644 --- a/toolchain/parse/testdata/generics/deduced_params/one.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/one.carbon class Foo[a: i32](); diff --git a/toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon b/toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon index 1ce61484b886..67777012f707 100644 --- a/toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/one_suffix_comma.carbon class Foo[a: i32,](); diff --git a/toolchain/parse/testdata/generics/deduced_params/six.carbon b/toolchain/parse/testdata/generics/deduced_params/six.carbon index 0b210e396ecb..f550d44f4f7b 100644 --- a/toolchain/parse/testdata/generics/deduced_params/six.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/six.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/six.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/six.carbon class Foo[a: i32, b: i32, c: i32, d: i32, e: i32, f: i32](); diff --git a/toolchain/parse/testdata/generics/deduced_params/two.carbon b/toolchain/parse/testdata/generics/deduced_params/two.carbon index 33dffd7ba691..d06effbb7ca0 100644 --- a/toolchain/parse/testdata/generics/deduced_params/two.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/two.carbon class Foo[a: i32, b: i32](); diff --git a/toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon b/toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon index 948b18260355..c784c48c8c74 100644 --- a/toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon +++ b/toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/deduced_params/two_suffix_comma.carbon class Foo[a: i32, b: i32,](); diff --git a/toolchain/parse/testdata/generics/generic_params/basic.carbon b/toolchain/parse/testdata/generics/generic_params/basic.carbon index 790390b445b2..688aa4cf8625 100644 --- a/toolchain/parse/testdata/generics/generic_params/basic.carbon +++ b/toolchain/parse/testdata/generics/generic_params/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/generic_params/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/generic_params/basic.carbon fn foo(a:! i32); diff --git a/toolchain/parse/testdata/generics/generic_params/template.carbon b/toolchain/parse/testdata/generics/generic_params/template.carbon index 8325f1e7a03a..7960c4182193 100644 --- a/toolchain/parse/testdata/generics/generic_params/template.carbon +++ b/toolchain/parse/testdata/generics/generic_params/template.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/generic_params/template.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/generic_params/template.carbon fn foo(template a:! i32); diff --git a/toolchain/parse/testdata/generics/generic_params/template_addr.carbon b/toolchain/parse/testdata/generics/generic_params/template_addr.carbon index a82588d65c1a..2ec44ec820f2 100644 --- a/toolchain/parse/testdata/generics/generic_params/template_addr.carbon +++ b/toolchain/parse/testdata/generics/generic_params/template_addr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/generic_params/template_addr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/generic_params/template_addr.carbon fn foo(template addr a:! i32); diff --git a/toolchain/parse/testdata/generics/impl/basic.carbon b/toolchain/parse/testdata/generics/impl/basic.carbon index b416db9208ee..9119025057c5 100644 --- a/toolchain/parse/testdata/generics/impl/basic.carbon +++ b/toolchain/parse/testdata/generics/impl/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/basic.carbon impl i32 as Interface { fn Add[self: Self](b: Self) -> Self; diff --git a/toolchain/parse/testdata/generics/impl/class.carbon b/toolchain/parse/testdata/generics/impl/class.carbon index d8fcfc1e51fa..ce769317e28a 100644 --- a/toolchain/parse/testdata/generics/impl/class.carbon +++ b/toolchain/parse/testdata/generics/impl/class.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/class.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/class.carbon class C { impl as ForwardDeclared; diff --git a/toolchain/parse/testdata/generics/impl/declaration.carbon b/toolchain/parse/testdata/generics/impl/declaration.carbon index ea547613579a..d5d369def346 100644 --- a/toolchain/parse/testdata/generics/impl/declaration.carbon +++ b/toolchain/parse/testdata/generics/impl/declaration.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/declaration.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/declaration.carbon impl bool as Interface; diff --git a/toolchain/parse/testdata/generics/impl/empty_body.carbon b/toolchain/parse/testdata/generics/impl/empty_body.carbon index ca21f336f198..0365a576c5ee 100644 --- a/toolchain/parse/testdata/generics/impl/empty_body.carbon +++ b/toolchain/parse/testdata/generics/impl/empty_body.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/empty_body.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/empty_body.carbon impl String as Interface { } diff --git a/toolchain/parse/testdata/generics/impl/fail_impl.carbon b/toolchain/parse/testdata/generics/impl/fail_impl.carbon index e738d5c8c46c..985843770e3f 100644 --- a/toolchain/parse/testdata/generics/impl/fail_impl.carbon +++ b/toolchain/parse/testdata/generics/impl/fail_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/fail_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/fail_impl.carbon // CHECK:STDERR: fail_impl.carbon:[[@LINE+4]]:10: ERROR: Expected `as` in `impl` declaration. // CHECK:STDERR: impl foo bar; diff --git a/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon b/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon index da96ff27514b..fa3c41a2da8f 100644 --- a/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon +++ b/toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/fail_out_of_line_member.carbon // TODO: Decide if we want to support this syntax. See #3763. diff --git a/toolchain/parse/testdata/generics/impl/forall.carbon b/toolchain/parse/testdata/generics/impl/forall.carbon index 976948cf91f5..83c7b079b4de 100644 --- a/toolchain/parse/testdata/generics/impl/forall.carbon +++ b/toolchain/parse/testdata/generics/impl/forall.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/impl/forall.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/impl/forall.carbon impl forall [T:! type] T as Interface; diff --git a/toolchain/parse/testdata/generics/interface/associated_constants.carbon b/toolchain/parse/testdata/generics/interface/associated_constants.carbon index 423897aaef03..1db31cc4facd 100644 --- a/toolchain/parse/testdata/generics/interface/associated_constants.carbon +++ b/toolchain/parse/testdata/generics/interface/associated_constants.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/associated_constants.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/associated_constants.carbon interface Foo { // TODO: support `let T:! type;` diff --git a/toolchain/parse/testdata/generics/interface/basic.carbon b/toolchain/parse/testdata/generics/interface/basic.carbon index b2ee8aa6c120..3afb30e2cae0 100644 --- a/toolchain/parse/testdata/generics/interface/basic.carbon +++ b/toolchain/parse/testdata/generics/interface/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/basic.carbon interface Foo { fn Add[self: Self](b: Self) -> Self; diff --git a/toolchain/parse/testdata/generics/interface/declaration.carbon b/toolchain/parse/testdata/generics/interface/declaration.carbon index 5bcee80d1742..7860157e60c7 100644 --- a/toolchain/parse/testdata/generics/interface/declaration.carbon +++ b/toolchain/parse/testdata/generics/interface/declaration.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/declaration.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/declaration.carbon interface Foo; diff --git a/toolchain/parse/testdata/generics/interface/default_fn.carbon b/toolchain/parse/testdata/generics/interface/default_fn.carbon index 24ca7845ac92..386cbe2556f6 100644 --- a/toolchain/parse/testdata/generics/interface/default_fn.carbon +++ b/toolchain/parse/testdata/generics/interface/default_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/default_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/default_fn.carbon interface Foo { fn Scale[self: Self](s: i32) -> Self; diff --git a/toolchain/parse/testdata/generics/interface/empty_body.carbon b/toolchain/parse/testdata/generics/interface/empty_body.carbon index fbf61e501f92..f2d15d68146b 100644 --- a/toolchain/parse/testdata/generics/interface/empty_body.carbon +++ b/toolchain/parse/testdata/generics/interface/empty_body.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/empty_body.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/empty_body.carbon interface Foo { } diff --git a/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon b/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon index 7533e6673a8d..5cbce33a464e 100644 --- a/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_missing_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/fail_missing_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_missing_name.carbon // CHECK:STDERR: fail_missing_name.carbon:[[@LINE+3]]:11: ERROR: `interface` introducer should be followed by a name. // CHECK:STDERR: interface { diff --git a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon index f95888e68eec..1ca5f4953f50 100644 --- a/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_missing_open_curly.carbon // CHECK:STDERR: fail_missing_open_curly.carbon:[[@LINE+4]]:15: ERROR: `interface` declarations must either end with a `;` or have a `{ ... }` block for a definition. // CHECK:STDERR: interface Bar Baz {} diff --git a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon index 312bf2bc4829..a2e5ce63e27e 100644 --- a/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon +++ b/toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/fail_self_param_syntax.carbon interface Foo { // CHECK:STDERR: fail_self_param_syntax.carbon:[[@LINE+4]]:13: ERROR: Expected binding pattern. diff --git a/toolchain/parse/testdata/generics/interface/final_fn.carbon b/toolchain/parse/testdata/generics/interface/final_fn.carbon index 3b7970415ae1..d77f43424829 100644 --- a/toolchain/parse/testdata/generics/interface/final_fn.carbon +++ b/toolchain/parse/testdata/generics/interface/final_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/final_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/final_fn.carbon interface Order { fn Less[self: Self](right: Self) -> bool; diff --git a/toolchain/parse/testdata/generics/interface/final_member_definition.carbon b/toolchain/parse/testdata/generics/interface/final_member_definition.carbon index ea6958190145..9b778faa896d 100644 --- a/toolchain/parse/testdata/generics/interface/final_member_definition.carbon +++ b/toolchain/parse/testdata/generics/interface/final_member_definition.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/final_member_definition.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/final_member_definition.carbon interface Foo { final fn Add[self: Self](b: Self) -> Self { diff --git a/toolchain/parse/testdata/generics/interface/non_instance_fn.carbon b/toolchain/parse/testdata/generics/interface/non_instance_fn.carbon index 201bd9262e0c..2755d49715be 100644 --- a/toolchain/parse/testdata/generics/interface/non_instance_fn.carbon +++ b/toolchain/parse/testdata/generics/interface/non_instance_fn.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/non_instance_fn.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/non_instance_fn.carbon interface Foo { fn FooFactory() -> Self; diff --git a/toolchain/parse/testdata/generics/interface/self_pointer.carbon b/toolchain/parse/testdata/generics/interface/self_pointer.carbon index 9ff0a2bc54b9..3af42ee70c2b 100644 --- a/toolchain/parse/testdata/generics/interface/self_pointer.carbon +++ b/toolchain/parse/testdata/generics/interface/self_pointer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/interface/self_pointer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/interface/self_pointer.carbon interface Foo { fn Sub[addr self: Self*](b: Self) -> Self; diff --git a/toolchain/parse/testdata/generics/named_constraint/basic.carbon b/toolchain/parse/testdata/generics/named_constraint/basic.carbon index 8265bc9fe0ef..67c82b56a8b1 100644 --- a/toolchain/parse/testdata/generics/named_constraint/basic.carbon +++ b/toolchain/parse/testdata/generics/named_constraint/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/named_constraint/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/named_constraint/basic.carbon constraint Foo { fn Baz(); diff --git a/toolchain/parse/testdata/generics/named_constraint/defined_method.carbon b/toolchain/parse/testdata/generics/named_constraint/defined_method.carbon index f1a44d583f0e..27859247b651 100644 --- a/toolchain/parse/testdata/generics/named_constraint/defined_method.carbon +++ b/toolchain/parse/testdata/generics/named_constraint/defined_method.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/named_constraint/defined_method.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/named_constraint/defined_method.carbon constraint Foo { fn Add[self: Self](b: Self) -> Self {} diff --git a/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon b/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon index 351ba948a73e..8c47dd29f176 100644 --- a/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon +++ b/toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/named_constraint/fail_incomplete.carbon // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:12: ERROR: `constraint` introducer should be followed by a name. // CHECK:STDERR: constraint "Foo" diff --git a/toolchain/parse/testdata/generics/params/empty.carbon b/toolchain/parse/testdata/generics/params/empty.carbon index 1d1c5a265dd1..e3806b5e0f40 100644 --- a/toolchain/parse/testdata/generics/params/empty.carbon +++ b/toolchain/parse/testdata/generics/params/empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/empty.carbon class Foo(); diff --git a/toolchain/parse/testdata/generics/params/name_qualifier.carbon b/toolchain/parse/testdata/generics/params/name_qualifier.carbon index e2d2e5259f9a..5e1cc1fa4b5c 100644 --- a/toolchain/parse/testdata/generics/params/name_qualifier.carbon +++ b/toolchain/parse/testdata/generics/params/name_qualifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/name_qualifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/name_qualifier.carbon class GenericClass1(T:! type) { fn F(); diff --git a/toolchain/parse/testdata/generics/params/one.carbon b/toolchain/parse/testdata/generics/params/one.carbon index 587586e17562..1d68b3072b45 100644 --- a/toolchain/parse/testdata/generics/params/one.carbon +++ b/toolchain/parse/testdata/generics/params/one.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/one.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/one.carbon class Foo(a: i32); diff --git a/toolchain/parse/testdata/generics/params/one_suffix_comma.carbon b/toolchain/parse/testdata/generics/params/one_suffix_comma.carbon index 2cecc643c5b7..9f7598a99318 100644 --- a/toolchain/parse/testdata/generics/params/one_suffix_comma.carbon +++ b/toolchain/parse/testdata/generics/params/one_suffix_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/one_suffix_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/one_suffix_comma.carbon class Foo(a: i32,); diff --git a/toolchain/parse/testdata/generics/params/six.carbon b/toolchain/parse/testdata/generics/params/six.carbon index 9280849ab892..cad1bb97d1be 100644 --- a/toolchain/parse/testdata/generics/params/six.carbon +++ b/toolchain/parse/testdata/generics/params/six.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/six.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/six.carbon class Foo(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32); diff --git a/toolchain/parse/testdata/generics/params/two.carbon b/toolchain/parse/testdata/generics/params/two.carbon index 7190377e6e29..7b67184f33fc 100644 --- a/toolchain/parse/testdata/generics/params/two.carbon +++ b/toolchain/parse/testdata/generics/params/two.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/two.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/two.carbon class Foo(a: i32, b: i32); diff --git a/toolchain/parse/testdata/generics/params/two_suffix_comma.carbon b/toolchain/parse/testdata/generics/params/two_suffix_comma.carbon index 186684cd103d..cc985fd5f66b 100644 --- a/toolchain/parse/testdata/generics/params/two_suffix_comma.carbon +++ b/toolchain/parse/testdata/generics/params/two_suffix_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/generics/params/two_suffix_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/generics/params/two_suffix_comma.carbon class Foo(a: i32, b: i32,); diff --git a/toolchain/parse/testdata/if/basic.carbon b/toolchain/parse/testdata/if/basic.carbon index fd2619c6c196..c03e133c7629 100644 --- a/toolchain/parse/testdata/if/basic.carbon +++ b/toolchain/parse/testdata/if/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/basic.carbon fn F() { if (a) { diff --git a/toolchain/parse/testdata/if/else.carbon b/toolchain/parse/testdata/if/else.carbon index 0329aff19a48..77dcfc3dbdda 100644 --- a/toolchain/parse/testdata/if/else.carbon +++ b/toolchain/parse/testdata/if/else.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/else.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/else.carbon fn F() { if (a) { diff --git a/toolchain/parse/testdata/if/fail_else_unbraced.carbon b/toolchain/parse/testdata/if/fail_else_unbraced.carbon index 5242bbfb1c28..3b47f6432554 100644 --- a/toolchain/parse/testdata/if/fail_else_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_else_unbraced.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/fail_else_unbraced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_else_unbraced.carbon fn F() { if (a) diff --git a/toolchain/parse/testdata/if/fail_errors.carbon b/toolchain/parse/testdata/if/fail_errors.carbon index 56fe9be9cef5..77b75eb39cf2 100644 --- a/toolchain/parse/testdata/if/fail_errors.carbon +++ b/toolchain/parse/testdata/if/fail_errors.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/fail_errors.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_errors.carbon fn F() { // CHECK:STDERR: fail_errors.carbon:[[@LINE+4]]:6: ERROR: Expected `(` after `if`. diff --git a/toolchain/parse/testdata/if/fail_missing_cond.carbon b/toolchain/parse/testdata/if/fail_missing_cond.carbon index ba051fb34fb9..af38aa5e7d78 100644 --- a/toolchain/parse/testdata/if/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/if/fail_missing_cond.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/fail_missing_cond.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_missing_cond.carbon fn F() { // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+3]]:6: ERROR: Expected `(` after `if`. diff --git a/toolchain/parse/testdata/if/fail_square_brackets.carbon b/toolchain/parse/testdata/if/fail_square_brackets.carbon index d0e10a61033d..018fb92241c4 100644 --- a/toolchain/parse/testdata/if/fail_square_brackets.carbon +++ b/toolchain/parse/testdata/if/fail_square_brackets.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/fail_square_brackets.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_square_brackets.carbon fn F() { // CHECK:STDERR: fail_square_brackets.carbon:[[@LINE+11]]:6: ERROR: Expected `(` after `if`. diff --git a/toolchain/parse/testdata/if/fail_unbraced.carbon b/toolchain/parse/testdata/if/fail_unbraced.carbon index ad0ce4c8181e..c715e85d1248 100644 --- a/toolchain/parse/testdata/if/fail_unbraced.carbon +++ b/toolchain/parse/testdata/if/fail_unbraced.carbon @@ -4,6 +4,10 @@ // // TODO: This should have an error. // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if/fail_unbraced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if/fail_unbraced.carbon fn F() { if (a) diff --git a/toolchain/parse/testdata/if_expr/basic.carbon b/toolchain/parse/testdata/if_expr/basic.carbon index a3ae11bf2267..05d6541294db 100644 --- a/toolchain/parse/testdata/if_expr/basic.carbon +++ b/toolchain/parse/testdata/if_expr/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/basic.carbon fn F(b: bool, x: i32, y: i32) -> bool { return if b then x else y; diff --git a/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon b/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon index c23719d6e063..e7822a054362 100644 --- a/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_condition_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_condition_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_condition_missing.carbon fn F() { // CHECK:STDERR: fail_condition_missing.carbon:[[@LINE+3]]:18: ERROR: Expected expression. diff --git a/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon b/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon index 2e2de4bb9789..493d1e44f052 100644 --- a/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_else_expr_missing.carbon fn F() { // CHECK:STDERR: fail_else_expr_missing.carbon:[[@LINE+3]]:35: ERROR: Expected expression. diff --git a/toolchain/parse/testdata/if_expr/fail_else_missing.carbon b/toolchain/parse/testdata/if_expr/fail_else_missing.carbon index 266c1d63b620..31a9b7f1c6ca 100644 --- a/toolchain/parse/testdata/if_expr/fail_else_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_else_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_else_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_else_missing.carbon fn F() { // CHECK:STDERR: fail_else_missing.carbon:[[@LINE+3]]:30: ERROR: Expected `else` after `if ... then ...`. diff --git a/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon b/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon index fda0aeb0dabe..7babebc1080b 100644 --- a/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_then_expr_missing.carbon fn F() { // CHECK:STDERR: fail_then_expr_missing.carbon:[[@LINE+3]]:28: ERROR: Expected expression. diff --git a/toolchain/parse/testdata/if_expr/fail_then_missing.carbon b/toolchain/parse/testdata/if_expr/fail_then_missing.carbon index f39e83f78f56..f076d8c2600c 100644 --- a/toolchain/parse/testdata/if_expr/fail_then_missing.carbon +++ b/toolchain/parse/testdata/if_expr/fail_then_missing.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_then_missing.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_then_missing.carbon fn F() { // CHECK:STDERR: fail_then_missing.carbon:[[@LINE+3]]:23: ERROR: Expected `then` after `if` condition. diff --git a/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon b/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon index 485e418c5115..c3db5d26f138 100644 --- a/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon +++ b/toolchain/parse/testdata/if_expr/fail_top_level_if.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/fail_top_level_if.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/fail_top_level_if.carbon fn F() { // CHECK:STDERR: fail_top_level_if.carbon:[[@LINE+11]]:6: ERROR: Expected `(` after `if`. diff --git a/toolchain/parse/testdata/if_expr/in_type.carbon b/toolchain/parse/testdata/if_expr/in_type.carbon index fdbaf4fff32e..3df9f2104edb 100644 --- a/toolchain/parse/testdata/if_expr/in_type.carbon +++ b/toolchain/parse/testdata/if_expr/in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/in_type.carbon var n: i32; diff --git a/toolchain/parse/testdata/if_expr/precedence.carbon b/toolchain/parse/testdata/if_expr/precedence.carbon index 46acdca3fd21..be0e89699273 100644 --- a/toolchain/parse/testdata/if_expr/precedence.carbon +++ b/toolchain/parse/testdata/if_expr/precedence.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/if_expr/precedence.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/if_expr/precedence.carbon fn F(b: bool) -> bool { return if b and b then b and b else b or b; diff --git a/toolchain/parse/testdata/index/assign_to_var.carbon b/toolchain/parse/testdata/index/assign_to_var.carbon index dcbdbeb6cb69..77f42f7b89da 100644 --- a/toolchain/parse/testdata/index/assign_to_var.carbon +++ b/toolchain/parse/testdata/index/assign_to_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/index/assign_to_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/index/assign_to_var.carbon var v: i32 = t[0]; diff --git a/toolchain/parse/testdata/index/fail_empty_expr.carbon b/toolchain/parse/testdata/index/fail_empty_expr.carbon index f19c55d30b5c..2567b3720e3b 100644 --- a/toolchain/parse/testdata/index/fail_empty_expr.carbon +++ b/toolchain/parse/testdata/index/fail_empty_expr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/index/fail_empty_expr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/index/fail_empty_expr.carbon // CHECK:STDERR: fail_empty_expr.carbon:[[@LINE+3]]:16: ERROR: Expected expression. // CHECK:STDERR: var v: i32 = t[]; diff --git a/toolchain/parse/testdata/index/fail_malformed_expr.carbon b/toolchain/parse/testdata/index/fail_malformed_expr.carbon index df7c86d4fdbd..034e1638810f 100644 --- a/toolchain/parse/testdata/index/fail_malformed_expr.carbon +++ b/toolchain/parse/testdata/index/fail_malformed_expr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/index/fail_malformed_expr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/index/fail_malformed_expr.carbon // CHECK:STDERR: fail_malformed_expr.carbon:[[@LINE+3]]:17: ERROR: Unexpected tokens before `]`. // CHECK:STDERR: var v: i32 = t[0,]; diff --git a/toolchain/parse/testdata/let/fail_bad_name.carbon b/toolchain/parse/testdata/let/fail_bad_name.carbon index 52815a63201d..4c3f2801db4d 100644 --- a/toolchain/parse/testdata/let/fail_bad_name.carbon +++ b/toolchain/parse/testdata/let/fail_bad_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/fail_bad_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_bad_name.carbon // CHECK:STDERR: fail_bad_name.carbon:[[@LINE+3]]:5: ERROR: Expected binding pattern. // CHECK:STDERR: let ? = 4; diff --git a/toolchain/parse/testdata/let/fail_empty.carbon b/toolchain/parse/testdata/let/fail_empty.carbon index 8ed75545887f..6ae07ffc5d35 100644 --- a/toolchain/parse/testdata/let/fail_empty.carbon +++ b/toolchain/parse/testdata/let/fail_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/fail_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_empty.carbon // CHECK:STDERR: fail_empty.carbon:[[@LINE+3]]:4: ERROR: Expected binding pattern. // CHECK:STDERR: let; diff --git a/toolchain/parse/testdata/let/fail_missing_type.carbon b/toolchain/parse/testdata/let/fail_missing_type.carbon index 39e53fb7dadd..bd37327255db 100644 --- a/toolchain/parse/testdata/let/fail_missing_type.carbon +++ b/toolchain/parse/testdata/let/fail_missing_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/fail_missing_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_missing_type.carbon // CHECK:STDERR: fail_missing_type.carbon:[[@LINE+3]]:7: ERROR: Expected binding pattern. // CHECK:STDERR: let a = 4; diff --git a/toolchain/parse/testdata/let/fail_no_semi.carbon b/toolchain/parse/testdata/let/fail_no_semi.carbon index 3154b86f66ee..96ff4139dce5 100644 --- a/toolchain/parse/testdata/let/fail_no_semi.carbon +++ b/toolchain/parse/testdata/let/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/fail_no_semi.carbon let diff --git a/toolchain/parse/testdata/let/let.carbon b/toolchain/parse/testdata/let/let.carbon index 8eba1330be4f..b3409e9d3d83 100644 --- a/toolchain/parse/testdata/let/let.carbon +++ b/toolchain/parse/testdata/let/let.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/let.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/let.carbon let v: i32 = 0; fn F() { diff --git a/toolchain/parse/testdata/let/let_tuple.carbon b/toolchain/parse/testdata/let/let_tuple.carbon index 705242d1b99f..afad874bbbde 100644 --- a/toolchain/parse/testdata/let/let_tuple.carbon +++ b/toolchain/parse/testdata/let/let_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/let_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/let_tuple.carbon fn F() { let (s: String, i: i32) = ("hello", 0); diff --git a/toolchain/parse/testdata/let/missing_value.carbon b/toolchain/parse/testdata/let/missing_value.carbon index dd8916f3bce7..91392703a569 100644 --- a/toolchain/parse/testdata/let/missing_value.carbon +++ b/toolchain/parse/testdata/let/missing_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/let/missing_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/let/missing_value.carbon let a: i32; diff --git a/toolchain/parse/testdata/match/fail_cases_after_default.carbon b/toolchain/parse/testdata/match/fail_cases_after_default.carbon index b4b17662d124..bc8335ddaa87 100644 --- a/toolchain/parse/testdata/match/fail_cases_after_default.carbon +++ b/toolchain/parse/testdata/match/fail_cases_after_default.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_cases_after_default.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_cases_after_default.carbon fn f() -> i32 { var x: i32 = 3; diff --git a/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon b/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon index ec58713df662..26e930b94951 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_arrow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_case_arrow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_case_arrow.carbon fn f() -> i32 { match (3) { diff --git a/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon b/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon index 017d04e13103..3d9d5fe4e60a 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_pattern.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_case_pattern.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_case_pattern.carbon fn f() -> i32 { match (3) { diff --git a/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon b/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon index 7c39d3f8a693..7fcf7723be35 100644 --- a/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_case_statements_block.carbon fn f() -> i32 { match (3) { diff --git a/toolchain/parse/testdata/match/fail_missing_cases.carbon b/toolchain/parse/testdata/match/fail_missing_cases.carbon index 77172a4b7e2d..86974d9452dd 100644 --- a/toolchain/parse/testdata/match/fail_missing_cases.carbon +++ b/toolchain/parse/testdata/match/fail_missing_cases.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_cases.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_cases.carbon fn f() -> i32 { diff --git a/toolchain/parse/testdata/match/fail_missing_cases_block.carbon b/toolchain/parse/testdata/match/fail_missing_cases_block.carbon index 08644819cb9d..240cad926208 100644 --- a/toolchain/parse/testdata/match/fail_missing_cases_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_cases_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_cases_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_cases_block.carbon fn f() -> i32 { match (1) diff --git a/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon b/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon index 16ba3a599b6d..e0a8c34b929b 100644 --- a/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon +++ b/toolchain/parse/testdata/match/fail_missing_default_arrow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_default_arrow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_default_arrow.carbon fn f() -> i32 { match (3) { diff --git a/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon b/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon index b5aefcb22277..d402067d8209 100644 --- a/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon +++ b/toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_default_statements_block.carbon fn f() -> i32 { match (3) { diff --git a/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon b/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon index ff30ead5f8f2..811b7e766797 100644 --- a/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon +++ b/toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_guard_close_paren.carbon fn f() -> i32 { match (true) { diff --git a/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon b/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon index 45311657b0bc..e8d85c33f650 100644 --- a/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon +++ b/toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_guard_open_paren.carbon fn f() -> i32 { match (true) { diff --git a/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon b/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon index a23de8ee5555..c3f6d5b9b191 100644 --- a/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon +++ b/toolchain/parse/testdata/match/fail_missing_matched_expr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_missing_matched_expr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_missing_matched_expr.carbon fn f() -> i32 { // CHECK:STDERR: fail_missing_matched_expr.carbon:[[@LINE+3]]:9: ERROR: Expected `(` after `match`. diff --git a/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon b/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon index d3ced0e946c8..5a4eab54f2a4 100644 --- a/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon +++ b/toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/fail_unexpected_tokens_in_cases_block.carbon fn f() -> i32 { var x: i32 = 3; diff --git a/toolchain/parse/testdata/match/match.carbon b/toolchain/parse/testdata/match/match.carbon index e98c54538cfc..c4755a9988ac 100644 --- a/toolchain/parse/testdata/match/match.carbon +++ b/toolchain/parse/testdata/match/match.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/match/match.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/match/match.carbon fn f() -> i32 { var x: i32 = 3; diff --git a/toolchain/parse/testdata/member_access/compound.carbon b/toolchain/parse/testdata/member_access/compound.carbon index f6ea610bec52..7faef5bfcac5 100644 --- a/toolchain/parse/testdata/member_access/compound.carbon +++ b/toolchain/parse/testdata/member_access/compound.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/member_access/compound.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/member_access/compound.carbon fn F() { a.(b); diff --git a/toolchain/parse/testdata/member_access/fail_keyword.carbon b/toolchain/parse/testdata/member_access/fail_keyword.carbon index e48360581c55..6cbee85c71bb 100644 --- a/toolchain/parse/testdata/member_access/fail_keyword.carbon +++ b/toolchain/parse/testdata/member_access/fail_keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/member_access/fail_keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/member_access/fail_keyword.carbon fn F() { // CHECK:STDERR: fail_keyword.carbon:[[@LINE+4]]:5: ERROR: Expected identifier after `.`. diff --git a/toolchain/parse/testdata/member_access/keyword.carbon b/toolchain/parse/testdata/member_access/keyword.carbon index a7b841c51e32..6c80ed317c06 100644 --- a/toolchain/parse/testdata/member_access/keyword.carbon +++ b/toolchain/parse/testdata/member_access/keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/member_access/keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/member_access/keyword.carbon fn F() { a.base; diff --git a/toolchain/parse/testdata/member_access/simple.carbon b/toolchain/parse/testdata/member_access/simple.carbon index 3dbb81c2bdf2..8c49e5453a02 100644 --- a/toolchain/parse/testdata/member_access/simple.carbon +++ b/toolchain/parse/testdata/member_access/simple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/member_access/simple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/member_access/simple.carbon fn F(a: T) { a.x; diff --git a/toolchain/parse/testdata/namespace/args.carbon b/toolchain/parse/testdata/namespace/args.carbon index c53c865fb051..8d6f1032d0c5 100644 --- a/toolchain/parse/testdata/namespace/args.carbon +++ b/toolchain/parse/testdata/namespace/args.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/args.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/args.carbon // This is rejected in check. namespace Foo(); diff --git a/toolchain/parse/testdata/namespace/basic.carbon b/toolchain/parse/testdata/namespace/basic.carbon index 9cf6d8d767fe..874883c41a28 100644 --- a/toolchain/parse/testdata/namespace/basic.carbon +++ b/toolchain/parse/testdata/namespace/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/basic.carbon namespace Foo; diff --git a/toolchain/parse/testdata/namespace/fail_arrow.carbon b/toolchain/parse/testdata/namespace/fail_arrow.carbon index 09956ebc8f25..ad5f8e4f98b9 100644 --- a/toolchain/parse/testdata/namespace/fail_arrow.carbon +++ b/toolchain/parse/testdata/namespace/fail_arrow.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/fail_arrow.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_arrow.carbon namespace Foo; diff --git a/toolchain/parse/testdata/namespace/fail_incomplete.carbon b/toolchain/parse/testdata/namespace/fail_incomplete.carbon index 872b262403a4..f4725da061ac 100644 --- a/toolchain/parse/testdata/namespace/fail_incomplete.carbon +++ b/toolchain/parse/testdata/namespace/fail_incomplete.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/fail_incomplete.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_incomplete.carbon // CHECK:STDERR: fail_incomplete.carbon:[[@LINE+4]]:11: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace 123 diff --git a/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon b/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon index 4b440f4acdd5..a3d86daceae9 100644 --- a/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon +++ b/toolchain/parse/testdata/namespace/fail_incomplete_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/fail_incomplete_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_incomplete_name.carbon // CHECK:STDERR: fail_incomplete_name.carbon:[[@LINE+3]]:15: ERROR: `.` should be followed by a name. // CHECK:STDERR: namespace Foo.; diff --git a/toolchain/parse/testdata/namespace/fail_modifiers.carbon b/toolchain/parse/testdata/namespace/fail_modifiers.carbon index c58a2544cdb1..bd49765c47a3 100644 --- a/toolchain/parse/testdata/namespace/fail_modifiers.carbon +++ b/toolchain/parse/testdata/namespace/fail_modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/fail_modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_modifiers.carbon virtual namespace B diff --git a/toolchain/parse/testdata/namespace/fail_no_name.carbon b/toolchain/parse/testdata/namespace/fail_no_name.carbon index 6256b1cbd65b..71ac7cd32231 100644 --- a/toolchain/parse/testdata/namespace/fail_no_name.carbon +++ b/toolchain/parse/testdata/namespace/fail_no_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/fail_no_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/fail_no_name.carbon // CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:10: ERROR: `namespace` introducer should be followed by a name. // CHECK:STDERR: namespace; diff --git a/toolchain/parse/testdata/namespace/modifiers.carbon b/toolchain/parse/testdata/namespace/modifiers.carbon index 659b3c39ded2..70961a18396a 100644 --- a/toolchain/parse/testdata/namespace/modifiers.carbon +++ b/toolchain/parse/testdata/namespace/modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/modifiers.carbon private extern abstract base default final namespace Foo; diff --git a/toolchain/parse/testdata/namespace/nested.carbon b/toolchain/parse/testdata/namespace/nested.carbon index f5f400b414bd..96070669f764 100644 --- a/toolchain/parse/testdata/namespace/nested.carbon +++ b/toolchain/parse/testdata/namespace/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/namespace/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/namespace/nested.carbon namespace Foo; namespace Foo.Bar; diff --git a/toolchain/parse/testdata/operators/assign.carbon b/toolchain/parse/testdata/operators/assign.carbon index 9d9e6af4e504..5e5714c1da64 100644 --- a/toolchain/parse/testdata/operators/assign.carbon +++ b/toolchain/parse/testdata/operators/assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/assign.carbon fn F() { var a: i32 = 0; diff --git a/toolchain/parse/testdata/operators/associative.carbon b/toolchain/parse/testdata/operators/associative.carbon index dc4c22c72a07..f453fd78145c 100644 --- a/toolchain/parse/testdata/operators/associative.carbon +++ b/toolchain/parse/testdata/operators/associative.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/associative.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/associative.carbon fn F() { a and b and c; diff --git a/toolchain/parse/testdata/operators/fail_chained_assign.carbon b/toolchain/parse/testdata/operators/fail_chained_assign.carbon index cb9cf74739ac..34d7e4b7b040 100644 --- a/toolchain/parse/testdata/operators/fail_chained_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_chained_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_chained_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_chained_assign.carbon fn F() { var a: i32; diff --git a/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon b/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon index 7a20ccbd347f..ee650c6d62bf 100644 --- a/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon +++ b/toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_infix_uneven_space_after.carbon // TODO: We could figure out that this first Failed example is infix // with one-token lookahead. diff --git a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon index fbab96cc35a1..43d91d75c9d6 100644 --- a/toolchain/parse/testdata/operators/fail_invalid_infix.carbon +++ b/toolchain/parse/testdata/operators/fail_invalid_infix.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_invalid_infix.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_invalid_infix.carbon // CHECK:STDERR: fail_invalid_infix.carbon:[[@LINE+4]]:19: ERROR: Expected expression. // CHECK:STDERR: var a: i32 = n == ; diff --git a/toolchain/parse/testdata/operators/fail_postincrement.carbon b/toolchain/parse/testdata/operators/fail_postincrement.carbon index 781168de114c..0752a21d4578 100644 --- a/toolchain/parse/testdata/operators/fail_postincrement.carbon +++ b/toolchain/parse/testdata/operators/fail_postincrement.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_postincrement.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_postincrement.carbon fn F() { var n: i32 = 0; diff --git a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon index b3d583679c51..5f0f70bf8972 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_and_or.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_and_or.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_and_or.carbon fn F() { // CHECK:STDERR: fail_precedence_and_or.carbon:[[@LINE+3]]:11: ERROR: Parentheses are required to disambiguate operator precedence. diff --git a/toolchain/parse/testdata/operators/fail_precedence_as.carbon b/toolchain/parse/testdata/operators/fail_precedence_as.carbon index 522aeedf5d16..8dfa19915d04 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_as.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_as.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_as.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_as.carbon fn F(n: i32) { // No ordering between `not` and `as`. diff --git a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon index 1d0ce004fe43..24485d7f876a 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_assign.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_assign.carbon fn F() { var a: i32; diff --git a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon index bd0fd935adba..c23b117e6dda 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_or_and.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_or_and.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_or_and.carbon fn F() { // CHECK:STDERR: fail_precedence_or_and.carbon:[[@LINE+3]]:10: ERROR: Parentheses are required to disambiguate operator precedence. diff --git a/toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon b/toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon index 4621835bb1b8..25d98a75a136 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_star_minus.carbon // CHECK:STDERR: fail_precedence_star_minus.carbon:[[@LINE+3]]:16: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: var n: i8 = n* -n; diff --git a/toolchain/parse/testdata/operators/fail_precedence_star_star.carbon b/toolchain/parse/testdata/operators/fail_precedence_star_star.carbon index 6606afd797e9..41cf646783d5 100644 --- a/toolchain/parse/testdata/operators/fail_precedence_star_star.carbon +++ b/toolchain/parse/testdata/operators/fail_precedence_star_star.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_precedence_star_star.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_precedence_star_star.carbon // CHECK:STDERR: fail_precedence_star_star.carbon:[[@LINE+3]]:16: ERROR: Parentheses are required to disambiguate operator precedence. // CHECK:STDERR: var n: i8 = n* *p; diff --git a/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon b/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon index 0eafc7f83511..aef4e42b3d3c 100644 --- a/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon +++ b/toolchain/parse/testdata/operators/fail_star_star_no_space.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_star_star_no_space.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_star_star_no_space.carbon // TODO: We try to form (n*)*p and reject due to missing parentheses // before we notice the missing whitespace around the second `*`. diff --git a/toolchain/parse/testdata/operators/fail_variety.carbon b/toolchain/parse/testdata/operators/fail_variety.carbon index a31ecd232be1..46ea4d53086f 100644 --- a/toolchain/parse/testdata/operators/fail_variety.carbon +++ b/toolchain/parse/testdata/operators/fail_variety.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fail_variety.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fail_variety.carbon fn F() { // CHECK:STDERR: fail_variety.carbon:[[@LINE+19]]:21: ERROR: Operator `=` can only be used as a complete statement. diff --git a/toolchain/parse/testdata/operators/fixity_in_call.carbon b/toolchain/parse/testdata/operators/fixity_in_call.carbon index c437d2a72f22..a1131c24b025 100644 --- a/toolchain/parse/testdata/operators/fixity_in_call.carbon +++ b/toolchain/parse/testdata/operators/fixity_in_call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fixity_in_call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fixity_in_call.carbon fn F() { G(i32*, n * n); diff --git a/toolchain/parse/testdata/operators/fixity_in_params.carbon b/toolchain/parse/testdata/operators/fixity_in_params.carbon index d7f4f6df2ad7..78bf143b641b 100644 --- a/toolchain/parse/testdata/operators/fixity_in_params.carbon +++ b/toolchain/parse/testdata/operators/fixity_in_params.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fixity_in_params.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fixity_in_params.carbon fn F(p: i32*, n: i32) { } diff --git a/toolchain/parse/testdata/operators/fixity_in_var.carbon b/toolchain/parse/testdata/operators/fixity_in_var.carbon index 14c2e93ae027..e6bd1fa2016b 100644 --- a/toolchain/parse/testdata/operators/fixity_in_var.carbon +++ b/toolchain/parse/testdata/operators/fixity_in_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fixity_in_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fixity_in_var.carbon fn F() { var q: i32* = p; diff --git a/toolchain/parse/testdata/operators/fixity_with_assign.carbon b/toolchain/parse/testdata/operators/fixity_with_assign.carbon index b6167284c526..9fa4856762df 100644 --- a/toolchain/parse/testdata/operators/fixity_with_assign.carbon +++ b/toolchain/parse/testdata/operators/fixity_with_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/fixity_with_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/fixity_with_assign.carbon fn F() { t = t**; diff --git a/toolchain/parse/testdata/operators/infix.carbon b/toolchain/parse/testdata/operators/infix.carbon index 6c9ac44ceb0c..ca7013a0540e 100644 --- a/toolchain/parse/testdata/operators/infix.carbon +++ b/toolchain/parse/testdata/operators/infix.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/infix.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/infix.carbon var n: i8 = n * n; diff --git a/toolchain/parse/testdata/operators/infix_no_space.carbon b/toolchain/parse/testdata/operators/infix_no_space.carbon index d29ed470ae7c..f836996f13f3 100644 --- a/toolchain/parse/testdata/operators/infix_no_space.carbon +++ b/toolchain/parse/testdata/operators/infix_no_space.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/infix_no_space.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/infix_no_space.carbon var n: i8 = n*n; diff --git a/toolchain/parse/testdata/operators/infix_with_paren_after.carbon b/toolchain/parse/testdata/operators/infix_with_paren_after.carbon index 134c15e76429..14f8f37f278c 100644 --- a/toolchain/parse/testdata/operators/infix_with_paren_after.carbon +++ b/toolchain/parse/testdata/operators/infix_with_paren_after.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/infix_with_paren_after.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/infix_with_paren_after.carbon var n: i8 = 3*(n); diff --git a/toolchain/parse/testdata/operators/infix_with_paren_before.carbon b/toolchain/parse/testdata/operators/infix_with_paren_before.carbon index 9822b77169a0..18c5be200f72 100644 --- a/toolchain/parse/testdata/operators/infix_with_paren_before.carbon +++ b/toolchain/parse/testdata/operators/infix_with_paren_before.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/infix_with_paren_before.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/infix_with_paren_before.carbon var n: i8 = (n)*3; diff --git a/toolchain/parse/testdata/operators/postfix.carbon b/toolchain/parse/testdata/operators/postfix.carbon index f8d9ebcc5d68..0a28ef15f38a 100644 --- a/toolchain/parse/testdata/operators/postfix.carbon +++ b/toolchain/parse/testdata/operators/postfix.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/postfix.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/postfix.carbon var v: type = i8*; diff --git a/toolchain/parse/testdata/operators/postfix_repeat.carbon b/toolchain/parse/testdata/operators/postfix_repeat.carbon index 35b8b3363837..13bb0e9bf1be 100644 --- a/toolchain/parse/testdata/operators/postfix_repeat.carbon +++ b/toolchain/parse/testdata/operators/postfix_repeat.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/postfix_repeat.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/postfix_repeat.carbon fn F() { i32****; diff --git a/toolchain/parse/testdata/operators/postfix_space_after_op.carbon b/toolchain/parse/testdata/operators/postfix_space_after_op.carbon index 51f683e26bf1..2a007bd3a413 100644 --- a/toolchain/parse/testdata/operators/postfix_space_after_op.carbon +++ b/toolchain/parse/testdata/operators/postfix_space_after_op.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/postfix_space_after_op.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/postfix_space_after_op.carbon var v: type = i8* ; diff --git a/toolchain/parse/testdata/operators/precedence_as.carbon b/toolchain/parse/testdata/operators/precedence_as.carbon index 795545f4c22f..b151bb529928 100644 --- a/toolchain/parse/testdata/operators/precedence_as.carbon +++ b/toolchain/parse/testdata/operators/precedence_as.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/precedence_as.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/precedence_as.carbon fn F(n: i32) { // Type operators and unary operators are higher precedence than `as`. diff --git a/toolchain/parse/testdata/operators/precedence_assign.carbon b/toolchain/parse/testdata/operators/precedence_assign.carbon index aa1b5fbf2cd1..a457975ab813 100644 --- a/toolchain/parse/testdata/operators/precedence_assign.carbon +++ b/toolchain/parse/testdata/operators/precedence_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/precedence_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/precedence_assign.carbon fn F(c: bool) { var a: i32; diff --git a/toolchain/parse/testdata/operators/precedence_not.carbon b/toolchain/parse/testdata/operators/precedence_not.carbon index f73015ea5774..5abf41ef234f 100644 --- a/toolchain/parse/testdata/operators/precedence_not.carbon +++ b/toolchain/parse/testdata/operators/precedence_not.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/precedence_not.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/precedence_not.carbon fn F() { not a and not b and not c; diff --git a/toolchain/parse/testdata/operators/precedence_unary.carbon b/toolchain/parse/testdata/operators/precedence_unary.carbon index 8c6039404a42..50686f2e8b8e 100644 --- a/toolchain/parse/testdata/operators/precedence_unary.carbon +++ b/toolchain/parse/testdata/operators/precedence_unary.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/precedence_unary.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/precedence_unary.carbon fn F(p: i32*) { // Numeric, bitwise, and bit-shift binary operators are lower precedence than diff --git a/toolchain/parse/testdata/operators/prefix.carbon b/toolchain/parse/testdata/operators/prefix.carbon index 362461a50755..f86a3d8c0a4b 100644 --- a/toolchain/parse/testdata/operators/prefix.carbon +++ b/toolchain/parse/testdata/operators/prefix.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/prefix.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/prefix.carbon var n: i8 = -n; var b: bool = not true; diff --git a/toolchain/parse/testdata/operators/prefix_no_space.carbon b/toolchain/parse/testdata/operators/prefix_no_space.carbon index c235e2f2cacd..eb6dca7ab867 100644 --- a/toolchain/parse/testdata/operators/prefix_no_space.carbon +++ b/toolchain/parse/testdata/operators/prefix_no_space.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/prefix_no_space.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/prefix_no_space.carbon var n: i8 =-n; // Valid diff --git a/toolchain/parse/testdata/operators/prefix_repeat.carbon b/toolchain/parse/testdata/operators/prefix_repeat.carbon index 1d6d25d64953..b000c075e7e6 100644 --- a/toolchain/parse/testdata/operators/prefix_repeat.carbon +++ b/toolchain/parse/testdata/operators/prefix_repeat.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/prefix_repeat.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/prefix_repeat.carbon fn F() { ***&n; diff --git a/toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon b/toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon index 754f193c3d4a..958850989a30 100644 --- a/toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon +++ b/toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_infix_uneven_space_before.carbon // CHECK:STDERR: recover_infix_uneven_space_before.carbon:[[@LINE+3]]:15: ERROR: Whitespace missing after binary operator. // CHECK:STDERR: var n: i8 = n *n; diff --git a/toolchain/parse/testdata/operators/recover_postfix_space.carbon b/toolchain/parse/testdata/operators/recover_postfix_space.carbon index 2b0b16cbcfab..401664f8e97d 100644 --- a/toolchain/parse/testdata/operators/recover_postfix_space.carbon +++ b/toolchain/parse/testdata/operators/recover_postfix_space.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_postfix_space.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_postfix_space.carbon // CHECK:STDERR: recover_postfix_space.carbon:[[@LINE+3]]:18: ERROR: Whitespace is not allowed before this unary operator. // CHECK:STDERR: var v: type = i8 *; diff --git a/toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon b/toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon index 8424297e7915..77a575c0b43f 100644 --- a/toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon +++ b/toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_postfix_space_before_comma.carbon // CHECK:STDERR: recover_postfix_space_before_comma.carbon:[[@LINE+3]]:18: ERROR: Whitespace is not allowed before this unary operator. // CHECK:STDERR: var n: i8 = F(i8 *, 0); diff --git a/toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon b/toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon index dad3743d6f97..4575d606ada9 100644 --- a/toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon +++ b/toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_postfix_space_in_call.carbon // CHECK:STDERR: recover_postfix_space_in_call.carbon:[[@LINE+3]]:18: ERROR: Whitespace is not allowed before this unary operator. // CHECK:STDERR: var n: i8 = F(i8 *); diff --git a/toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon b/toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon index cf5d6bf0744e..2184989833ac 100644 --- a/toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon +++ b/toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_postfix_space_surrounding.carbon // CHECK:STDERR: recover_postfix_space_surrounding.carbon:[[@LINE+3]]:18: ERROR: Whitespace is not allowed before this unary operator. // CHECK:STDERR: var v: type = i8 * ; diff --git a/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon b/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon index 17a7957e92ef..de4fd99f875b 100644 --- a/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon +++ b/toolchain/parse/testdata/operators/recover_prefix_repeat.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_prefix_repeat.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_prefix_repeat.carbon // CHECK:STDERR: recover_prefix_repeat.carbon:[[@LINE+3]]:17: ERROR: Parentheses are required around this unary `const` operator. // CHECK:STDERR: fn F() -> const const i32* { diff --git a/toolchain/parse/testdata/operators/recover_prefix_space.carbon b/toolchain/parse/testdata/operators/recover_prefix_space.carbon index a9589fd6ce56..4e4555438b4b 100644 --- a/toolchain/parse/testdata/operators/recover_prefix_space.carbon +++ b/toolchain/parse/testdata/operators/recover_prefix_space.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_prefix_space.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_prefix_space.carbon // CHECK:STDERR: recover_prefix_space.carbon:[[@LINE+3]]:13: ERROR: Whitespace is not allowed after this unary operator. // CHECK:STDERR: var n: i8 = - n; diff --git a/toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon b/toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon index 758e4b5a5064..5547c1dfcf01 100644 --- a/toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon +++ b/toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/recover_prefix_uneven_space_with_assign.carbon // CHECK:STDERR: recover_prefix_uneven_space_with_assign.carbon:[[@LINE+3]]:12: ERROR: Whitespace is not allowed after this unary operator. // CHECK:STDERR: var n: i8 =- n; diff --git a/toolchain/parse/testdata/operators/spaceship.carbon b/toolchain/parse/testdata/operators/spaceship.carbon index 00720e44657e..f8446db22910 100644 --- a/toolchain/parse/testdata/operators/spaceship.carbon +++ b/toolchain/parse/testdata/operators/spaceship.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/operators/spaceship.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/operators/spaceship.carbon fn F() { a <=> b; diff --git a/toolchain/parse/testdata/package_expr/basic.carbon b/toolchain/parse/testdata/package_expr/basic.carbon index 6827a74af10d..487b5d813ff3 100644 --- a/toolchain/parse/testdata/package_expr/basic.carbon +++ b/toolchain/parse/testdata/package_expr/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/package_expr/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/package_expr/basic.carbon var x: package.Foo = package.Bar; diff --git a/toolchain/parse/testdata/package_expr/fail_in_name.carbon b/toolchain/parse/testdata/package_expr/fail_in_name.carbon index 06640a0e045e..5573067499e6 100644 --- a/toolchain/parse/testdata/package_expr/fail_in_name.carbon +++ b/toolchain/parse/testdata/package_expr/fail_in_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/package_expr/fail_in_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/package_expr/fail_in_name.carbon // CHECK:STDERR: fail_in_name.carbon:[[@LINE+4]]:5: ERROR: Expected binding pattern. // CHECK:STDERR: var package.val: i32; diff --git a/toolchain/parse/testdata/packages/export.carbon b/toolchain/parse/testdata/packages/export.carbon index 63c65bf2c819..3a40da51182a 100644 --- a/toolchain/parse/testdata/packages/export.carbon +++ b/toolchain/parse/testdata/packages/export.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/export.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/export.carbon // --- lib.carbon diff --git a/toolchain/parse/testdata/packages/import/after_import.carbon b/toolchain/parse/testdata/packages/import/after_import.carbon index 904fa1f78d48..2634c852fd8c 100644 --- a/toolchain/parse/testdata/packages/import/after_import.carbon +++ b/toolchain/parse/testdata/packages/import/after_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/after_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/after_import.carbon import A; import B; diff --git a/toolchain/parse/testdata/packages/import/after_package.carbon b/toolchain/parse/testdata/packages/import/after_package.carbon index 47ed67d0b1f7..bc1e58ad2520 100644 --- a/toolchain/parse/testdata/packages/import/after_package.carbon +++ b/toolchain/parse/testdata/packages/import/after_package.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/after_package.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/after_package.carbon package A; diff --git a/toolchain/parse/testdata/packages/import/basic.carbon b/toolchain/parse/testdata/packages/import/basic.carbon index cef933b19548..7395c03b4454 100644 --- a/toolchain/parse/testdata/packages/import/basic.carbon +++ b/toolchain/parse/testdata/packages/import/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/basic.carbon import Geometry; diff --git a/toolchain/parse/testdata/packages/import/current_package_library.carbon b/toolchain/parse/testdata/packages/import/current_package_library.carbon index 2496089cafff..319b80501a9b 100644 --- a/toolchain/parse/testdata/packages/import/current_package_library.carbon +++ b/toolchain/parse/testdata/packages/import/current_package_library.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/current_package_library.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/current_package_library.carbon // --- default.carbon diff --git a/toolchain/parse/testdata/packages/import/export.carbon b/toolchain/parse/testdata/packages/import/export.carbon index f51ac622bfa5..bca0c93d6045 100644 --- a/toolchain/parse/testdata/packages/import/export.carbon +++ b/toolchain/parse/testdata/packages/import/export.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/export.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/export.carbon // --- fail_package.carbon diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon index c612156772de..746b03be0066 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_after_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_after_decl.carbon fn A(); diff --git a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon index 940ae4d1b42d..27e19adac5ab 100644 --- a/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon +++ b/toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_after_decl_repeated.carbon fn A(); diff --git a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon index 4a9ddbe0e925..17867e0f6608 100644 --- a/toolchain/parse/testdata/packages/import/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/import/fail_extra_string.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_extra_string.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_extra_string.carbon // CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:26: ERROR: `import` declarations must end with a `;`. // CHECK:STDERR: import Foo library "bar" "baz"; diff --git a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon index b9b493357a61..417044a989eb 100644 --- a/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_library_is_identifier.carbon // CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:25: ERROR: Expected a string literal to specify the library name. // CHECK:STDERR: import Geometry library Shapes; diff --git a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon index b716ef773c78..06b1bb52e325 100644 --- a/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_name_is_keyword.carbon // CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:8: ERROR: Expected identifier or `library` after `import`. // CHECK:STDERR: import fn; diff --git a/toolchain/parse/testdata/packages/import/fail_no_name.carbon b/toolchain/parse/testdata/packages/import/fail_no_name.carbon index 8c0095b785d8..eca368456de0 100644 --- a/toolchain/parse/testdata/packages/import/fail_no_name.carbon +++ b/toolchain/parse/testdata/packages/import/fail_no_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_no_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_no_name.carbon // CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:7: ERROR: Expected identifier or `library` after `import`. // CHECK:STDERR: import; diff --git a/toolchain/parse/testdata/packages/import/fail_no_semi.carbon b/toolchain/parse/testdata/packages/import/fail_no_semi.carbon index 497529af7a99..582be4217676 100644 --- a/toolchain/parse/testdata/packages/import/fail_no_semi.carbon +++ b/toolchain/parse/testdata/packages/import/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_no_semi.carbon import Geometry diff --git a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon index ff0a3090764e..e8a36376c9fa 100644 --- a/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_omit_library_keyword.carbon // CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:17: ERROR: Missing `library` keyword. // CHECK:STDERR: import Geometry "Shapes"; diff --git a/toolchain/parse/testdata/packages/import/fail_type.carbon b/toolchain/parse/testdata/packages/import/fail_type.carbon index 2e1b6ed62718..a7a08999d450 100644 --- a/toolchain/parse/testdata/packages/import/fail_type.carbon +++ b/toolchain/parse/testdata/packages/import/fail_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/fail_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/fail_type.carbon // CHECK:STDERR: fail_type.carbon:[[@LINE+3]]:17: ERROR: `import` declarations must end with a `;`. // CHECK:STDERR: import Geometry api; diff --git a/toolchain/parse/testdata/packages/import/library.carbon b/toolchain/parse/testdata/packages/import/library.carbon index fe6532bf5d9b..4dabaeec2b74 100644 --- a/toolchain/parse/testdata/packages/import/library.carbon +++ b/toolchain/parse/testdata/packages/import/library.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/library.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/library.carbon import Geometry library "Shapes"; diff --git a/toolchain/parse/testdata/packages/import/ordering.carbon b/toolchain/parse/testdata/packages/import/ordering.carbon index 0ebf8762d8c6..91a68cb06c66 100644 --- a/toolchain/parse/testdata/packages/import/ordering.carbon +++ b/toolchain/parse/testdata/packages/import/ordering.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/ordering.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/ordering.carbon // --- after_import.carbon diff --git a/toolchain/parse/testdata/packages/import/semi_before.carbon b/toolchain/parse/testdata/packages/import/semi_before.carbon index e4de02036342..52b3f24e2d58 100644 --- a/toolchain/parse/testdata/packages/import/semi_before.carbon +++ b/toolchain/parse/testdata/packages/import/semi_before.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/import/semi_before.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/import/semi_before.carbon // We allow an empty declaration in the initial sequence of imports. ; diff --git a/toolchain/parse/testdata/packages/library/basic.carbon b/toolchain/parse/testdata/packages/library/basic.carbon index 62013ad79e02..320aeae471da 100644 --- a/toolchain/parse/testdata/packages/library/basic.carbon +++ b/toolchain/parse/testdata/packages/library/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/library/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/library/basic.carbon // --- default.carbon diff --git a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon index 7b419bccb563..aae4c34afc1f 100644 --- a/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon +++ b/toolchain/parse/testdata/packages/library/fail_invalid_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/library/fail_invalid_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/library/fail_invalid_name.carbon // --- fail_identifier.carbon diff --git a/toolchain/parse/testdata/packages/library/fail_semi_before.carbon b/toolchain/parse/testdata/packages/library/fail_semi_before.carbon index fc5b2ee9dcaa..98b230076441 100644 --- a/toolchain/parse/testdata/packages/library/fail_semi_before.carbon +++ b/toolchain/parse/testdata/packages/library/fail_semi_before.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/library/fail_semi_before.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/library/fail_semi_before.carbon ; diff --git a/toolchain/parse/testdata/packages/library/fail_too_late.carbon b/toolchain/parse/testdata/packages/library/fail_too_late.carbon index f25b0485d7ce..16c913c388ef 100644 --- a/toolchain/parse/testdata/packages/library/fail_too_late.carbon +++ b/toolchain/parse/testdata/packages/library/fail_too_late.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/library/fail_too_late.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/library/fail_too_late.carbon import Geometry; diff --git a/toolchain/parse/testdata/packages/package/api.carbon b/toolchain/parse/testdata/packages/package/api.carbon index 360c66c6bc09..417448174d8c 100644 --- a/toolchain/parse/testdata/packages/package/api.carbon +++ b/toolchain/parse/testdata/packages/package/api.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/api.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/api.carbon package Geometry; diff --git a/toolchain/parse/testdata/packages/package/api_library.carbon b/toolchain/parse/testdata/packages/package/api_library.carbon index ad20ec279329..f0192e21f6f7 100644 --- a/toolchain/parse/testdata/packages/package/api_library.carbon +++ b/toolchain/parse/testdata/packages/package/api_library.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/api_library.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/api_library.carbon package Geometry library "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon index 6169f62a5e88..a9e2091e158f 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_decl.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_decl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_after_decl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_after_decl.carbon fn A(); diff --git a/toolchain/parse/testdata/packages/package/fail_after_import.carbon b/toolchain/parse/testdata/packages/package/fail_after_import.carbon index f70f411a0fe4..edd8d66235ff 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_import.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_import.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_after_import.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_after_import.carbon import A; diff --git a/toolchain/parse/testdata/packages/package/fail_after_package.carbon b/toolchain/parse/testdata/packages/package/fail_after_package.carbon index b77c939a7f8e..d87568478497 100644 --- a/toolchain/parse/testdata/packages/package/fail_after_package.carbon +++ b/toolchain/parse/testdata/packages/package/fail_after_package.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_after_package.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_after_package.carbon package A; // CHECK:STDERR: fail_after_package.carbon:[[@LINE+6]]:1: ERROR: The `package` declaration must be the first non-comment line. diff --git a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon index 6c3322c6871b..0bdbc3501ae6 100644 --- a/toolchain/parse/testdata/packages/package/fail_extra_string.carbon +++ b/toolchain/parse/testdata/packages/package/fail_extra_string.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_extra_string.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_extra_string.carbon // CHECK:STDERR: fail_extra_string.carbon:[[@LINE+3]]:27: ERROR: `package` declarations must end with a `;`. // CHECK:STDERR: package Foo library "bar" "baz"; diff --git a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon index 7c1c818f29f2..400ddf136819 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_is_identifier.carbon // CHECK:STDERR: fail_library_is_identifier.carbon:[[@LINE+3]]:26: ERROR: Expected a string literal to specify the library name. // CHECK:STDERR: package Geometry library Shapes; diff --git a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon index 8f39b7ba80da..56124481eb7f 100644 --- a/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon +++ b/toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_library_skips_name.carbon // CHECK:STDERR: fail_library_skips_name.carbon:[[@LINE+3]]:9: ERROR: Expected identifier after `package`. // CHECK:STDERR: package library "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon index 64929be73c9a..4ccac09654c0 100644 --- a/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_name_is_keyword.carbon // CHECK:STDERR: fail_name_is_keyword.carbon:[[@LINE+3]]:9: ERROR: Expected identifier after `package`. // CHECK:STDERR: package fn; diff --git a/toolchain/parse/testdata/packages/package/fail_no_name.carbon b/toolchain/parse/testdata/packages/package/fail_no_name.carbon index 49ce2cf7fd7a..d81b05bda8fd 100644 --- a/toolchain/parse/testdata/packages/package/fail_no_name.carbon +++ b/toolchain/parse/testdata/packages/package/fail_no_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_no_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_no_name.carbon // CHECK:STDERR: fail_no_name.carbon:[[@LINE+3]]:8: ERROR: Expected identifier after `package`. // CHECK:STDERR: package; diff --git a/toolchain/parse/testdata/packages/package/fail_no_semi.carbon b/toolchain/parse/testdata/packages/package/fail_no_semi.carbon index 5654105d6df5..f1728321edf4 100644 --- a/toolchain/parse/testdata/packages/package/fail_no_semi.carbon +++ b/toolchain/parse/testdata/packages/package/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_no_semi.carbon package Geometry diff --git a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon index 0458512ccf0a..059e5980fa61 100644 --- a/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon +++ b/toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_omit_library_keyword.carbon // CHECK:STDERR: fail_omit_library_keyword.carbon:[[@LINE+3]]:18: ERROR: Missing `library` keyword. // CHECK:STDERR: package Geometry "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/fail_semi_before.carbon b/toolchain/parse/testdata/packages/package/fail_semi_before.carbon index afc14dd08fc5..b31cce5c3124 100644 --- a/toolchain/parse/testdata/packages/package/fail_semi_before.carbon +++ b/toolchain/parse/testdata/packages/package/fail_semi_before.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_semi_before.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_semi_before.carbon ; diff --git a/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon b/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon index e433aee17b2f..3a45194061b8 100644 --- a/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon +++ b/toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/fail_trailing_impl.carbon // CHECK:STDERR: fail_trailing_impl.carbon:[[@LINE+3]]:18: ERROR: `package` declarations must end with a `;`. // CHECK:STDERR: package Geometry impl; diff --git a/toolchain/parse/testdata/packages/package/impl.carbon b/toolchain/parse/testdata/packages/package/impl.carbon index d07f36cdcab9..322b14f5f6ae 100644 --- a/toolchain/parse/testdata/packages/package/impl.carbon +++ b/toolchain/parse/testdata/packages/package/impl.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/impl.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/impl.carbon // --- impl.carbon diff --git a/toolchain/parse/testdata/packages/package/impl_library.carbon b/toolchain/parse/testdata/packages/package/impl_library.carbon index d5bc2d6d0e8d..80ba4049491e 100644 --- a/toolchain/parse/testdata/packages/package/impl_library.carbon +++ b/toolchain/parse/testdata/packages/package/impl_library.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/impl_library.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/impl_library.carbon impl package Geometry library "Shapes"; diff --git a/toolchain/parse/testdata/packages/package/modifiers.carbon b/toolchain/parse/testdata/packages/package/modifiers.carbon index 16f9dc64f34a..80526d063ab0 100644 --- a/toolchain/parse/testdata/packages/package/modifiers.carbon +++ b/toolchain/parse/testdata/packages/package/modifiers.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/packages/package/modifiers.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/packages/package/modifiers.carbon // Diagnosed in check. extend virtual base package Geometry; diff --git a/toolchain/parse/testdata/pointer/const_pointer.carbon b/toolchain/parse/testdata/pointer/const_pointer.carbon index 0c4f924e360d..e301ef562389 100644 --- a/toolchain/parse/testdata/pointer/const_pointer.carbon +++ b/toolchain/parse/testdata/pointer/const_pointer.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/pointer/const_pointer.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/const_pointer.carbon fn A() -> const i32* { return A(); } fn B() -> (const i32)* { return B(); } diff --git a/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon b/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon index 1cc17f9bacda..8d5d09e7c3e2 100644 --- a/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon +++ b/toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/fail_pointer_type_in_expr.carbon fn F() -> i32 { // TODO: Indicate the locations of both operators involved in the precedence diff --git a/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon b/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon index a3e939508792..41461008893a 100644 --- a/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon +++ b/toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/fail_tuple_instead_of_compound_member_access.carbon fn F() { // CHECK:STDERR: fail_tuple_instead_of_compound_member_access.carbon:[[@LINE+4]]:6: ERROR: Expected expression. diff --git a/toolchain/parse/testdata/pointer/pointer_type.carbon b/toolchain/parse/testdata/pointer/pointer_type.carbon index cdecc8d76aa9..695d55205a9f 100644 --- a/toolchain/parse/testdata/pointer/pointer_type.carbon +++ b/toolchain/parse/testdata/pointer/pointer_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/pointer/pointer_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/pointer_type.carbon fn F(p: i32*) -> i32* { return p; diff --git a/toolchain/parse/testdata/pointer/pointer_value.carbon b/toolchain/parse/testdata/pointer/pointer_value.carbon index 3083f08b688d..67881dbe8770 100644 --- a/toolchain/parse/testdata/pointer/pointer_value.carbon +++ b/toolchain/parse/testdata/pointer/pointer_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/pointer/pointer_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/pointer/pointer_value.carbon fn F() -> i32 { var n: i32 = 0; diff --git a/toolchain/parse/testdata/return/basic.carbon b/toolchain/parse/testdata/return/basic.carbon index 18203b2414d0..d8801da29c58 100644 --- a/toolchain/parse/testdata/return/basic.carbon +++ b/toolchain/parse/testdata/return/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/basic.carbon fn F() { return; diff --git a/toolchain/parse/testdata/return/expr.carbon b/toolchain/parse/testdata/return/expr.carbon index 4b01043cd59f..f14981bef159 100644 --- a/toolchain/parse/testdata/return/expr.carbon +++ b/toolchain/parse/testdata/return/expr.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/expr.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/expr.carbon fn F() { return x; diff --git a/toolchain/parse/testdata/return/fail_expr_no_semi.carbon b/toolchain/parse/testdata/return/fail_expr_no_semi.carbon index 365855e687e2..a7c98efb1741 100644 --- a/toolchain/parse/testdata/return/fail_expr_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_expr_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/fail_expr_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_expr_no_semi.carbon fn F() { return x diff --git a/toolchain/parse/testdata/return/fail_no_semi.carbon b/toolchain/parse/testdata/return/fail_no_semi.carbon index cd335a71261b..2b0e20bd77fb 100644 --- a/toolchain/parse/testdata/return/fail_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_no_semi.carbon fn F() { return diff --git a/toolchain/parse/testdata/return/fail_returned_no_var.carbon b/toolchain/parse/testdata/return/fail_returned_no_var.carbon index 22cf2332b9a1..384736c975fd 100644 --- a/toolchain/parse/testdata/return/fail_returned_no_var.carbon +++ b/toolchain/parse/testdata/return/fail_returned_no_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/fail_returned_no_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_returned_no_var.carbon fn F() -> String { // CHECK:STDERR: fail_returned_no_var.carbon:[[@LINE+3]]:12: ERROR: Expected `var` after `returned`. diff --git a/toolchain/parse/testdata/return/fail_var_no_semi.carbon b/toolchain/parse/testdata/return/fail_var_no_semi.carbon index 275cb7782691..08ef701a1d7e 100644 --- a/toolchain/parse/testdata/return/fail_var_no_semi.carbon +++ b/toolchain/parse/testdata/return/fail_var_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/fail_var_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/fail_var_no_semi.carbon fn F() { return var diff --git a/toolchain/parse/testdata/return/returned_var.carbon b/toolchain/parse/testdata/return/returned_var.carbon index fd34f3f5f73e..13fe41894de9 100644 --- a/toolchain/parse/testdata/return/returned_var.carbon +++ b/toolchain/parse/testdata/return/returned_var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/return/returned_var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/return/returned_var.carbon fn F() -> String { returned var s: String = "hello"; diff --git a/toolchain/parse/testdata/struct/fail_comma_only.carbon b/toolchain/parse/testdata/struct/fail_comma_only.carbon index 88f80530b010..0d5a5faba461 100644 --- a/toolchain/parse/testdata/struct/fail_comma_only.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_only.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_comma_only.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_only.carbon // CHECK:STDERR: fail_comma_only.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon b/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon index 21f2c45599f6..c397cf2222b9 100644 --- a/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_type.carbon // CHECK:STDERR: fail_comma_repeat_in_type.carbon:[[@LINE+3]]:17: ERROR: Expected `.field: field_type`. // CHECK:STDERR: var x: {.a: i32,,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon b/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon index 2189947a1841..e24343778662 100644 --- a/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon +++ b/toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_comma_repeat_in_value.carbon // CHECK:STDERR: fail_comma_repeat_in_value.carbon:[[@LINE+3]]:16: ERROR: Expected `.field = value`. // CHECK:STDERR: var x: {.a = 0,,} = {}; diff --git a/toolchain/parse/testdata/struct/fail_dot_only.carbon b/toolchain/parse/testdata/struct/fail_dot_only.carbon index 4d8d23bc9025..2876ae99cd15 100644 --- a/toolchain/parse/testdata/struct/fail_dot_only.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_only.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_only.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_only.carbon // CHECK:STDERR: fail_dot_only.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {.} = {}; diff --git a/toolchain/parse/testdata/struct/fail_dot_paren.carbon b/toolchain/parse/testdata/struct/fail_dot_paren.carbon index 2486ca437552..22b6c4ef9d50 100644 --- a/toolchain/parse/testdata/struct/fail_dot_paren.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_paren.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_paren.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_paren.carbon // CHECK:STDERR: fail_dot_paren.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {.(a) = 1}; diff --git a/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon b/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon index c7e0577b7dc7..ffcaa1e2f2ba 100644 --- a/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_string_colon.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_string_colon.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_string_colon.carbon // CHECK:STDERR: fail_dot_string_colon.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {."hello": i32, .y: i32} = {}; diff --git a/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon b/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon index 87f3fe91149c..beb677cfceaf 100644 --- a/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_dot_string_equals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_dot_string_equals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_dot_string_equals.carbon // CHECK:STDERR: fail_dot_string_equals.carbon:[[@LINE+3]]:10: ERROR: Expected identifier after `.`. // CHECK:STDERR: var x: {."hello" = 0, .y = 4} = {}; diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon index 28bd66801bf6..1534f3fd171d 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_type.carbon // CHECK:STDERR: fail_extra_token_in_type.carbon:[[@LINE+3]]:17: ERROR: Expected `,` or `}`. // CHECK:STDERR: var x: {.a: i32 banana} = {.a = 0}; diff --git a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon index 6a440dfc0451..fad657d3e6b0 100644 --- a/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon +++ b/toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_extra_token_in_value.carbon // CHECK:STDERR: fail_extra_token_in_value.carbon:[[@LINE+3]]:28: ERROR: Expected `,` or `}`. // CHECK:STDERR: var x: {.a: i32} = {.a = 0 banana}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_colon.carbon b/toolchain/parse/testdata/struct/fail_identifier_colon.carbon index 0392047c83dc..22ab8783af80 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_colon.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_colon.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_identifier_colon.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_colon.carbon // CHECK:STDERR: fail_identifier_colon.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {a:} = {}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_equals.carbon b/toolchain/parse/testdata/struct/fail_identifier_equals.carbon index 22af7b1752b8..cf7c8592cd7c 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_equals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_identifier_equals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_equals.carbon // CHECK:STDERR: fail_identifier_equals.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {a=} = {}; diff --git a/toolchain/parse/testdata/struct/fail_identifier_only.carbon b/toolchain/parse/testdata/struct/fail_identifier_only.carbon index 5383784efe62..10a5d8b4692b 100644 --- a/toolchain/parse/testdata/struct/fail_identifier_only.carbon +++ b/toolchain/parse/testdata/struct/fail_identifier_only.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_identifier_only.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_identifier_only.carbon // CHECK:STDERR: fail_identifier_only.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {a} = {}; diff --git a/toolchain/parse/testdata/struct/fail_missing_type.carbon b/toolchain/parse/testdata/struct/fail_missing_type.carbon index 9b08fa499948..068ff69ba78f 100644 --- a/toolchain/parse/testdata/struct/fail_missing_type.carbon +++ b/toolchain/parse/testdata/struct/fail_missing_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_missing_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_missing_type.carbon // CHECK:STDERR: fail_missing_type.carbon:[[@LINE+3]]:12: ERROR: Expected expression. // CHECK:STDERR: var x: {.a:} = {}; diff --git a/toolchain/parse/testdata/struct/fail_missing_value.carbon b/toolchain/parse/testdata/struct/fail_missing_value.carbon index bfc741e54b29..206dc980c197 100644 --- a/toolchain/parse/testdata/struct/fail_missing_value.carbon +++ b/toolchain/parse/testdata/struct/fail_missing_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_missing_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_missing_value.carbon // CHECK:STDERR: fail_missing_value.carbon:[[@LINE+3]]:12: ERROR: Expected expression. // CHECK:STDERR: var x: {.a=} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon b/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon index af5ce0ea0f07..f030a50224bd 100644 --- a/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_type_and_value.carbon // CHECK:STDERR: fail_mix_type_and_value.carbon:[[@LINE+3]]:21: ERROR: Expected `.field: field_type`. // CHECK:STDERR: var x: {.a: i32, .b = 0} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon b/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon index d5513b983c89..a243648fe649 100644 --- a/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_value_and_type.carbon // CHECK:STDERR: fail_mix_value_and_type.carbon:[[@LINE+3]]:17: ERROR: Expected `.field = value`. // CHECK:STDERR: var x: {.a = 0, b: i32} = {}; diff --git a/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon b/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon index dd58bfa22ac0..382e59a2a9d6 100644 --- a/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon +++ b/toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_mix_with_unknown.carbon // CHECK:STDERR: fail_mix_with_unknown.carbon:[[@LINE+8]]:25: ERROR: Expected `.field = value`. // CHECK:STDERR: var x: i32 = {.a = 1, .b, .c: i32}; diff --git a/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon b/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon index afb64a360ffb..642ba026e84f 100644 --- a/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon +++ b/toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_no_colon_or_equals.carbon // CHECK:STDERR: fail_no_colon_or_equals.carbon:[[@LINE+3]]:11: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {.a} = {}; diff --git a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon index fecc3531aeae..a5a322b2f8ec 100644 --- a/toolchain/parse/testdata/struct/fail_type_no_designator.carbon +++ b/toolchain/parse/testdata/struct/fail_type_no_designator.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/fail_type_no_designator.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/fail_type_no_designator.carbon // CHECK:STDERR: fail_type_no_designator.carbon:[[@LINE+3]]:9: ERROR: Expected `.field: field_type` or `.field = value`. // CHECK:STDERR: var x: {i32} = {}; diff --git a/toolchain/parse/testdata/struct/no_entries.carbon b/toolchain/parse/testdata/struct/no_entries.carbon index 4d3ace9fb181..8b41c0aa1f15 100644 --- a/toolchain/parse/testdata/struct/no_entries.carbon +++ b/toolchain/parse/testdata/struct/no_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/no_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/no_entries.carbon var y: {} = {}; diff --git a/toolchain/parse/testdata/struct/one_entry_no_comma.carbon b/toolchain/parse/testdata/struct/one_entry_no_comma.carbon index 4bc3a966bc9e..4f699b4a906e 100644 --- a/toolchain/parse/testdata/struct/one_entry_no_comma.carbon +++ b/toolchain/parse/testdata/struct/one_entry_no_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/one_entry_no_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/one_entry_no_comma.carbon var z: {.n: i32} = {.n = 4}; diff --git a/toolchain/parse/testdata/struct/one_entry_with_comma.carbon b/toolchain/parse/testdata/struct/one_entry_with_comma.carbon index fe6391da90ff..fdc5c65539a7 100644 --- a/toolchain/parse/testdata/struct/one_entry_with_comma.carbon +++ b/toolchain/parse/testdata/struct/one_entry_with_comma.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/one_entry_with_comma.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/one_entry_with_comma.carbon var z: {.n: i32,} = {.n = 4,}; diff --git a/toolchain/parse/testdata/struct/two_entries.carbon b/toolchain/parse/testdata/struct/two_entries.carbon index bc6224a20f27..e1de95f683a7 100644 --- a/toolchain/parse/testdata/struct/two_entries.carbon +++ b/toolchain/parse/testdata/struct/two_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/struct/two_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/struct/two_entries.carbon var x: {.a: i32, .b: i32} = {.a = 1, .b = 2}; diff --git a/toolchain/parse/testdata/tuple/nested.carbon b/toolchain/parse/testdata/tuple/nested.carbon index 0e2ef9ad6db5..40559adb00b3 100644 --- a/toolchain/parse/testdata/tuple/nested.carbon +++ b/toolchain/parse/testdata/tuple/nested.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/tuple/nested.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/tuple/nested.carbon var y: ((), (), ()); diff --git a/toolchain/parse/testdata/tuple/two_entries.carbon b/toolchain/parse/testdata/tuple/two_entries.carbon index d28b2fdbbd56..c07ea3bd6ce4 100644 --- a/toolchain/parse/testdata/tuple/two_entries.carbon +++ b/toolchain/parse/testdata/tuple/two_entries.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/tuple/two_entries.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/tuple/two_entries.carbon var x: (i32, i32) = (1, 2); diff --git a/toolchain/parse/testdata/var/fail_bad_name.carbon b/toolchain/parse/testdata/var/fail_bad_name.carbon index 798f73bbddd6..37197c60c0ac 100644 --- a/toolchain/parse/testdata/var/fail_bad_name.carbon +++ b/toolchain/parse/testdata/var/fail_bad_name.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/var/fail_bad_name.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_bad_name.carbon // CHECK:STDERR: fail_bad_name.carbon:[[@LINE+3]]:5: ERROR: Expected binding pattern. // CHECK:STDERR: var *; diff --git a/toolchain/parse/testdata/var/fail_empty.carbon b/toolchain/parse/testdata/var/fail_empty.carbon index c1a57894632a..bf9f729acb48 100644 --- a/toolchain/parse/testdata/var/fail_empty.carbon +++ b/toolchain/parse/testdata/var/fail_empty.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/var/fail_empty.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_empty.carbon // CHECK:STDERR: fail_empty.carbon:[[@LINE+3]]:4: ERROR: Expected binding pattern. // CHECK:STDERR: var; diff --git a/toolchain/parse/testdata/var/fail_no_semi.carbon b/toolchain/parse/testdata/var/fail_no_semi.carbon index 1976cf6bb31e..1d6211710549 100644 --- a/toolchain/parse/testdata/var/fail_no_semi.carbon +++ b/toolchain/parse/testdata/var/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/var/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/fail_no_semi.carbon var diff --git a/toolchain/parse/testdata/var/var.carbon b/toolchain/parse/testdata/var/var.carbon index 03d0075b67ba..c6056c9a6e58 100644 --- a/toolchain/parse/testdata/var/var.carbon +++ b/toolchain/parse/testdata/var/var.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/var/var.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/var.carbon var v: i32 = 0; var w: i32; diff --git a/toolchain/parse/testdata/var/var_tuple.carbon b/toolchain/parse/testdata/var/var_tuple.carbon index 64c3c815db75..4971617c3fc5 100644 --- a/toolchain/parse/testdata/var/var_tuple.carbon +++ b/toolchain/parse/testdata/var/var_tuple.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/var/var_tuple.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/var/var_tuple.carbon fn F() { var (s: String, i: 32) = ("hello", 0); diff --git a/toolchain/parse/testdata/while/basic.carbon b/toolchain/parse/testdata/while/basic.carbon index 53f6f6da3e91..299d102d5b19 100644 --- a/toolchain/parse/testdata/while/basic.carbon +++ b/toolchain/parse/testdata/while/basic.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/while/basic.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/basic.carbon fn F() { while (a) { diff --git a/toolchain/parse/testdata/while/fail_missing_cond.carbon b/toolchain/parse/testdata/while/fail_missing_cond.carbon index 927a8f920ac2..a4735ea8202c 100644 --- a/toolchain/parse/testdata/while/fail_missing_cond.carbon +++ b/toolchain/parse/testdata/while/fail_missing_cond.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/while/fail_missing_cond.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_missing_cond.carbon fn F() { // CHECK:STDERR: fail_missing_cond.carbon:[[@LINE+3]]:9: ERROR: Expected `(` after `while`. diff --git a/toolchain/parse/testdata/while/fail_no_semi.carbon b/toolchain/parse/testdata/while/fail_no_semi.carbon index c57b8a5402ab..db79b6567a5f 100644 --- a/toolchain/parse/testdata/while/fail_no_semi.carbon +++ b/toolchain/parse/testdata/while/fail_no_semi.carbon @@ -3,6 +3,10 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/while/fail_no_semi.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_no_semi.carbon fn F() { while (a) { diff --git a/toolchain/parse/testdata/while/fail_unbraced.carbon b/toolchain/parse/testdata/while/fail_unbraced.carbon index 712cd4cede81..00c1156c5a33 100644 --- a/toolchain/parse/testdata/while/fail_unbraced.carbon +++ b/toolchain/parse/testdata/while/fail_unbraced.carbon @@ -4,6 +4,10 @@ // // TODO: This should have an error. // AUTOUPDATE +// TIP: To test this file alone, run: +// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/parse/testdata/while/fail_unbraced.carbon +// TIP: To dump output, run: +// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/parse/testdata/while/fail_unbraced.carbon fn F() { while (a)