Procházet zdrojové kódy

Move some of the test information to TIP lines (#4007)

This has is a nice-to-have for me. Frequently I want to run a specific
test, and end up digging through output to be able to copy-paste the run
line. This uses TIP lines to inject the command into the file when using
AUTOUPDATE.

Note, one of the reasons I want this is because "bazel test
//toolchain/testing:file_test --test_output=all" has been regularly
exceeding bazel's output limit for me (workaround is either opening the
output file or specifying an obscure output limit flag), making it a
little harder for me to get the commands. However, frequently I'm adding
a file and want to iterate on it, so that's really the use case I have
in mind here.
Jon Ross-Perkins před 1 rokem
rodič
revize
83413479d7
100 změnil soubory, kde provedl 1372 přidání a 904 odebrání
  1. 8 0
      testing/file_test/README.md
  2. 17 0
      testing/file_test/autoupdate.cpp
  3. 26 2
      testing/file_test/autoupdate.h
  4. 65 30
      testing/file_test/file_test_base.cpp
  5. 4 0
      testing/file_test/testdata/alternating_files.carbon
  6. 4 0
      testing/file_test/testdata/args.carbon
  7. 4 0
      testing/file_test/testdata/fail_example.carbon
  8. 4 0
      testing/file_test/testdata/fail_multi_success_overall_fail.carbon
  9. 4 0
      testing/file_test/testdata/file_only_re_multi_file.carbon
  10. 5 1
      testing/file_test/testdata/file_only_re_one_file.carbon
  11. 4 0
      testing/file_test/testdata/multi_success.carbon
  12. 4 0
      testing/file_test/testdata/multi_success_and_fail.carbon
  13. 5 1
      testing/file_test/testdata/not_split.carbon
  14. 4 0
      testing/file_test/testdata/two_files.carbon
  15. 4 0
      testing/file_test/testdata/unattached_multi_file.carbon
  16. 7 3
      toolchain/check/testdata/alias/fail_bool_value.carbon
  17. 4 0
      toolchain/check/testdata/alias/fail_builtins.carbon
  18. 5 1
      toolchain/check/testdata/alias/fail_control_flow.carbon
  19. 11 7
      toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon
  20. 4 0
      toolchain/check/testdata/alias/no_prelude/export_name.carbon
  21. 8 4
      toolchain/check/testdata/alias/no_prelude/fail_aliased_name_in_diag.carbon
  22. 8 4
      toolchain/check/testdata/alias/no_prelude/fail_local_in_namespace.carbon
  23. 7 3
      toolchain/check/testdata/alias/no_prelude/fail_modifiers.carbon
  24. 20 16
      toolchain/check/testdata/alias/no_prelude/fail_name_conflict.carbon
  25. 17 13
      toolchain/check/testdata/alias/no_prelude/fail_not_constant.carbon
  26. 8 4
      toolchain/check/testdata/alias/no_prelude/fail_params.carbon
  27. 4 0
      toolchain/check/testdata/alias/no_prelude/fail_todo_private.carbon
  28. 4 0
      toolchain/check/testdata/alias/no_prelude/import.carbon
  29. 4 0
      toolchain/check/testdata/alias/no_prelude/import_order.carbon
  30. 31 27
      toolchain/check/testdata/alias/no_prelude/in_namespace.carbon
  31. 14 10
      toolchain/check/testdata/alias/no_prelude/local.carbon
  32. 42 38
      toolchain/check/testdata/array/array_in_place.carbon
  33. 49 45
      toolchain/check/testdata/array/array_vs_tuple.carbon
  34. 27 23
      toolchain/check/testdata/array/assign_return_value.carbon
  35. 51 47
      toolchain/check/testdata/array/assign_var.carbon
  36. 67 63
      toolchain/check/testdata/array/base.carbon
  37. 51 47
      toolchain/check/testdata/array/canonicalize_index.carbon
  38. 18 14
      toolchain/check/testdata/array/fail_bound_negative.carbon
  39. 9 5
      toolchain/check/testdata/array/fail_bound_overflow.carbon
  40. 11 7
      toolchain/check/testdata/array/fail_incomplete_element.carbon
  41. 7 3
      toolchain/check/testdata/array/fail_invalid_type.carbon
  42. 12 8
      toolchain/check/testdata/array/fail_out_of_bound.carbon
  43. 36 32
      toolchain/check/testdata/array/fail_out_of_bound_non_literal.carbon
  44. 53 49
      toolchain/check/testdata/array/fail_type_mismatch.carbon
  45. 4 0
      toolchain/check/testdata/array/fail_undefined_bound.carbon
  46. 49 45
      toolchain/check/testdata/array/function_param.carbon
  47. 36 32
      toolchain/check/testdata/array/index_not_literal.carbon
  48. 48 44
      toolchain/check/testdata/array/nine_elements.carbon
  49. 4 0
      toolchain/check/testdata/as/adapter_conversion.carbon
  50. 13 9
      toolchain/check/testdata/as/as_type.carbon
  51. 10 6
      toolchain/check/testdata/as/basic.carbon
  52. 21 17
      toolchain/check/testdata/as/fail_no_conversion.carbon
  53. 8 4
      toolchain/check/testdata/as/fail_not_type.carbon
  54. 24 20
      toolchain/check/testdata/as/identity.carbon
  55. 44 40
      toolchain/check/testdata/as/no_prelude/tuple.carbon
  56. 4 0
      toolchain/check/testdata/basics/builtin_insts.carbon
  57. 16 12
      toolchain/check/testdata/basics/builtin_types.carbon
  58. 4 0
      toolchain/check/testdata/basics/fail_bad_run.carbon
  59. 8 4
      toolchain/check/testdata/basics/fail_bad_run_2.carbon
  60. 5 1
      toolchain/check/testdata/basics/fail_non_type_as_type.carbon
  61. 21 17
      toolchain/check/testdata/basics/fail_numeric_literal_overflow.carbon
  62. 10 6
      toolchain/check/testdata/basics/fail_qualifier_unsupported.carbon
  63. 4 0
      toolchain/check/testdata/basics/multifile.carbon
  64. 4 0
      toolchain/check/testdata/basics/no_prelude/empty.carbon
  65. 4 0
      toolchain/check/testdata/basics/no_prelude/empty_decl.carbon
  66. 4 0
      toolchain/check/testdata/basics/no_prelude/fail_name_lookup.carbon
  67. 4 0
      toolchain/check/testdata/basics/no_prelude/multifile_raw_and_textual_ir.carbon
  68. 4 0
      toolchain/check/testdata/basics/no_prelude/multifile_raw_ir.carbon
  69. 25 21
      toolchain/check/testdata/basics/no_prelude/raw_and_textual_ir.carbon
  70. 22 18
      toolchain/check/testdata/basics/no_prelude/raw_identifier.carbon
  71. 4 0
      toolchain/check/testdata/basics/no_prelude/raw_ir.carbon
  72. 25 21
      toolchain/check/testdata/basics/no_prelude/textual_ir.carbon
  73. 70 66
      toolchain/check/testdata/basics/numeric_literals.carbon
  74. 14 10
      toolchain/check/testdata/basics/parens.carbon
  75. 4 0
      toolchain/check/testdata/basics/run.carbon
  76. 8 4
      toolchain/check/testdata/basics/run_i32.carbon
  77. 4 0
      toolchain/check/testdata/basics/type_literals.carbon
  78. 4 0
      toolchain/check/testdata/builtins/bool/make_type.carbon
  79. 4 0
      toolchain/check/testdata/builtins/float/add.carbon
  80. 4 0
      toolchain/check/testdata/builtins/float/div.carbon
  81. 4 0
      toolchain/check/testdata/builtins/float/eq.carbon
  82. 4 0
      toolchain/check/testdata/builtins/float/greater.carbon
  83. 4 0
      toolchain/check/testdata/builtins/float/greater_eq.carbon
  84. 4 0
      toolchain/check/testdata/builtins/float/less.carbon
  85. 4 0
      toolchain/check/testdata/builtins/float/less_eq.carbon
  86. 4 0
      toolchain/check/testdata/builtins/float/make_type.carbon
  87. 4 0
      toolchain/check/testdata/builtins/float/mul.carbon
  88. 4 0
      toolchain/check/testdata/builtins/float/negate.carbon
  89. 4 0
      toolchain/check/testdata/builtins/float/neq.carbon
  90. 4 0
      toolchain/check/testdata/builtins/float/sub.carbon
  91. 4 0
      toolchain/check/testdata/builtins/int/and.carbon
  92. 4 0
      toolchain/check/testdata/builtins/int/complement.carbon
  93. 4 0
      toolchain/check/testdata/builtins/int/eq.carbon
  94. 4 0
      toolchain/check/testdata/builtins/int/greater.carbon
  95. 4 0
      toolchain/check/testdata/builtins/int/greater_eq.carbon
  96. 4 0
      toolchain/check/testdata/builtins/int/left_shift.carbon
  97. 4 0
      toolchain/check/testdata/builtins/int/less.carbon
  98. 4 0
      toolchain/check/testdata/builtins/int/less_eq.carbon
  99. 4 0
      toolchain/check/testdata/builtins/int/make_type_32.carbon
  100. 4 0
      toolchain/check/testdata/builtins/int/make_type_signed.carbon

+ 8 - 0
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: <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.

+ 17 - 0
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);

+ 26 - 2
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<llvm::StringRef>& filenames,
       int autoupdate_line_number,
       const llvm::SmallVector<FileTestLine>& non_check_lines,
@@ -44,6 +44,8 @@ class FileTestAutoupdater {
       const llvm::SmallVector<LineNumberReplacement>& line_number_replacements,
       std::function<void(std::string&)> 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<llvm::StringRef>& filenames_;
   int autoupdate_line_number_;
@@ -179,6 +200,9 @@ class FileTestAutoupdater {
   const llvm::SmallVector<LineNumberReplacement>& line_number_replacements_;
   std::function<void(std::string&)> do_extra_check_replacements_;
 
+  // Generated TIP lines, from AddTips.
+  llvm::SmallVector<TipLine> tips_;
+
   // The constructed CheckLine list and cursor.
   CheckLines stdout_;
   CheckLines stderr_;

+ 65 - 30
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::string> {
   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,30 +89,51 @@ static auto CompareFailPrefix(llvm::StringRef filename, bool success) -> void {
   }
 }
 
-// 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<llvm::PrettyStackTraceString> stack_trace_entry;
+// 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);
 
-  // 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());
+  args << "bazel " << ((mode == BazelMode::Test) ? "test" : "run") << " "
+       << (target ? target : "<target>") << " ";
+
+  switch (mode) {
+    case BazelMode::Autoupdate:
+      args << "-- --autoupdate ";
+      break;
+
+    case BazelMode::Dump:
+      args << "-- --dump_output ";
+      break;
 
-    // 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";
+    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 {
+  // 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);
   ASSERT_TRUE(run_result.ok()) << run_result.error();
@@ -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<Success> {
   // 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<Success> {
 
     ++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<std::string> {
   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<std::string> 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;
     }

+ 4 - 0
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

+ 4 - 0
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`

+ 4 - 0
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`

+ 4 - 0
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

+ 4 - 0
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
 

+ 5 - 1
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

+ 4 - 0
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

+ 4 - 0
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

+ 5 - 1
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

+ 4 - 0
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

+ 4 - 0
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
 

+ 7 - 3
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> = 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: <error> = bind_alias a, <error> [template = <error>]
 // 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: <error> = name_ref a, %a [template = <error>]
 // CHECK:STDOUT:   %a_test: bool = bind_name a_test, <error>
 // CHECK:STDOUT: }

+ 4 - 0
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;

+ 5 - 1
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 <unexpected instblockref block4> [template = constants.%.1]
+// CHECK:STDOUT:   %.loc22: bool = block_arg <unexpected instblockref block4> [template = constants.%.1]
 // CHECK:STDOUT:   %a: <error> = bind_alias a, <error> [template = <error>]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 11 - 7
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 {

+ 4 - 0
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

+ 8 - 4
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:

+ 8 - 4
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> = 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 <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
 // CHECK:STDOUT: fn @F() -> {} {
 // CHECK:STDOUT: !entry:
-// CHECK:STDOUT:   %.loc18_17: {} = struct_literal ()
-// CHECK:STDOUT:   %.loc18_12: <error> = bind_alias <invalid>, <error> [template = <error>]
+// CHECK:STDOUT:   %.loc22_17: {} = struct_literal ()
+// CHECK:STDOUT:   %.loc22_12: <error> = bind_alias <invalid>, <error> [template = <error>]
 // CHECK:STDOUT:   %NS.ref: <namespace> = name_ref NS, file.%NS [template = file.%NS]
 // CHECK:STDOUT:   %a.ref: <error> = name_ref a, <error> [template = <error>]
 // CHECK:STDOUT:   return <error>

+ 7 - 3
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:

+ 20 - 16
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> = 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 <invalid>, %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 <invalid>, %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:

+ 17 - 13
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: <error> = bind_alias c, <error> [template = <error>]
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }

+ 8 - 4
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> = 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: <error> = bind_alias A, <error> [template = <error>]
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 4 - 0
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`.

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 31 - 27
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: <namespace> = 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: <namespace> = 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: <namespace> = name_ref NS, %NS [template = %NS]
-// CHECK:STDOUT:     %a.ref.loc14: type = name_ref a, %a [template = constants.%C]
+// CHECK:STDOUT:     %NS.ref.loc18: <namespace> = 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 <return slot>
 // 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: <unbound element of class C> = 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: <unbound element of class C> = 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:

+ 14 - 10
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 <return slot>
 // 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:

+ 42 - 38
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 <return slot>
 // 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:

+ 49 - 45
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:

+ 27 - 23
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 <return slot>
 // 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:

+ 51 - 47
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> = 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:

+ 67 - 63
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> = 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:

+ 51 - 47
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> = 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> = 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 <return slot>
 // 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:

+ 18 - 14
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 <return slot>
 // 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 = <error>]
+// 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 = <error>]
 // CHECK:STDOUT:   %a.var: ref <error> = var a
 // CHECK:STDOUT:   %a: ref <error> = bind_name a, %a.var
 // CHECK:STDOUT: }

+ 9 - 5
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> = 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 <error>, i32 [template = <error>]
+// 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 <error>, i32 [template = <error>]
 // CHECK:STDOUT:   %a.var: ref <error> = var a
 // CHECK:STDOUT:   %a: ref <error> = bind_name a, %a.var
-// CHECK:STDOUT:   %.loc23_9: i32 = int_literal 1 [template = constants.%.2]
-// CHECK:STDOUT:   %.loc23_32: type = array_type <error>, <error> [template = <error>]
+// CHECK:STDOUT:   %.loc27_9: i32 = int_literal 1 [template = constants.%.2]
+// CHECK:STDOUT:   %.loc27_32: type = array_type <error>, <error> [template = <error>]
 // CHECK:STDOUT:   %b.var: ref <error> = var b
 // CHECK:STDOUT:   %b: ref <error> = bind_name b, %b.var
 // CHECK:STDOUT: }

+ 11 - 7
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> = 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 <error> = var a
 // CHECK:STDOUT:   %a: ref <error> = 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 <error> = name_ref a, file.%a
-// CHECK:STDOUT:   %.loc17_25: i32 = int_literal 0 [template = constants.%.4]
-// CHECK:STDOUT:   %.loc17_22: <error> = addr_of <error> [template = <error>]
+// CHECK:STDOUT:   %.loc21_25: i32 = int_literal 0 [template = constants.%.4]
+// CHECK:STDOUT:   %.loc21_22: <error> = addr_of <error> [template = <error>]
 // CHECK:STDOUT:   assign file.%p.var, <error>
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }

+ 7 - 3
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> = 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, <error> [template = <error>]
+// 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, <error> [template = <error>]
 // CHECK:STDOUT:   %a.var: ref <error> = var a
 // CHECK:STDOUT:   %a: ref <error> = bind_name a, %a.var
 // CHECK:STDOUT: }

+ 12 - 8
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> = 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, <error>
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }

+ 36 - 32
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> = 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 = <error>]
-// 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 = <error>]
+// 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:

+ 53 - 49
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> = 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, <error>
 // 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, <error>
-// 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, <error>
 // CHECK:STDOUT:   %t2.ref: ref (i32, i32) = name_ref t2, file.%t2
 // CHECK:STDOUT:   assign file.%d.var, <error>

+ 4 - 0
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; ];

+ 49 - 45
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 <return slot>
 // 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 <return slot>
 // 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:

+ 36 - 32
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> = 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:

+ 48 - 44
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> = 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:

+ 4 - 0
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
 

+ 13 - 9
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> = 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";

+ 10 - 6
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 <return slot>
 // 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:

+ 21 - 17
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> = 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, <error>
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 8 - 4
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> = 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, <error>
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 24 - 20
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> = 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 <return slot>
 // 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: }

+ 44 - 40
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:

+ 4 - 0
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

+ 16 - 12
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> = 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

+ 4 - 0
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 {}

+ 8 - 4
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:

+ 5 - 1
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, <error>
 // CHECK:STDOUT:   return
 // CHECK:STDOUT: }

+ 21 - 17
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> = 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, <error>
 // 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, <error>
 // 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, <error>
-// 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, <error>
-// 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, <error>
 // CHECK:STDOUT: }
 // CHECK:STDOUT:

+ 10 - 6
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> = 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: }

+ 4 - 0
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;

+ 4 - 0
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:

+ 4 - 0
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
 
 ;
 

+ 4 - 0
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.

+ 4 - 0
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;

+ 4 - 0
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;

+ 25 - 21
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 <return slot>
 // 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:

+ 22 - 18
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 <return slot>
 // 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 <return slot>
 // 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 <return slot>
 // CHECK:STDOUT:   }
 // CHECK:STDOUT: }

+ 4 - 0
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, ());

+ 25 - 21
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 <return slot>
 // 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:

+ 70 - 66
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:

+ 14 - 10
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> = 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:

+ 4 - 0
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() {}
 

+ 8 - 4
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 <return slot>
 // 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:

+ 4 - 0
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";

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

+ 4 - 0
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
 

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů