From 5c6e94f0ae9344a53fb0efd5c365e2afcaafe3fb Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Thu, 29 May 2025 13:57:04 -0700 Subject: [PATCH] Add range flag settings to struct files (#5573) Where `--no-dump-sem-ir` is used, change to `--dump-sem-ir-ranges=only`. Otherwise, add `--dump-sem-ir-ranges=if-present` with a TODO to change to `only`. Note, SemIR is affected just because the extra comments change line numbers in files where splits aren't in use. --- .../struct/fail_access_into_invalid.carbon | 3 + .../testdata/struct/fail_assign_empty.carbon | 7 +- .../struct/fail_assign_to_empty.carbon | 11 +- .../struct/fail_duplicate_name.carbon | 65 +++---- .../struct/fail_field_name_mismatch.carbon | 17 +- .../struct/fail_field_type_mismatch.carbon | 7 +- .../testdata/struct/fail_keyword_name.carbon | 3 + .../struct/fail_member_access_type.carbon | 19 +- .../struct/fail_member_of_function.carbon | 3 + .../struct/fail_non_member_access.carbon | 31 ++-- .../struct/fail_too_few_values.carbon | 15 +- .../testdata/struct/fail_type_assign.carbon | 7 +- .../testdata/struct/fail_value_as_type.carbon | 7 +- toolchain/check/testdata/struct/import.carbon | 3 + .../struct/literal_member_access.carbon | 49 +++--- .../testdata/struct/member_access.carbon | 59 ++++--- .../struct/nested_struct_in_place.carbon | 73 ++++---- .../testdata/struct/no_prelude/empty.carbon | 29 ++-- .../no_prelude/fail_assign_nested.carbon | 13 +- .../no_prelude/fail_nested_incomplete.carbon | 13 +- .../check/testdata/struct/one_entry.carbon | 45 ++--- .../testdata/struct/partially_const.carbon | 69 ++++---- .../testdata/struct/reorder_fields.carbon | 95 +++++----- .../testdata/struct/tuple_as_element.carbon | 109 ++++++------ .../check/testdata/struct/two_entries.carbon | 163 +++++++++--------- 25 files changed, 495 insertions(+), 420 deletions(-) diff --git a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon index c0b12d76fabe..928c6bc19bd1 100644 --- a/toolchain/check/testdata/struct/fail_access_into_invalid.carbon +++ b/toolchain/check/testdata/struct/fail_access_into_invalid.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_access_into_invalid.carbon diff --git a/toolchain/check/testdata/struct/fail_assign_empty.carbon b/toolchain/check/testdata/struct/fail_assign_empty.carbon index 163ec22f1661..b49beca7ab85 100644 --- a/toolchain/check/testdata/struct/fail_assign_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_assign_empty.carbon @@ -46,7 +49,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] @@ -56,7 +59,7 @@ var x: {.a: i32} = {}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc18: %empty_struct_type = struct_literal () // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon index bfe4c440fdd3..0b7586ce3857 100644 --- a/toolchain/check/testdata/struct/fail_assign_to_empty.carbon +++ b/toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_assign_to_empty.carbon @@ -41,9 +44,9 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_struct_type = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15_9.1: type = splice_block %.loc15_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc15_9.2: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc15_9.3: type = converted %.loc15_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc18_9.1: type = splice_block %.loc18_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc18_9.2: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc18_9.3: type = converted %.loc18_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %x.var [concrete = %x.var] // CHECK:STDOUT: } @@ -51,7 +54,7 @@ var x: {} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15: %struct_type.a = struct_literal (%int_1) +// CHECK:STDOUT: %.loc18: %struct_type.a = struct_literal (%int_1) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_duplicate_name.carbon b/toolchain/check/testdata/struct/fail_duplicate_name.carbon index 7fe570aa1270..a76c38b66bbe 100644 --- a/toolchain/check/testdata/struct/fail_duplicate_name.carbon +++ b/toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_duplicate_name.carbon @@ -97,16 +100,16 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %return.patt: = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc18_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc18_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc18_36: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_36: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc18_47: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_47: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc18_56: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc18_56: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc21_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc21_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc21_27: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc21_27: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc21_36: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc21_36: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc21_47: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc21_47: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc21_56: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc21_56: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %return.param: ref = out_param call_param0 // CHECK:STDOUT: %return: ref = return_slot %return.param // CHECK:STDOUT: } @@ -114,18 +117,18 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %v.patt: = binding_pattern v [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %.1: = splice_block [concrete = ] { -// CHECK:STDOUT: %int_32.loc27_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc27_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc27_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc27_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc30_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc30_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc30_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc30_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %v: = bind_name v, [concrete = ] // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %w.patt: %pattern_type.7ce = binding_pattern w [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc36: type = splice_block %i32.loc36 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc36: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc36: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc39: type = splice_block %i32.loc39 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc39: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc39: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %w: %i32 = bind_name w, [concrete = ] // CHECK:STDOUT: name_binding_decl { @@ -133,9 +136,9 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.ba9 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc45: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.ba9] { -// CHECK:STDOUT: %int_32.loc45: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc45: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc48: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.ba9] { +// CHECK:STDOUT: %int_32.loc48: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc48: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.ba9 = bind_name x, %x.var [concrete = %x.var] @@ -144,11 +147,11 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: %y.var_patt: %pattern_type.366 = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.c = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc54: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { -// CHECK:STDOUT: %int_32.loc54_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc54_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc54_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc57: type = splice_block %struct_type.b.c [concrete = constants.%struct_type.b.c] { +// CHECK:STDOUT: %int_32.loc57_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc57_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc57_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc57_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b.c: type = struct_type {.b: %i32, .c: %i32} [concrete = constants.%struct_type.b.c] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.c = bind_name y, %y.var [concrete = %y.var] @@ -158,13 +161,13 @@ var y: {.b: i32, .c: i32} = {.b = 3, .b = 4}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc27: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc27: %struct_type.a.a6c = struct_literal (%int_1.loc27) -// CHECK:STDOUT: %int_1.loc36: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc36: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc30: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %.loc30: %struct_type.a.a6c = struct_literal (%int_1.loc30) +// CHECK:STDOUT: %int_1.loc39: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc39: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: %def.ref: = name_ref def, [concrete = ] -// CHECK:STDOUT: %int_1.loc45: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %int_2.loc45: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] +// CHECK:STDOUT: %int_1.loc48: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] +// CHECK:STDOUT: %int_2.loc48: Core.IntLiteral = int_value 2 [concrete = constants.%int_2] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4] diff --git a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon index 5ef05e322749..299aa89a359c 100644 --- a/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_field_name_mismatch.carbon @@ -56,9 +59,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { -// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a = bind_name x, %x.var [concrete = %x.var] @@ -67,9 +70,9 @@ var y: {.b: i32} = x; // CHECK:STDOUT: %y.var_patt: %pattern_type.f4b = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.b.0a3 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc21: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.0a3] { -// CHECK:STDOUT: %int_32.loc21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc24: type = splice_block %struct_type.b [concrete = constants.%struct_type.b.0a3] { +// CHECK:STDOUT: %int_32.loc24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b: type = struct_type {.b: %i32} [concrete = constants.%struct_type.b.0a3] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.b.0a3 = bind_name y, %y.var [concrete = %y.var] @@ -78,7 +81,7 @@ var y: {.b: i32} = x; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15: %struct_type.b.a15 = struct_literal (%int_1) +// CHECK:STDOUT: %.loc18: %struct_type.b.a15 = struct_literal (%int_1) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: %x.ref: ref %struct_type.a = name_ref x, file.%x [concrete = file.%x.var] // CHECK:STDOUT: assign file.%y.var, diff --git a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon index bfe0e4e313ed..7d0783b7249b 100644 --- a/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon +++ b/toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_field_type_mismatch.carbon @@ -47,7 +50,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] @@ -58,7 +61,7 @@ var x: {.a: i32} = {.b = 1.0}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: f64 = float_literal 1 [concrete = constants.%float] -// CHECK:STDOUT: %.loc15: %struct_type.b = struct_literal (%float) +// CHECK:STDOUT: %.loc18: %struct_type.b = struct_literal (%float) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_keyword_name.carbon b/toolchain/check/testdata/struct/fail_keyword_name.carbon index 8ab7835ebd88..9b73f6f9de80 100644 --- a/toolchain/check/testdata/struct/fail_keyword_name.carbon +++ b/toolchain/check/testdata/struct/fail_keyword_name.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_keyword_name.carbon diff --git a/toolchain/check/testdata/struct/fail_member_access_type.carbon b/toolchain/check/testdata/struct/fail_member_access_type.carbon index 9be8caa5e13b..289af6667e19 100644 --- a/toolchain/check/testdata/struct/fail_member_access_type.carbon +++ b/toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_member_access_type.carbon @@ -55,11 +58,11 @@ var y: i32 = x.b; // CHECK:STDOUT: %x.var_patt: %pattern_type.d08 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11_16: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc14_16: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %float.make_type [concrete = f64] -// CHECK:STDOUT: %.loc11_13.2: type = converted %float.make_type, %.loc11_13.1 [concrete = f64] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %float.make_type [concrete = f64] +// CHECK:STDOUT: %.loc14_13.2: type = converted %float.make_type, %.loc14_13.1 [concrete = f64] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: f64} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a = bind_name x, %x.var [concrete = %x.var] @@ -68,7 +71,7 @@ var y: i32 = x.b; // CHECK:STDOUT: %y.var_patt: %pattern_type.7ce = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc16: type = splice_block %i32 [concrete = constants.%i32] { +// CHECK:STDOUT: %.loc19: type = splice_block %i32 [concrete = constants.%i32] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } @@ -78,10 +81,10 @@ var y: i32 = x.b; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: f64 = float_literal 4 [concrete = constants.%float] -// CHECK:STDOUT: %.loc11_29.1: %struct_type.a = struct_literal (%float) -// CHECK:STDOUT: %.loc11_29.2: init %struct_type.a = struct_init (%float) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_1: init %struct_type.a = converted %.loc11_29.1, %.loc11_29.2 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %.loc14_29.1: %struct_type.a = struct_literal (%float) +// CHECK:STDOUT: %.loc14_29.2: init %struct_type.a = struct_init (%float) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_1: init %struct_type.a = converted %.loc14_29.1, %.loc14_29.2 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a = name_ref x, file.%x [concrete = file.%x.var] // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_member_of_function.carbon b/toolchain/check/testdata/struct/fail_member_of_function.carbon index c44929421bac..fea505da702d 100644 --- a/toolchain/check/testdata/struct/fail_member_of_function.carbon +++ b/toolchain/check/testdata/struct/fail_member_of_function.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_member_of_function.carbon diff --git a/toolchain/check/testdata/struct/fail_non_member_access.carbon b/toolchain/check/testdata/struct/fail_non_member_access.carbon index 6e02b1a6330f..c1ef802ffb8a 100644 --- a/toolchain/check/testdata/struct/fail_non_member_access.carbon +++ b/toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_non_member_access.carbon @@ -71,9 +74,9 @@ var y: i32 = x.b; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.ba9 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.ba9] { -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.ba9] { +// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.ba9 = bind_name x, %x.var [concrete = %x.var] @@ -82,9 +85,9 @@ var y: i32 = x.b; // CHECK:STDOUT: %y.var_patt: %pattern_type.7ce = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc16: type = splice_block %i32.loc16 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc19: type = splice_block %i32.loc19 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: } @@ -92,16 +95,16 @@ var y: i32 = x.b; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc11_27.1: %struct_type.a.a6c = struct_literal (%int_4) +// CHECK:STDOUT: %.loc14_27.1: %struct_type.a.a6c = struct_literal (%int_4) // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_27.1: = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %bound_method.loc14_27.1: = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_27.2: = bound_method %int_4, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_27.2(%int_4) [concrete = constants.%int_4.940] -// CHECK:STDOUT: %.loc11_27.2: init %i32 = converted %int_4, %int.convert_checked [concrete = constants.%int_4.940] -// CHECK:STDOUT: %.loc11_27.3: init %struct_type.a.ba9 = struct_init (%.loc11_27.2) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_1: init %struct_type.a.ba9 = converted %.loc11_27.1, %.loc11_27.3 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %bound_method.loc14_27.2: = bound_method %int_4, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc14_27.2(%int_4) [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc14_27.2: init %i32 = converted %int_4, %int.convert_checked [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc14_27.3: init %struct_type.a.ba9 = struct_init (%.loc14_27.2) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_1: init %struct_type.a.ba9 = converted %.loc14_27.1, %.loc14_27.3 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a.ba9 = name_ref x, file.%x [concrete = file.%x.var] // CHECK:STDOUT: assign file.%y.var, // CHECK:STDOUT: return diff --git a/toolchain/check/testdata/struct/fail_too_few_values.carbon b/toolchain/check/testdata/struct/fail_too_few_values.carbon index e775258aea9f..0f219510ae7a 100644 --- a/toolchain/check/testdata/struct/fail_too_few_values.carbon +++ b/toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_too_few_values.carbon @@ -47,11 +50,11 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: %x.var_patt: %pattern_type.851 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.b = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %int_32.loc15_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc15_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc15_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc15_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %int_32.loc18_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.b = bind_name x, %x.var [concrete = %x.var] @@ -60,7 +63,7 @@ var x: {.a: i32, .b: i32} = {.a = 1}; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc15: %struct_type.a = struct_literal (%int_1) +// CHECK:STDOUT: %.loc18: %struct_type.a = struct_literal (%int_1) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_type_assign.carbon b/toolchain/check/testdata/struct/fail_type_assign.carbon index 186885ec1f93..359d022b3752 100644 --- a/toolchain/check/testdata/struct/fail_type_assign.carbon +++ b/toolchain/check/testdata/struct/fail_type_assign.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_type_assign.carbon @@ -52,7 +55,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %.loc21: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] @@ -65,7 +68,7 @@ var x: {.a: i32} = {.a: i32}; // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a] -// CHECK:STDOUT: %.loc18: %struct_type.a = converted %struct_type.a, [concrete = ] +// CHECK:STDOUT: %.loc21: %struct_type.a = converted %struct_type.a, [concrete = ] // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/fail_value_as_type.carbon b/toolchain/check/testdata/struct/fail_value_as_type.carbon index 724fd5102932..6db0268adf1e 100644 --- a/toolchain/check/testdata/struct/fail_value_as_type.carbon +++ b/toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/fail_value_as_type.carbon @@ -48,8 +51,8 @@ var x: {.a = 1}; // CHECK:STDOUT: %x.var: ref = var %x.var_patt [concrete = ] // CHECK:STDOUT: %.1: = splice_block [concrete = ] { // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] -// CHECK:STDOUT: %.loc18_15.1: %struct_type.a = struct_literal (%int_1) -// CHECK:STDOUT: %.loc18_15.2: type = converted %.loc18_15.1, [concrete = ] +// CHECK:STDOUT: %.loc21_15.1: %struct_type.a = struct_literal (%int_1) +// CHECK:STDOUT: %.loc21_15.2: type = converted %.loc21_15.1, [concrete = ] // CHECK:STDOUT: } // CHECK:STDOUT: %x: = bind_name x, [concrete = ] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/import.carbon b/toolchain/check/testdata/struct/import.carbon index 0e12f03bf27a..f8ac09295c56 100644 --- a/toolchain/check/testdata/struct/import.carbon +++ b/toolchain/check/testdata/struct/import.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/import.carbon diff --git a/toolchain/check/testdata/struct/literal_member_access.carbon b/toolchain/check/testdata/struct/literal_member_access.carbon index cc82b909318a..deedfd30d4bf 100644 --- a/toolchain/check/testdata/struct/literal_member_access.carbon +++ b/toolchain/check/testdata/struct/literal_member_access.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/literal_member_access.carbon @@ -53,12 +56,12 @@ fn F() -> i32 { // CHECK:STDOUT: %return.patt: %pattern_type.c6b = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.c6b = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc11_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.x.y.z: type = struct_type {.x: %i32, .y: %i32, .z: %i32} [concrete = constants.%struct_type.x.y.z] // CHECK:STDOUT: %return.param: ref %struct_type.x.y.z = out_param call_param0 // CHECK:STDOUT: %return: ref %struct_type.x.y.z = return_slot %return.param @@ -80,23 +83,23 @@ fn F() -> i32 { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1] // CHECK:STDOUT: %G.ref: %G.type = name_ref G, file.%G.decl [concrete = constants.%G] -// CHECK:STDOUT: %.loc14_26.1: ref %struct_type.x.y.z = temporary_storage -// CHECK:STDOUT: %G.call: init %struct_type.x.y.z = call %G.ref() to %.loc14_26.1 +// CHECK:STDOUT: %.loc17_26.1: ref %struct_type.x.y.z = temporary_storage +// CHECK:STDOUT: %G.call: init %struct_type.x.y.z = call %G.ref() to %.loc17_26.1 // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3] -// CHECK:STDOUT: %.loc14_35.1: %struct_type.a.b.c.4ca = struct_literal (%int_1, %G.call, %int_3) -// CHECK:STDOUT: %.loc14_26.2: ref %struct_type.x.y.z = temporary %.loc14_26.1, %G.call -// CHECK:STDOUT: %.loc14_26.3: ref %i32 = struct_access %.loc14_26.2, element0 -// CHECK:STDOUT: %.loc14_26.4: %i32 = bind_value %.loc14_26.3 -// CHECK:STDOUT: %.loc14_26.5: ref %i32 = struct_access %.loc14_26.2, element1 -// CHECK:STDOUT: %.loc14_26.6: %i32 = bind_value %.loc14_26.5 -// CHECK:STDOUT: %.loc14_26.7: ref %i32 = struct_access %.loc14_26.2, element2 -// CHECK:STDOUT: %.loc14_26.8: %i32 = bind_value %.loc14_26.7 -// CHECK:STDOUT: %struct.loc14_26: %struct_type.x.y.z = struct_value (%.loc14_26.4, %.loc14_26.6, %.loc14_26.8) -// CHECK:STDOUT: %.loc14_35.2: %struct_type.x.y.z = converted %G.call, %struct.loc14_26 -// CHECK:STDOUT: %struct.loc14_35: %struct_type.a.b.c.4ca = struct_value (%int_1, %.loc14_35.2, %int_3) -// CHECK:STDOUT: %.loc14_35.3: %struct_type.a.b.c.4ca = converted %.loc14_35.1, %struct.loc14_35 -// CHECK:STDOUT: %.loc14_36: %struct_type.x.y.z = struct_access %.loc14_35.3, element1 -// CHECK:STDOUT: %.loc14_38: %i32 = struct_access %.loc14_36, element1 -// CHECK:STDOUT: return %.loc14_38 +// CHECK:STDOUT: %.loc17_35.1: %struct_type.a.b.c.4ca = struct_literal (%int_1, %G.call, %int_3) +// CHECK:STDOUT: %.loc17_26.2: ref %struct_type.x.y.z = temporary %.loc17_26.1, %G.call +// CHECK:STDOUT: %.loc17_26.3: ref %i32 = struct_access %.loc17_26.2, element0 +// CHECK:STDOUT: %.loc17_26.4: %i32 = bind_value %.loc17_26.3 +// CHECK:STDOUT: %.loc17_26.5: ref %i32 = struct_access %.loc17_26.2, element1 +// CHECK:STDOUT: %.loc17_26.6: %i32 = bind_value %.loc17_26.5 +// CHECK:STDOUT: %.loc17_26.7: ref %i32 = struct_access %.loc17_26.2, element2 +// CHECK:STDOUT: %.loc17_26.8: %i32 = bind_value %.loc17_26.7 +// CHECK:STDOUT: %struct.loc17_26: %struct_type.x.y.z = struct_value (%.loc17_26.4, %.loc17_26.6, %.loc17_26.8) +// CHECK:STDOUT: %.loc17_35.2: %struct_type.x.y.z = converted %G.call, %struct.loc17_26 +// CHECK:STDOUT: %struct.loc17_35: %struct_type.a.b.c.4ca = struct_value (%int_1, %.loc17_35.2, %int_3) +// CHECK:STDOUT: %.loc17_35.3: %struct_type.a.b.c.4ca = converted %.loc17_35.1, %struct.loc17_35 +// CHECK:STDOUT: %.loc17_36: %struct_type.x.y.z = struct_access %.loc17_35.3, element1 +// CHECK:STDOUT: %.loc17_38: %i32 = struct_access %.loc17_36, element1 +// CHECK:STDOUT: return %.loc17_38 // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/member_access.carbon b/toolchain/check/testdata/struct/member_access.carbon index 9894389fb273..fe5f44e68f28 100644 --- a/toolchain/check/testdata/struct/member_access.carbon +++ b/toolchain/check/testdata/struct/member_access.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/member_access.carbon @@ -77,13 +80,13 @@ var z: i32 = y; // CHECK:STDOUT: %x.var_patt: %pattern_type.7fd = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.b.ddf = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11_25: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.ddf] { +// CHECK:STDOUT: %.loc14_25: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.ddf] { // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64] -// CHECK:STDOUT: %.loc11_13.1: type = value_of_initializer %float.make_type [concrete = f64] -// CHECK:STDOUT: %.loc11_13.2: type = converted %float.make_type, %.loc11_13.1 [concrete = f64] -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %float.make_type [concrete = f64] +// CHECK:STDOUT: %.loc14_13.2: type = converted %float.make_type, %.loc14_13.1 [concrete = f64] +// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: f64, .b: %i32} [concrete = constants.%struct_type.a.b.ddf] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.b.ddf = bind_name x, %x.var [concrete = %x.var] @@ -92,9 +95,9 @@ var z: i32 = y; // CHECK:STDOUT: %y.var_patt: %pattern_type.7ce = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %i32 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc12: type = splice_block %i32.loc12 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc15: type = splice_block %i32.loc15 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %i32 = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: name_binding_decl { @@ -102,9 +105,9 @@ var z: i32 = y; // CHECK:STDOUT: %z.var_patt: %pattern_type.7ce = var_pattern %z.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %z.var: ref %i32 = var %z.var_patt [concrete] -// CHECK:STDOUT: %.loc13: type = splice_block %i32.loc13 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc16: type = splice_block %i32.loc16 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %z: ref %i32 = bind_name z, %z.var [concrete = %z.var] // CHECK:STDOUT: } @@ -113,27 +116,27 @@ var z: i32 = y; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %float: f64 = float_literal 0 [concrete = constants.%float] // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %.loc11_46.1: %struct_type.a.b.fbb = struct_literal (%float, %int_1) -// CHECK:STDOUT: %.loc11_46.2: ref f64 = struct_access file.%x.var, element0 [concrete = constants.%.984] -// CHECK:STDOUT: %.loc11_46.3: init f64 = initialize_from %float to %.loc11_46.2 [concrete = constants.%float] +// CHECK:STDOUT: %.loc14_46.1: %struct_type.a.b.fbb = struct_literal (%float, %int_1) +// CHECK:STDOUT: %.loc14_46.2: ref f64 = struct_access file.%x.var, element0 [concrete = constants.%.984] +// CHECK:STDOUT: %.loc14_46.3: init f64 = initialize_from %float to %.loc14_46.2 [concrete = constants.%float] // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_46.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %bound_method.loc14_46.1: = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_46.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_46.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_46.4: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_46.5: ref %i32 = struct_access file.%x.var, element1 [concrete = constants.%.865] -// CHECK:STDOUT: %.loc11_46.6: init %i32 = initialize_from %.loc11_46.4 to %.loc11_46.5 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_46.7: init %struct_type.a.b.ddf = struct_init (%.loc11_46.3, %.loc11_46.6) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_1: init %struct_type.a.b.ddf = converted %.loc11_46.1, %.loc11_46.7 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %bound_method.loc14_46.2: = bound_method %int_1, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc14_46.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_46.4: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_46.5: ref %i32 = struct_access file.%x.var, element1 [concrete = constants.%.865] +// CHECK:STDOUT: %.loc14_46.6: init %i32 = initialize_from %.loc14_46.4 to %.loc14_46.5 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_46.7: init %struct_type.a.b.ddf = struct_init (%.loc14_46.3, %.loc14_46.6) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_1: init %struct_type.a.b.ddf = converted %.loc14_46.1, %.loc14_46.7 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a.b.ddf = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc12_15.1: ref %i32 = struct_access %x.ref, element1 [concrete = constants.%.865] -// CHECK:STDOUT: %.loc12_15.2: %i32 = bind_value %.loc12_15.1 -// CHECK:STDOUT: assign file.%y.var, %.loc12_15.2 +// CHECK:STDOUT: %.loc15_15.1: ref %i32 = struct_access %x.ref, element1 [concrete = constants.%.865] +// CHECK:STDOUT: %.loc15_15.2: %i32 = bind_value %.loc15_15.1 +// CHECK:STDOUT: assign file.%y.var, %.loc15_15.2 // CHECK:STDOUT: %y.ref: ref %i32 = name_ref y, file.%y [concrete = file.%y.var] -// CHECK:STDOUT: %.loc13: %i32 = bind_value %y.ref -// CHECK:STDOUT: assign file.%z.var, %.loc13 +// CHECK:STDOUT: %.loc16: %i32 = bind_value %y.ref +// CHECK:STDOUT: assign file.%z.var, %.loc16 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/nested_struct_in_place.carbon b/toolchain/check/testdata/struct/nested_struct_in_place.carbon index 41ad0031ffae..27d890b5f29a 100644 --- a/toolchain/check/testdata/struct/nested_struct_in_place.carbon +++ b/toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/nested_struct_in_place.carbon @@ -52,14 +55,14 @@ fn G() { // CHECK:STDOUT: %return.patt: %pattern_type.b5a = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.b5a = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc11_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc11_25.1: %tuple.type.ff9 = tuple_literal (%i32.loc11_12, %i32.loc11_17, %i32.loc11_22) -// CHECK:STDOUT: %.loc11_25.2: type = converted %.loc11_25.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] +// CHECK:STDOUT: %int_32.loc14_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14_25.1: %tuple.type.ff9 = tuple_literal (%i32.loc14_12, %i32.loc14_17, %i32.loc14_22) +// CHECK:STDOUT: %.loc14_25.2: type = converted %.loc14_25.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] // CHECK:STDOUT: %return.param: ref %tuple.type.189 = out_param call_param0 // CHECK:STDOUT: %return: ref %tuple.type.189 = return_slot %return.param // CHECK:STDOUT: } @@ -75,33 +78,33 @@ fn G() { // CHECK:STDOUT: %v.var_patt: %pattern_type.3c2 = var_pattern %v.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %v.var: ref %struct_type.a.b.2f9 = var %v.var_patt -// CHECK:STDOUT: %F.ref.loc14_61: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc14_74.1: ref %tuple.type.189 = struct_access %v.var, element0 -// CHECK:STDOUT: %F.call.loc14_63: init %tuple.type.189 = call %F.ref.loc14_61() to %.loc14_74.1 -// CHECK:STDOUT: %F.ref.loc14_71: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] -// CHECK:STDOUT: %.loc14_74.2: ref %tuple.type.189 = struct_access %v.var, element1 -// CHECK:STDOUT: %F.call.loc14_73: init %tuple.type.189 = call %F.ref.loc14_71() to %.loc14_74.2 -// CHECK:STDOUT: %.loc14_74.3: %struct_type.a.b.2f9 = struct_literal (%F.call.loc14_63, %F.call.loc14_73) -// CHECK:STDOUT: %.loc14_74.4: init %struct_type.a.b.2f9 = struct_init (%F.call.loc14_63, %F.call.loc14_73) to %v.var -// CHECK:STDOUT: %.loc14_3: init %struct_type.a.b.2f9 = converted %.loc14_74.3, %.loc14_74.4 -// CHECK:STDOUT: assign %v.var, %.loc14_3 -// CHECK:STDOUT: %.loc14_51: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.2f9] { -// CHECK:STDOUT: %int_32.loc14_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc14_21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc14_26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc14_29.1: %tuple.type.ff9 = tuple_literal (%i32.loc14_16, %i32.loc14_21, %i32.loc14_26) -// CHECK:STDOUT: %.loc14_29.2: type = converted %.loc14_29.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] -// CHECK:STDOUT: %int_32.loc14_37: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_37: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc14_42: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_42: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc14_47: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14_47: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc14_50.1: %tuple.type.ff9 = tuple_literal (%i32.loc14_37, %i32.loc14_42, %i32.loc14_47) -// CHECK:STDOUT: %.loc14_50.2: type = converted %.loc14_50.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] +// CHECK:STDOUT: %F.ref.loc17_61: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc17_74.1: ref %tuple.type.189 = struct_access %v.var, element0 +// CHECK:STDOUT: %F.call.loc17_63: init %tuple.type.189 = call %F.ref.loc17_61() to %.loc17_74.1 +// CHECK:STDOUT: %F.ref.loc17_71: %F.type = name_ref F, file.%F.decl [concrete = constants.%F] +// CHECK:STDOUT: %.loc17_74.2: ref %tuple.type.189 = struct_access %v.var, element1 +// CHECK:STDOUT: %F.call.loc17_73: init %tuple.type.189 = call %F.ref.loc17_71() to %.loc17_74.2 +// CHECK:STDOUT: %.loc17_74.3: %struct_type.a.b.2f9 = struct_literal (%F.call.loc17_63, %F.call.loc17_73) +// CHECK:STDOUT: %.loc17_74.4: init %struct_type.a.b.2f9 = struct_init (%F.call.loc17_63, %F.call.loc17_73) to %v.var +// CHECK:STDOUT: %.loc17_3: init %struct_type.a.b.2f9 = converted %.loc17_74.3, %.loc17_74.4 +// CHECK:STDOUT: assign %v.var, %.loc17_3 +// CHECK:STDOUT: %.loc17_51: type = splice_block %struct_type.a.b [concrete = constants.%struct_type.a.b.2f9] { +// CHECK:STDOUT: %int_32.loc17_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc17_21: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_21: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc17_26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17_29.1: %tuple.type.ff9 = tuple_literal (%i32.loc17_16, %i32.loc17_21, %i32.loc17_26) +// CHECK:STDOUT: %.loc17_29.2: type = converted %.loc17_29.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] +// CHECK:STDOUT: %int_32.loc17_37: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_37: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc17_42: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_42: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc17_47: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_47: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc17_50.1: %tuple.type.ff9 = tuple_literal (%i32.loc17_37, %i32.loc17_42, %i32.loc17_47) +// CHECK:STDOUT: %.loc17_50.2: type = converted %.loc17_50.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189] // CHECK:STDOUT: %struct_type.a.b: type = struct_type {.a: %tuple.type.189, .b: %tuple.type.189} [concrete = constants.%struct_type.a.b.2f9] // CHECK:STDOUT: } // CHECK:STDOUT: %v: ref %struct_type.a.b.2f9 = bind_name v, %v.var diff --git a/toolchain/check/testdata/struct/no_prelude/empty.carbon b/toolchain/check/testdata/struct/no_prelude/empty.carbon index c7cba30aae38..07076f385982 100644 --- a/toolchain/check/testdata/struct/no_prelude/empty.carbon +++ b/toolchain/check/testdata/struct/no_prelude/empty.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/empty.carbon @@ -29,9 +32,9 @@ var y: {} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %empty_struct_type = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc11_9.2: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_9.3: type = converted %.loc11_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc14_9.1: type = splice_block %.loc14_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc14_9.2: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc14_9.3: type = converted %.loc14_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -39,23 +42,23 @@ var y: {} = x; // CHECK:STDOUT: %y.var_patt: %pattern_type = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %empty_struct_type = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_struct_type] { -// CHECK:STDOUT: %.loc12_9.2: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc15_9.1: type = splice_block %.loc15_9.3 [concrete = constants.%empty_struct_type] { +// CHECK:STDOUT: %.loc15_9.2: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc15_9.3: type = converted %.loc15_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc11_14.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc11_14.2: init %empty_struct_type = struct_init () to file.%x.var [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc11_1: init %empty_struct_type = converted %.loc11_14.1, %.loc11_14.2 [concrete = constants.%empty_struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %.loc14_14.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc14_14.2: init %empty_struct_type = struct_init () to file.%x.var [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc14_1: init %empty_struct_type = converted %.loc14_14.1, %.loc14_14.2 [concrete = constants.%empty_struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %empty_struct_type = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc12_13: init %empty_struct_type = struct_init () to file.%y.var [concrete = constants.%empty_struct] -// CHECK:STDOUT: %.loc12_1: init %empty_struct_type = converted %x.ref, %.loc12_13 [concrete = constants.%empty_struct] -// CHECK:STDOUT: assign file.%y.var, %.loc12_1 +// CHECK:STDOUT: %.loc15_13: init %empty_struct_type = struct_init () to file.%y.var [concrete = constants.%empty_struct] +// CHECK:STDOUT: %.loc15_1: init %empty_struct_type = converted %x.ref, %.loc15_13 [concrete = constants.%empty_struct] +// CHECK:STDOUT: assign file.%y.var, %.loc15_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon b/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon index 1c71e027fad2..8393941656bb 100644 --- a/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon +++ b/toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/fail_assign_nested.carbon @@ -32,9 +35,9 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: %x.var_patt: %pattern_type = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.225 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc15_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { -// CHECK:STDOUT: %.loc15_14.1: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc15_14.2: type = converted %.loc15_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] +// CHECK:STDOUT: %.loc18_15: type = splice_block %struct_type.a [concrete = constants.%struct_type.a.225] { +// CHECK:STDOUT: %.loc18_14.1: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc18_14.2: type = converted %.loc18_14.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %empty_struct_type} [concrete = constants.%struct_type.a.225] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.225 = bind_name x, %x.var [concrete = %x.var] @@ -42,8 +45,8 @@ var x: {.a: {}} = {.b = {}}; // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %.loc15_26: %empty_struct_type = struct_literal () -// CHECK:STDOUT: %.loc15_27: %struct_type.b = struct_literal (%.loc15_26) +// CHECK:STDOUT: %.loc18_26: %empty_struct_type = struct_literal () +// CHECK:STDOUT: %.loc18_27: %struct_type.b = struct_literal (%.loc18_26) // CHECK:STDOUT: assign file.%x.var, // CHECK:STDOUT: return // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon b/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon index 5e7a37b57c63..6650572fa2dc 100644 --- a/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon +++ b/toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/fail_nested_incomplete.carbon @@ -42,8 +45,8 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: %s.var_patt: = var_pattern %s.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %s.var: ref = var %s.var_patt [concrete = ] -// CHECK:STDOUT: %.loc20: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { -// CHECK:STDOUT: %Incomplete.ref.loc20: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %.loc23: type = splice_block %struct_type.a [concrete = constants.%struct_type.a] { +// CHECK:STDOUT: %Incomplete.ref.loc23: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] // CHECK:STDOUT: %struct_type.a: type = struct_type {.a: %Incomplete} [concrete = constants.%struct_type.a] // CHECK:STDOUT: } // CHECK:STDOUT: %s: = bind_name s, [concrete = ] @@ -52,9 +55,9 @@ var p: Incomplete* = &s.a; // CHECK:STDOUT: %p.var_patt: %pattern_type = var_pattern %p.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %p.var: ref %ptr = var %p.var_patt [concrete] -// CHECK:STDOUT: %.loc22: type = splice_block %ptr [concrete = constants.%ptr] { -// CHECK:STDOUT: %Incomplete.ref.loc22: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] -// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc22 [concrete = constants.%ptr] +// CHECK:STDOUT: %.loc25: type = splice_block %ptr [concrete = constants.%ptr] { +// CHECK:STDOUT: %Incomplete.ref.loc25: type = name_ref Incomplete, %Incomplete.decl [concrete = constants.%Incomplete] +// CHECK:STDOUT: %ptr: type = ptr_type %Incomplete.ref.loc25 [concrete = constants.%ptr] // CHECK:STDOUT: } // CHECK:STDOUT: %p: ref %ptr = bind_name p, %p.var [concrete = %p.var] // CHECK:STDOUT: } diff --git a/toolchain/check/testdata/struct/one_entry.carbon b/toolchain/check/testdata/struct/one_entry.carbon index 1b741eccf198..e3e3504c446e 100644 --- a/toolchain/check/testdata/struct/one_entry.carbon +++ b/toolchain/check/testdata/struct/one_entry.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/one_entry.carbon @@ -67,10 +70,10 @@ var y: {.a: i32} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type.268 = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.ba9 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11: type = splice_block %struct_type.a.loc11 [concrete = constants.%struct_type.a.ba9] { -// CHECK:STDOUT: %int_32.loc11: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.loc11: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] +// CHECK:STDOUT: %.loc14: type = splice_block %struct_type.a.loc14 [concrete = constants.%struct_type.a.ba9] { +// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.loc14: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.ba9 = bind_name x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -78,10 +81,10 @@ var y: {.a: i32} = x; // CHECK:STDOUT: %y.var_patt: %pattern_type.268 = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.a.ba9 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc12: type = splice_block %struct_type.a.loc12 [concrete = constants.%struct_type.a.ba9] { -// CHECK:STDOUT: %int_32.loc12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.loc12: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] +// CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a.loc15 [concrete = constants.%struct_type.a.ba9] { +// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.loc15: type = struct_type {.a: %i32} [concrete = constants.%struct_type.a.ba9] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.a.ba9 = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: } @@ -89,22 +92,22 @@ var y: {.a: i32} = x; // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1] -// CHECK:STDOUT: %.loc11_27.1: %struct_type.a.a6c = struct_literal (%int_4) +// CHECK:STDOUT: %.loc14_27.1: %struct_type.a.a6c = struct_literal (%int_4) // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_27.1: = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %bound_method.loc14_27.1: = bound_method %int_4, %impl.elem0 [concrete = constants.%Convert.bound] // CHECK:STDOUT: %specific_fn: = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_27.2: = bound_method %int_4, %specific_fn [concrete = constants.%bound_method] -// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_27.2(%int_4) [concrete = constants.%int_4.940] -// CHECK:STDOUT: %.loc11_27.2: init %i32 = converted %int_4, %int.convert_checked [concrete = constants.%int_4.940] -// CHECK:STDOUT: %.loc11_27.3: init %struct_type.a.ba9 = struct_init (%.loc11_27.2) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_1: init %struct_type.a.ba9 = converted %.loc11_27.1, %.loc11_27.3 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %bound_method.loc14_27.2: = bound_method %int_4, %specific_fn [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc14_27.2(%int_4) [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc14_27.2: init %i32 = converted %int_4, %int.convert_checked [concrete = constants.%int_4.940] +// CHECK:STDOUT: %.loc14_27.3: init %struct_type.a.ba9 = struct_init (%.loc14_27.2) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_1: init %struct_type.a.ba9 = converted %.loc14_27.1, %.loc14_27.3 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a.ba9 = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc12_20.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.499] -// CHECK:STDOUT: %.loc12_20.2: %i32 = bind_value %.loc12_20.1 -// CHECK:STDOUT: %.loc12_20.3: init %struct_type.a.ba9 = struct_init (%.loc12_20.2) to file.%y.var -// CHECK:STDOUT: %.loc12_1: init %struct_type.a.ba9 = converted %x.ref, %.loc12_20.3 -// CHECK:STDOUT: assign file.%y.var, %.loc12_1 +// CHECK:STDOUT: %.loc15_20.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.499] +// CHECK:STDOUT: %.loc15_20.2: %i32 = bind_value %.loc15_20.1 +// CHECK:STDOUT: %.loc15_20.3: init %struct_type.a.ba9 = struct_init (%.loc15_20.2) to file.%y.var +// CHECK:STDOUT: %.loc15_1: init %struct_type.a.ba9 = converted %x.ref, %.loc15_20.3 +// CHECK:STDOUT: assign file.%y.var, %.loc15_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/partially_const.carbon b/toolchain/check/testdata/struct/partially_const.carbon index 3624423f6743..020ddac491b6 100644 --- a/toolchain/check/testdata/struct/partially_const.carbon +++ b/toolchain/check/testdata/struct/partially_const.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/partially_const.carbon @@ -69,17 +72,17 @@ fn Make(n: i32) -> {.a: i32, .b: i32, .c: i32} { // CHECK:STDOUT: %return.patt: %pattern_type.8ae = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.8ae = out_param_pattern %return.patt, call_param1 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc11_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_43: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_43: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_43: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_43: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b.c: type = struct_type {.a: %i32, .b: %i32, .c: %i32} [concrete = constants.%struct_type.a.b.c.0b6] // CHECK:STDOUT: %n.param: %i32 = value_param call_param0 -// CHECK:STDOUT: %.loc11: type = splice_block %i32.loc11_12 [concrete = constants.%i32] { -// CHECK:STDOUT: %int_32.loc11_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14: type = splice_block %i32.loc14_12 [concrete = constants.%i32] { +// CHECK:STDOUT: %int_32.loc14_12: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_12: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: } // CHECK:STDOUT: %n: %i32 = bind_name n, %n.param // CHECK:STDOUT: %return.param: ref %struct_type.a.b.c.0b6 = out_param call_param1 @@ -89,30 +92,30 @@ fn Make(n: i32) -> {.a: i32, .b: i32, .c: i32} { // CHECK:STDOUT: // CHECK:STDOUT: fn @Make(%n.param: %i32) -> %return.param: %struct_type.a.b.c.0b6 { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_0.loc12_16: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %int_0.loc15_16: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] // CHECK:STDOUT: %n.ref: %i32 = name_ref n, %n -// CHECK:STDOUT: %int_0.loc12_32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] -// CHECK:STDOUT: %.loc12_33.1: %struct_type.a.b.c.1ee = struct_literal (%int_0.loc12_16, %n.ref, %int_0.loc12_32) -// CHECK:STDOUT: %impl.elem0.loc12_33.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc12_33.1: = bound_method %int_0.loc12_16, %impl.elem0.loc12_33.1 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn.loc12_33.1: = specific_function %impl.elem0.loc12_33.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_33.2: = bound_method %int_0.loc12_16, %specific_fn.loc12_33.1 [concrete = constants.%bound_method] -// CHECK:STDOUT: %int.convert_checked.loc12_33.1: init %i32 = call %bound_method.loc12_33.2(%int_0.loc12_16) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.2: init %i32 = converted %int_0.loc12_16, %int.convert_checked.loc12_33.1 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.3: ref %i32 = struct_access %return, element0 -// CHECK:STDOUT: %.loc12_33.4: init %i32 = initialize_from %.loc12_33.2 to %.loc12_33.3 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.5: ref %i32 = struct_access %return, element1 -// CHECK:STDOUT: %.loc12_33.6: init %i32 = initialize_from %n.ref to %.loc12_33.5 -// CHECK:STDOUT: %impl.elem0.loc12_33.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc12_33.3: = bound_method %int_0.loc12_32, %impl.elem0.loc12_33.2 [concrete = constants.%Convert.bound] -// CHECK:STDOUT: %specific_fn.loc12_33.2: = specific_function %impl.elem0.loc12_33.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc12_33.4: = bound_method %int_0.loc12_32, %specific_fn.loc12_33.2 [concrete = constants.%bound_method] -// CHECK:STDOUT: %int.convert_checked.loc12_33.2: init %i32 = call %bound_method.loc12_33.4(%int_0.loc12_32) [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.7: init %i32 = converted %int_0.loc12_32, %int.convert_checked.loc12_33.2 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.8: ref %i32 = struct_access %return, element2 -// CHECK:STDOUT: %.loc12_33.9: init %i32 = initialize_from %.loc12_33.7 to %.loc12_33.8 [concrete = constants.%int_0.6a9] -// CHECK:STDOUT: %.loc12_33.10: init %struct_type.a.b.c.0b6 = struct_init (%.loc12_33.4, %.loc12_33.6, %.loc12_33.9) to %return -// CHECK:STDOUT: %.loc12_34: init %struct_type.a.b.c.0b6 = converted %.loc12_33.1, %.loc12_33.10 -// CHECK:STDOUT: return %.loc12_34 to %return +// CHECK:STDOUT: %int_0.loc15_32: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6] +// CHECK:STDOUT: %.loc15_33.1: %struct_type.a.b.c.1ee = struct_literal (%int_0.loc15_16, %n.ref, %int_0.loc15_32) +// CHECK:STDOUT: %impl.elem0.loc15_33.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc15_33.1: = bound_method %int_0.loc15_16, %impl.elem0.loc15_33.1 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc15_33.1: = specific_function %impl.elem0.loc15_33.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_33.2: = bound_method %int_0.loc15_16, %specific_fn.loc15_33.1 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked.loc15_33.1: init %i32 = call %bound_method.loc15_33.2(%int_0.loc15_16) [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.2: init %i32 = converted %int_0.loc15_16, %int.convert_checked.loc15_33.1 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.3: ref %i32 = struct_access %return, element0 +// CHECK:STDOUT: %.loc15_33.4: init %i32 = initialize_from %.loc15_33.2 to %.loc15_33.3 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.5: ref %i32 = struct_access %return, element1 +// CHECK:STDOUT: %.loc15_33.6: init %i32 = initialize_from %n.ref to %.loc15_33.5 +// CHECK:STDOUT: %impl.elem0.loc15_33.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc15_33.3: = bound_method %int_0.loc15_32, %impl.elem0.loc15_33.2 [concrete = constants.%Convert.bound] +// CHECK:STDOUT: %specific_fn.loc15_33.2: = specific_function %impl.elem0.loc15_33.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc15_33.4: = bound_method %int_0.loc15_32, %specific_fn.loc15_33.2 [concrete = constants.%bound_method] +// CHECK:STDOUT: %int.convert_checked.loc15_33.2: init %i32 = call %bound_method.loc15_33.4(%int_0.loc15_32) [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.7: init %i32 = converted %int_0.loc15_32, %int.convert_checked.loc15_33.2 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.8: ref %i32 = struct_access %return, element2 +// CHECK:STDOUT: %.loc15_33.9: init %i32 = initialize_from %.loc15_33.7 to %.loc15_33.8 [concrete = constants.%int_0.6a9] +// CHECK:STDOUT: %.loc15_33.10: init %struct_type.a.b.c.0b6 = struct_init (%.loc15_33.4, %.loc15_33.6, %.loc15_33.9) to %return +// CHECK:STDOUT: %.loc15_34: init %struct_type.a.b.c.0b6 = converted %.loc15_33.1, %.loc15_33.10 +// CHECK:STDOUT: return %.loc15_34 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/reorder_fields.carbon b/toolchain/check/testdata/struct/reorder_fields.carbon index feb2ddc0f295..0f88ea03f7a1 100644 --- a/toolchain/check/testdata/struct/reorder_fields.carbon +++ b/toolchain/check/testdata/struct/reorder_fields.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/reorder_fields.carbon @@ -75,8 +78,8 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: } { // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] // CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%int_64) [concrete = f64] -// CHECK:STDOUT: %.loc12_17.1: type = value_of_initializer %float.make_type [concrete = f64] -// CHECK:STDOUT: %.loc12_17.2: type = converted %float.make_type, %.loc12_17.1 [concrete = f64] +// CHECK:STDOUT: %.loc15_17.1: type = value_of_initializer %float.make_type [concrete = f64] +// CHECK:STDOUT: %.loc15_17.2: type = converted %float.make_type, %.loc15_17.1 [concrete = f64] // CHECK:STDOUT: %return.param: ref f64 = out_param call_param0 // CHECK:STDOUT: %return: ref f64 = return_slot %return.param // CHECK:STDOUT: } @@ -84,13 +87,13 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %return.patt: %pattern_type.59f = return_slot_pattern [concrete] // CHECK:STDOUT: %return.param_patt: %pattern_type.59f = out_param_pattern %return.patt, call_param0 [concrete] // CHECK:STDOUT: } { -// CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_64.loc14: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc14: init type = call constants.%Float(%int_64.loc14) [concrete = f64] -// CHECK:STDOUT: %.loc14_25.1: type = value_of_initializer %float.make_type.loc14 [concrete = f64] -// CHECK:STDOUT: %.loc14_25.2: type = converted %float.make_type.loc14, %.loc14_25.1 [concrete = f64] -// CHECK:STDOUT: %struct_type.a.b.loc14: type = struct_type {.a: %i32, .b: f64} [concrete = constants.%struct_type.a.b] +// CHECK:STDOUT: %int_32.loc17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_64.loc17: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc17: init type = call constants.%Float(%int_64.loc17) [concrete = f64] +// CHECK:STDOUT: %.loc17_25.1: type = value_of_initializer %float.make_type.loc17 [concrete = f64] +// CHECK:STDOUT: %.loc17_25.2: type = converted %float.make_type.loc17, %.loc17_25.1 [concrete = f64] +// CHECK:STDOUT: %struct_type.a.b.loc17: type = struct_type {.a: %i32, .b: f64} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: %return.param: ref %struct_type.a.b = out_param call_param0 // CHECK:STDOUT: %return: ref %struct_type.a.b = return_slot %return.param // CHECK:STDOUT: } @@ -109,50 +112,50 @@ fn F() -> {.a: i32, .b: f64} { // CHECK:STDOUT: %MakeF64.call: init f64 = call %MakeF64.ref() // CHECK:STDOUT: %MakeI32.ref: %MakeI32.type = name_ref MakeI32, file.%MakeI32.decl [concrete = constants.%MakeI32] // CHECK:STDOUT: %MakeI32.call: init %i32 = call %MakeI32.ref() -// CHECK:STDOUT: %.loc15_62.1: %struct_type.b.a = struct_literal (%MakeF64.call, %MakeI32.call) -// CHECK:STDOUT: %.loc15_27: type = splice_block %struct_type.a.b.loc15 [concrete = constants.%struct_type.a.b] { -// CHECK:STDOUT: %int_32.loc15: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc15: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_64.loc15: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc15: init type = call constants.%Float(%int_64.loc15) [concrete = f64] -// CHECK:STDOUT: %.loc15_24.1: type = value_of_initializer %float.make_type.loc15 [concrete = f64] -// CHECK:STDOUT: %.loc15_24.2: type = converted %float.make_type.loc15, %.loc15_24.1 [concrete = f64] -// CHECK:STDOUT: %struct_type.a.b.loc15: type = struct_type {.a: %i32, .b: f64} [concrete = constants.%struct_type.a.b] +// CHECK:STDOUT: %.loc18_62.1: %struct_type.b.a = struct_literal (%MakeF64.call, %MakeI32.call) +// CHECK:STDOUT: %.loc18_27: type = splice_block %struct_type.a.b.loc18 [concrete = constants.%struct_type.a.b] { +// CHECK:STDOUT: %int_32.loc18: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_64.loc18: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc18: init type = call constants.%Float(%int_64.loc18) [concrete = f64] +// CHECK:STDOUT: %.loc18_24.1: type = value_of_initializer %float.make_type.loc18 [concrete = f64] +// CHECK:STDOUT: %.loc18_24.2: type = converted %float.make_type.loc18, %.loc18_24.1 [concrete = f64] +// CHECK:STDOUT: %struct_type.a.b.loc18: type = struct_type {.a: %i32, .b: f64} [concrete = constants.%struct_type.a.b] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc15_62.2: %i32 = value_of_initializer %MakeI32.call -// CHECK:STDOUT: %.loc15_62.3: %i32 = converted %MakeI32.call, %.loc15_62.2 -// CHECK:STDOUT: %.loc15_62.4: f64 = value_of_initializer %MakeF64.call -// CHECK:STDOUT: %.loc15_62.5: f64 = converted %MakeF64.call, %.loc15_62.4 -// CHECK:STDOUT: %struct.loc15: %struct_type.a.b = struct_value (%.loc15_62.3, %.loc15_62.5) -// CHECK:STDOUT: %.loc15_62.6: %struct_type.a.b = converted %.loc15_62.1, %struct.loc15 -// CHECK:STDOUT: %x: %struct_type.a.b = bind_name x, %.loc15_62.6 +// CHECK:STDOUT: %.loc18_62.2: %i32 = value_of_initializer %MakeI32.call +// CHECK:STDOUT: %.loc18_62.3: %i32 = converted %MakeI32.call, %.loc18_62.2 +// CHECK:STDOUT: %.loc18_62.4: f64 = value_of_initializer %MakeF64.call +// CHECK:STDOUT: %.loc18_62.5: f64 = converted %MakeF64.call, %.loc18_62.4 +// CHECK:STDOUT: %struct.loc18: %struct_type.a.b = struct_value (%.loc18_62.3, %.loc18_62.5) +// CHECK:STDOUT: %.loc18_62.6: %struct_type.a.b = converted %.loc18_62.1, %struct.loc18 +// CHECK:STDOUT: %x: %struct_type.a.b = bind_name x, %.loc18_62.6 // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %y.patt: %pattern_type.a24 = binding_pattern y [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.ref: %struct_type.a.b = name_ref x, %x -// CHECK:STDOUT: %.loc16_27: type = splice_block %struct_type.b.a [concrete = constants.%struct_type.b.a] { -// CHECK:STDOUT: %int_64.loc16: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] -// CHECK:STDOUT: %float.make_type.loc16: init type = call constants.%Float(%int_64.loc16) [concrete = f64] -// CHECK:STDOUT: %.loc16_15.1: type = value_of_initializer %float.make_type.loc16 [concrete = f64] -// CHECK:STDOUT: %.loc16_15.2: type = converted %float.make_type.loc16, %.loc16_15.1 [concrete = f64] -// CHECK:STDOUT: %int_32.loc16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc19_27: type = splice_block %struct_type.b.a [concrete = constants.%struct_type.b.a] { +// CHECK:STDOUT: %int_64.loc19: Core.IntLiteral = int_value 64 [concrete = constants.%int_64] +// CHECK:STDOUT: %float.make_type.loc19: init type = call constants.%Float(%int_64.loc19) [concrete = f64] +// CHECK:STDOUT: %.loc19_15.1: type = value_of_initializer %float.make_type.loc19 [concrete = f64] +// CHECK:STDOUT: %.loc19_15.2: type = converted %float.make_type.loc19, %.loc19_15.1 [concrete = f64] +// CHECK:STDOUT: %int_32.loc19: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc19: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.b.a: type = struct_type {.b: f64, .a: %i32} [concrete = constants.%struct_type.b.a] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc16_31.1: f64 = struct_access %x.ref, element1 -// CHECK:STDOUT: %.loc16_31.2: %i32 = struct_access %x.ref, element0 -// CHECK:STDOUT: %struct.loc16: %struct_type.b.a = struct_value (%.loc16_31.1, %.loc16_31.2) -// CHECK:STDOUT: %.loc16_31.3: %struct_type.b.a = converted %x.ref, %struct.loc16 -// CHECK:STDOUT: %y: %struct_type.b.a = bind_name y, %.loc16_31.3 +// CHECK:STDOUT: %.loc19_31.1: f64 = struct_access %x.ref, element1 +// CHECK:STDOUT: %.loc19_31.2: %i32 = struct_access %x.ref, element0 +// CHECK:STDOUT: %struct.loc19: %struct_type.b.a = struct_value (%.loc19_31.1, %.loc19_31.2) +// CHECK:STDOUT: %.loc19_31.3: %struct_type.b.a = converted %x.ref, %struct.loc19 +// CHECK:STDOUT: %y: %struct_type.b.a = bind_name y, %.loc19_31.3 // CHECK:STDOUT: %y.ref: %struct_type.b.a = name_ref y, %y -// CHECK:STDOUT: %.loc17_10.1: %i32 = struct_access %y.ref, element1 -// CHECK:STDOUT: %.loc17_10.2: ref %i32 = struct_access %return, element1 -// CHECK:STDOUT: %.loc17_10.3: init %i32 = initialize_from %.loc17_10.1 to %.loc17_10.2 -// CHECK:STDOUT: %.loc17_10.4: f64 = struct_access %y.ref, element0 -// CHECK:STDOUT: %.loc17_10.5: ref f64 = struct_access %return, element0 -// CHECK:STDOUT: %.loc17_10.6: init f64 = initialize_from %.loc17_10.4 to %.loc17_10.5 -// CHECK:STDOUT: %.loc17_10.7: init %struct_type.a.b = struct_init (%.loc17_10.3, %.loc17_10.6) to %return -// CHECK:STDOUT: %.loc17_11: init %struct_type.a.b = converted %y.ref, %.loc17_10.7 -// CHECK:STDOUT: return %.loc17_11 to %return +// CHECK:STDOUT: %.loc20_10.1: %i32 = struct_access %y.ref, element1 +// CHECK:STDOUT: %.loc20_10.2: ref %i32 = struct_access %return, element1 +// CHECK:STDOUT: %.loc20_10.3: init %i32 = initialize_from %.loc20_10.1 to %.loc20_10.2 +// CHECK:STDOUT: %.loc20_10.4: f64 = struct_access %y.ref, element0 +// CHECK:STDOUT: %.loc20_10.5: ref f64 = struct_access %return, element0 +// CHECK:STDOUT: %.loc20_10.6: init f64 = initialize_from %.loc20_10.4 to %.loc20_10.5 +// CHECK:STDOUT: %.loc20_10.7: init %struct_type.a.b = struct_init (%.loc20_10.3, %.loc20_10.6) to %return +// CHECK:STDOUT: %.loc20_11: init %struct_type.a.b = converted %y.ref, %.loc20_10.7 +// CHECK:STDOUT: return %.loc20_11 to %return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/tuple_as_element.carbon b/toolchain/check/testdata/struct/tuple_as_element.carbon index 42c04de1dc80..5028c0224aa6 100644 --- a/toolchain/check/testdata/struct/tuple_as_element.carbon +++ b/toolchain/check/testdata/struct/tuple_as_element.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/tuple_as_element.carbon @@ -79,14 +82,14 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: %x.var_patt: %pattern_type.b4d = var_pattern %x.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %x.var: ref %struct_type.a.b.3d5 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc11_28: type = splice_block %struct_type.a.b.loc11 [concrete = constants.%struct_type.a.b.3d5] { -// CHECK:STDOUT: %int_32.loc11_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc11_27.1: %tuple.type.85c = tuple_literal (%i32.loc11_23) -// CHECK:STDOUT: %.loc11_27.2: type = converted %.loc11_27.1, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c] -// CHECK:STDOUT: %struct_type.a.b.loc11: type = struct_type {.a: %i32, .b: %tuple.type.a1c} [concrete = constants.%struct_type.a.b.3d5] +// CHECK:STDOUT: %.loc14_28: type = splice_block %struct_type.a.b.loc14 [concrete = constants.%struct_type.a.b.3d5] { +// CHECK:STDOUT: %int_32.loc14_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc14_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc14_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc14_27.1: %tuple.type.85c = tuple_literal (%i32.loc14_23) +// CHECK:STDOUT: %.loc14_27.2: type = converted %.loc14_27.1, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c] +// CHECK:STDOUT: %struct_type.a.b.loc14: type = struct_type {.a: %i32, .b: %tuple.type.a1c} [concrete = constants.%struct_type.a.b.3d5] // CHECK:STDOUT: } // CHECK:STDOUT: %x: ref %struct_type.a.b.3d5 = bind_name x, %x.var [concrete = %x.var] // CHECK:STDOUT: name_binding_decl { @@ -94,14 +97,14 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: %y.var_patt: %pattern_type.b4d = var_pattern %y.patt [concrete] // CHECK:STDOUT: } // CHECK:STDOUT: %y.var: ref %struct_type.a.b.3d5 = var %y.var_patt [concrete] -// CHECK:STDOUT: %.loc12_28: type = splice_block %struct_type.a.b.loc12 [concrete = constants.%struct_type.a.b.3d5] { -// CHECK:STDOUT: %int_32.loc12_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc12_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %.loc12_27.1: %tuple.type.85c = tuple_literal (%i32.loc12_23) -// CHECK:STDOUT: %.loc12_27.2: type = converted %.loc12_27.1, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c] -// CHECK:STDOUT: %struct_type.a.b.loc12: type = struct_type {.a: %i32, .b: %tuple.type.a1c} [concrete = constants.%struct_type.a.b.3d5] +// CHECK:STDOUT: %.loc15_28: type = splice_block %struct_type.a.b.loc15 [concrete = constants.%struct_type.a.b.3d5] { +// CHECK:STDOUT: %int_32.loc15_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc15_23: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc15_23: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %.loc15_27.1: %tuple.type.85c = tuple_literal (%i32.loc15_23) +// CHECK:STDOUT: %.loc15_27.2: type = converted %.loc15_27.1, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c] +// CHECK:STDOUT: %struct_type.a.b.loc15: type = struct_type {.a: %i32, .b: %tuple.type.a1c} [concrete = constants.%struct_type.a.b.3d5] // CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.a.b.3d5 = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: } @@ -110,44 +113,44 @@ var y: {.a: i32, .b: (i32,)} = x; // CHECK:STDOUT: !entry: // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc11_49.1: %tuple.type.985 = tuple_literal (%int_2) -// CHECK:STDOUT: %.loc11_50.1: %struct_type.a.b.057 = struct_literal (%int_1, %.loc11_49.1) -// CHECK:STDOUT: %impl.elem0.loc11_50: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_50.1: = bound_method %int_1, %impl.elem0.loc11_50 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn.loc11_50: = specific_function %impl.elem0.loc11_50, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_50.2: = bound_method %int_1, %specific_fn.loc11_50 [concrete = constants.%bound_method.9a1] -// CHECK:STDOUT: %int.convert_checked.loc11_50: init %i32 = call %bound_method.loc11_50.2(%int_1) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_50.2: init %i32 = converted %int_1, %int.convert_checked.loc11_50 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_50.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.b14] -// CHECK:STDOUT: %.loc11_50.4: init %i32 = initialize_from %.loc11_50.2 to %.loc11_50.3 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %impl.elem0.loc11_49: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_49.1: = bound_method %int_2, %impl.elem0.loc11_49 [concrete = constants.%Convert.bound.ef9] -// CHECK:STDOUT: %specific_fn.loc11_49: = specific_function %impl.elem0.loc11_49, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_49.2: = bound_method %int_2, %specific_fn.loc11_49 [concrete = constants.%bound_method.b92] -// CHECK:STDOUT: %int.convert_checked.loc11_49: init %i32 = call %bound_method.loc11_49.2(%int_2) [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc11_49.2: init %i32 = converted %int_2, %int.convert_checked.loc11_49 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc11_50.5: ref %tuple.type.a1c = struct_access file.%x.var, element1 [concrete = constants.%.dd9] -// CHECK:STDOUT: %.loc11_49.3: init %tuple.type.a1c = tuple_init (%.loc11_49.2) to %.loc11_50.5 [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.6: init %tuple.type.a1c = converted %.loc11_49.1, %.loc11_49.3 [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.7: init %tuple.type.a1c = initialize_from %.loc11_50.6 to %.loc11_50.5 [concrete = constants.%tuple] -// CHECK:STDOUT: %.loc11_50.8: init %struct_type.a.b.3d5 = struct_init (%.loc11_50.4, %.loc11_50.7) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_1: init %struct_type.a.b.3d5 = converted %.loc11_50.1, %.loc11_50.8 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc11_1 +// CHECK:STDOUT: %.loc14_49.1: %tuple.type.985 = tuple_literal (%int_2) +// CHECK:STDOUT: %.loc14_50.1: %struct_type.a.b.057 = struct_literal (%int_1, %.loc14_49.1) +// CHECK:STDOUT: %impl.elem0.loc14_50: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc14_50.1: = bound_method %int_1, %impl.elem0.loc14_50 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc14_50: = specific_function %impl.elem0.loc14_50, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_50.2: = bound_method %int_1, %specific_fn.loc14_50 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %int.convert_checked.loc14_50: init %i32 = call %bound_method.loc14_50.2(%int_1) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_50.2: init %i32 = converted %int_1, %int.convert_checked.loc14_50 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_50.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.b14] +// CHECK:STDOUT: %.loc14_50.4: init %i32 = initialize_from %.loc14_50.2 to %.loc14_50.3 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %impl.elem0.loc14_49: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc14_49.1: = bound_method %int_2, %impl.elem0.loc14_49 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc14_49: = specific_function %impl.elem0.loc14_49, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_49.2: = bound_method %int_2, %specific_fn.loc14_49 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %int.convert_checked.loc14_49: init %i32 = call %bound_method.loc14_49.2(%int_2) [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc14_49.2: init %i32 = converted %int_2, %int.convert_checked.loc14_49 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc14_50.5: ref %tuple.type.a1c = struct_access file.%x.var, element1 [concrete = constants.%.dd9] +// CHECK:STDOUT: %.loc14_49.3: init %tuple.type.a1c = tuple_init (%.loc14_49.2) to %.loc14_50.5 [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc14_50.6: init %tuple.type.a1c = converted %.loc14_49.1, %.loc14_49.3 [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc14_50.7: init %tuple.type.a1c = initialize_from %.loc14_50.6 to %.loc14_50.5 [concrete = constants.%tuple] +// CHECK:STDOUT: %.loc14_50.8: init %struct_type.a.b.3d5 = struct_init (%.loc14_50.4, %.loc14_50.7) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_1: init %struct_type.a.b.3d5 = converted %.loc14_50.1, %.loc14_50.8 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc14_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a.b.3d5 = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc12_32.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.b14] -// CHECK:STDOUT: %.loc12_32.2: %i32 = bind_value %.loc12_32.1 -// CHECK:STDOUT: %.loc12_32.3: ref %i32 = struct_access file.%y.var, element0 [concrete = constants.%.f15] -// CHECK:STDOUT: %.loc12_32.4: init %i32 = initialize_from %.loc12_32.2 to %.loc12_32.3 -// CHECK:STDOUT: %.loc12_32.5: ref %tuple.type.a1c = struct_access %x.ref, element1 [concrete = constants.%.dd9] -// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %.loc12_32.5, element0 [concrete = constants.%tuple.elem0.2a6] -// CHECK:STDOUT: %.loc12_32.6: %i32 = bind_value %tuple.elem0 -// CHECK:STDOUT: %.loc12_32.7: ref %tuple.type.a1c = struct_access file.%y.var, element1 [concrete = constants.%.413] -// CHECK:STDOUT: %.loc12_32.8: init %tuple.type.a1c = tuple_init (%.loc12_32.6) to %.loc12_32.7 -// CHECK:STDOUT: %.loc12_32.9: init %tuple.type.a1c = converted %.loc12_32.5, %.loc12_32.8 -// CHECK:STDOUT: %.loc12_32.10: init %tuple.type.a1c = initialize_from %.loc12_32.9 to %.loc12_32.7 -// CHECK:STDOUT: %.loc12_32.11: init %struct_type.a.b.3d5 = struct_init (%.loc12_32.4, %.loc12_32.10) to file.%y.var -// CHECK:STDOUT: %.loc12_1: init %struct_type.a.b.3d5 = converted %x.ref, %.loc12_32.11 -// CHECK:STDOUT: assign file.%y.var, %.loc12_1 +// CHECK:STDOUT: %.loc15_32.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.b14] +// CHECK:STDOUT: %.loc15_32.2: %i32 = bind_value %.loc15_32.1 +// CHECK:STDOUT: %.loc15_32.3: ref %i32 = struct_access file.%y.var, element0 [concrete = constants.%.f15] +// CHECK:STDOUT: %.loc15_32.4: init %i32 = initialize_from %.loc15_32.2 to %.loc15_32.3 +// CHECK:STDOUT: %.loc15_32.5: ref %tuple.type.a1c = struct_access %x.ref, element1 [concrete = constants.%.dd9] +// CHECK:STDOUT: %tuple.elem0: ref %i32 = tuple_access %.loc15_32.5, element0 [concrete = constants.%tuple.elem0.2a6] +// CHECK:STDOUT: %.loc15_32.6: %i32 = bind_value %tuple.elem0 +// CHECK:STDOUT: %.loc15_32.7: ref %tuple.type.a1c = struct_access file.%y.var, element1 [concrete = constants.%.413] +// CHECK:STDOUT: %.loc15_32.8: init %tuple.type.a1c = tuple_init (%.loc15_32.6) to %.loc15_32.7 +// CHECK:STDOUT: %.loc15_32.9: init %tuple.type.a1c = converted %.loc15_32.5, %.loc15_32.8 +// CHECK:STDOUT: %.loc15_32.10: init %tuple.type.a1c = initialize_from %.loc15_32.9 to %.loc15_32.7 +// CHECK:STDOUT: %.loc15_32.11: init %struct_type.a.b.3d5 = struct_init (%.loc15_32.4, %.loc15_32.10) to file.%y.var +// CHECK:STDOUT: %.loc15_1: init %struct_type.a.b.3d5 = converted %x.ref, %.loc15_32.11 +// CHECK:STDOUT: assign file.%y.var, %.loc15_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: diff --git a/toolchain/check/testdata/struct/two_entries.carbon b/toolchain/check/testdata/struct/two_entries.carbon index c7510585742d..0da17ac58cbf 100644 --- a/toolchain/check/testdata/struct/two_entries.carbon +++ b/toolchain/check/testdata/struct/two_entries.carbon @@ -2,6 +2,9 @@ // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // +// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only". +// EXTRA-ARGS: --dump-sem-ir-ranges=if-present +// // AUTOUPDATE // TIP: To test this file alone, run: // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/two_entries.carbon @@ -77,59 +80,33 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: name_binding_decl { // CHECK:STDOUT: %v.patt: %pattern_type.851 = binding_pattern v [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %.loc11_25: type = splice_block %struct_type.a.b.loc11 [concrete = constants.%struct_type.a.b.501] { -// CHECK:STDOUT: %int_32.loc11_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc11_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc11_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.b.loc11: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] -// CHECK:STDOUT: } -// CHECK:STDOUT: %impl.elem0.loc11_44.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_44.1: = bound_method @__global_init.%int_1.loc11, %impl.elem0.loc11_44.1 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn.loc11_44.1: = specific_function %impl.elem0.loc11_44.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_44.2: = bound_method @__global_init.%int_1.loc11, %specific_fn.loc11_44.1 [concrete = constants.%bound_method.9a1] -// CHECK:STDOUT: %int.convert_checked.loc11_44.1: init %i32 = call %bound_method.loc11_44.2(@__global_init.%int_1.loc11) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_44.1: %i32 = value_of_initializer %int.convert_checked.loc11_44.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc11_44.2: %i32 = converted @__global_init.%int_1.loc11, %.loc11_44.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %impl.elem0.loc11_44.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc11_44.3: = bound_method @__global_init.%int_2.loc11, %impl.elem0.loc11_44.2 [concrete = constants.%Convert.bound.ef9] -// CHECK:STDOUT: %specific_fn.loc11_44.2: = specific_function %impl.elem0.loc11_44.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc11_44.4: = bound_method @__global_init.%int_2.loc11, %specific_fn.loc11_44.2 [concrete = constants.%bound_method.b92] -// CHECK:STDOUT: %int.convert_checked.loc11_44.2: init %i32 = call %bound_method.loc11_44.4(@__global_init.%int_2.loc11) [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc11_44.3: %i32 = value_of_initializer %int.convert_checked.loc11_44.2 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc11_44.4: %i32 = converted @__global_init.%int_2.loc11, %.loc11_44.3 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%.loc11_44.2, %.loc11_44.4) [concrete = constants.%struct] -// CHECK:STDOUT: %.loc11_44.5: %struct_type.a.b.501 = converted @__global_init.%.loc11, %struct [concrete = constants.%struct] -// CHECK:STDOUT: %v: %struct_type.a.b.501 = bind_name v, %.loc11_44.5 -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %w.patt: %pattern_type.851 = binding_pattern w [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %.loc12: type = splice_block %struct_type.a.b.loc12 [concrete = constants.%struct_type.a.b.501] { -// CHECK:STDOUT: %int_32.loc12_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %int_32.loc12_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] -// CHECK:STDOUT: %i32.loc12_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] -// CHECK:STDOUT: %struct_type.a.b.loc12: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] -// CHECK:STDOUT: } -// CHECK:STDOUT: %w: %struct_type.a.b.501 = bind_name w, @__global_init.%v.ref -// CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %x.patt: %pattern_type.851 = binding_pattern x [concrete] -// CHECK:STDOUT: %x.var_patt: %pattern_type.851 = var_pattern %x.patt [concrete] -// CHECK:STDOUT: } -// CHECK:STDOUT: %x.var: ref %struct_type.a.b.501 = var %x.var_patt [concrete] -// CHECK:STDOUT: %.loc14: type = splice_block %struct_type.a.b.loc14 [concrete = constants.%struct_type.a.b.501] { +// CHECK:STDOUT: %.loc14_25: type = splice_block %struct_type.a.b.loc14 [concrete = constants.%struct_type.a.b.501] { // CHECK:STDOUT: %int_32.loc14_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc14_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %int_32.loc14_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc14_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b.loc14: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] // CHECK:STDOUT: } -// CHECK:STDOUT: %x: ref %struct_type.a.b.501 = bind_name x, %x.var [concrete = %x.var] +// CHECK:STDOUT: %impl.elem0.loc14_44.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc14_44.1: = bound_method @__global_init.%int_1.loc14, %impl.elem0.loc14_44.1 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc14_44.1: = specific_function %impl.elem0.loc14_44.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_44.2: = bound_method @__global_init.%int_1.loc14, %specific_fn.loc14_44.1 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %int.convert_checked.loc14_44.1: init %i32 = call %bound_method.loc14_44.2(@__global_init.%int_1.loc14) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_44.1: %i32 = value_of_initializer %int.convert_checked.loc14_44.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc14_44.2: %i32 = converted @__global_init.%int_1.loc14, %.loc14_44.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %impl.elem0.loc14_44.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc14_44.3: = bound_method @__global_init.%int_2.loc14, %impl.elem0.loc14_44.2 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc14_44.2: = specific_function %impl.elem0.loc14_44.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc14_44.4: = bound_method @__global_init.%int_2.loc14, %specific_fn.loc14_44.2 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %int.convert_checked.loc14_44.2: init %i32 = call %bound_method.loc14_44.4(@__global_init.%int_2.loc14) [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc14_44.3: %i32 = value_of_initializer %int.convert_checked.loc14_44.2 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc14_44.4: %i32 = converted @__global_init.%int_2.loc14, %.loc14_44.3 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %struct: %struct_type.a.b.501 = struct_value (%.loc14_44.2, %.loc14_44.4) [concrete = constants.%struct] +// CHECK:STDOUT: %.loc14_44.5: %struct_type.a.b.501 = converted @__global_init.%.loc14, %struct [concrete = constants.%struct] +// CHECK:STDOUT: %v: %struct_type.a.b.501 = bind_name v, %.loc14_44.5 // CHECK:STDOUT: name_binding_decl { -// CHECK:STDOUT: %y.patt: %pattern_type.851 = binding_pattern y [concrete] -// CHECK:STDOUT: %y.var_patt: %pattern_type.851 = var_pattern %y.patt [concrete] +// CHECK:STDOUT: %w.patt: %pattern_type.851 = binding_pattern w [concrete] // CHECK:STDOUT: } -// CHECK:STDOUT: %y.var: ref %struct_type.a.b.501 = var %y.var_patt [concrete] // CHECK:STDOUT: %.loc15: type = splice_block %struct_type.a.b.loc15 [concrete = constants.%struct_type.a.b.501] { // CHECK:STDOUT: %int_32.loc15_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] // CHECK:STDOUT: %i32.loc15_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] @@ -137,49 +114,75 @@ var y: {.a: i32, .b: i32} = x; // CHECK:STDOUT: %i32.loc15_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] // CHECK:STDOUT: %struct_type.a.b.loc15: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] // CHECK:STDOUT: } +// CHECK:STDOUT: %w: %struct_type.a.b.501 = bind_name w, @__global_init.%v.ref +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %x.patt: %pattern_type.851 = binding_pattern x [concrete] +// CHECK:STDOUT: %x.var_patt: %pattern_type.851 = var_pattern %x.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x.var: ref %struct_type.a.b.501 = var %x.var_patt [concrete] +// CHECK:STDOUT: %.loc17: type = splice_block %struct_type.a.b.loc17 [concrete = constants.%struct_type.a.b.501] { +// CHECK:STDOUT: %int_32.loc17_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc17_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc17_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.b.loc17: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] +// CHECK:STDOUT: } +// CHECK:STDOUT: %x: ref %struct_type.a.b.501 = bind_name x, %x.var [concrete = %x.var] +// CHECK:STDOUT: name_binding_decl { +// CHECK:STDOUT: %y.patt: %pattern_type.851 = binding_pattern y [concrete] +// CHECK:STDOUT: %y.var_patt: %pattern_type.851 = var_pattern %y.patt [concrete] +// CHECK:STDOUT: } +// CHECK:STDOUT: %y.var: ref %struct_type.a.b.501 = var %y.var_patt [concrete] +// CHECK:STDOUT: %.loc18: type = splice_block %struct_type.a.b.loc18 [concrete = constants.%struct_type.a.b.501] { +// CHECK:STDOUT: %int_32.loc18_13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %int_32.loc18_22: Core.IntLiteral = int_value 32 [concrete = constants.%int_32] +// CHECK:STDOUT: %i32.loc18_22: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32] +// CHECK:STDOUT: %struct_type.a.b.loc18: type = struct_type {.a: %i32, .b: %i32} [concrete = constants.%struct_type.a.b.501] +// CHECK:STDOUT: } // CHECK:STDOUT: %y: ref %struct_type.a.b.501 = bind_name y, %y.var [concrete = %y.var] // CHECK:STDOUT: } // CHECK:STDOUT: // CHECK:STDOUT: fn @__global_init() { // CHECK:STDOUT: !entry: -// CHECK:STDOUT: %int_1.loc11: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] -// CHECK:STDOUT: %int_2.loc11: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc11: %struct_type.a.b.cfd = struct_literal (%int_1.loc11, %int_2.loc11) -// CHECK:STDOUT: %v.ref: %struct_type.a.b.501 = name_ref v, file.%v // CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] // CHECK:STDOUT: %int_2.loc14: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] -// CHECK:STDOUT: %.loc14_44.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc14, %int_2.loc14) -// CHECK:STDOUT: %impl.elem0.loc14_44.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc14_44.1: = bound_method %int_1.loc14, %impl.elem0.loc14_44.1 [concrete = constants.%Convert.bound.ab5] -// CHECK:STDOUT: %specific_fn.loc14_44.1: = specific_function %impl.elem0.loc14_44.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_44.2: = bound_method %int_1.loc14, %specific_fn.loc14_44.1 [concrete = constants.%bound_method.9a1] -// CHECK:STDOUT: %int.convert_checked.loc14_44.1: init %i32 = call %bound_method.loc14_44.2(%int_1.loc14) [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc14_44.2: init %i32 = converted %int_1.loc14, %int.convert_checked.loc14_44.1 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %.loc14_44.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.22f] -// CHECK:STDOUT: %.loc14_44.4: init %i32 = initialize_from %.loc14_44.2 to %.loc14_44.3 [concrete = constants.%int_1.5d2] -// CHECK:STDOUT: %impl.elem0.loc14_44.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] -// CHECK:STDOUT: %bound_method.loc14_44.3: = bound_method %int_2.loc14, %impl.elem0.loc14_44.2 [concrete = constants.%Convert.bound.ef9] -// CHECK:STDOUT: %specific_fn.loc14_44.2: = specific_function %impl.elem0.loc14_44.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] -// CHECK:STDOUT: %bound_method.loc14_44.4: = bound_method %int_2.loc14, %specific_fn.loc14_44.2 [concrete = constants.%bound_method.b92] -// CHECK:STDOUT: %int.convert_checked.loc14_44.2: init %i32 = call %bound_method.loc14_44.4(%int_2.loc14) [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc14_44.5: init %i32 = converted %int_2.loc14, %int.convert_checked.loc14_44.2 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc14_44.6: ref %i32 = struct_access file.%x.var, element1 [concrete = constants.%.5fc] -// CHECK:STDOUT: %.loc14_44.7: init %i32 = initialize_from %.loc14_44.5 to %.loc14_44.6 [concrete = constants.%int_2.ef8] -// CHECK:STDOUT: %.loc14_44.8: init %struct_type.a.b.501 = struct_init (%.loc14_44.4, %.loc14_44.7) to file.%x.var [concrete = constants.%struct] -// CHECK:STDOUT: %.loc14_1: init %struct_type.a.b.501 = converted %.loc14_44.1, %.loc14_44.8 [concrete = constants.%struct] -// CHECK:STDOUT: assign file.%x.var, %.loc14_1 +// CHECK:STDOUT: %.loc14: %struct_type.a.b.cfd = struct_literal (%int_1.loc14, %int_2.loc14) +// CHECK:STDOUT: %v.ref: %struct_type.a.b.501 = name_ref v, file.%v +// CHECK:STDOUT: %int_1.loc17: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8] +// CHECK:STDOUT: %int_2.loc17: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc] +// CHECK:STDOUT: %.loc17_44.1: %struct_type.a.b.cfd = struct_literal (%int_1.loc17, %int_2.loc17) +// CHECK:STDOUT: %impl.elem0.loc17_44.1: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc17_44.1: = bound_method %int_1.loc17, %impl.elem0.loc17_44.1 [concrete = constants.%Convert.bound.ab5] +// CHECK:STDOUT: %specific_fn.loc17_44.1: = specific_function %impl.elem0.loc17_44.1, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_44.2: = bound_method %int_1.loc17, %specific_fn.loc17_44.1 [concrete = constants.%bound_method.9a1] +// CHECK:STDOUT: %int.convert_checked.loc17_44.1: init %i32 = call %bound_method.loc17_44.2(%int_1.loc17) [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc17_44.2: init %i32 = converted %int_1.loc17, %int.convert_checked.loc17_44.1 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %.loc17_44.3: ref %i32 = struct_access file.%x.var, element0 [concrete = constants.%.22f] +// CHECK:STDOUT: %.loc17_44.4: init %i32 = initialize_from %.loc17_44.2 to %.loc17_44.3 [concrete = constants.%int_1.5d2] +// CHECK:STDOUT: %impl.elem0.loc17_44.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956] +// CHECK:STDOUT: %bound_method.loc17_44.3: = bound_method %int_2.loc17, %impl.elem0.loc17_44.2 [concrete = constants.%Convert.bound.ef9] +// CHECK:STDOUT: %specific_fn.loc17_44.2: = specific_function %impl.elem0.loc17_44.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn] +// CHECK:STDOUT: %bound_method.loc17_44.4: = bound_method %int_2.loc17, %specific_fn.loc17_44.2 [concrete = constants.%bound_method.b92] +// CHECK:STDOUT: %int.convert_checked.loc17_44.2: init %i32 = call %bound_method.loc17_44.4(%int_2.loc17) [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc17_44.5: init %i32 = converted %int_2.loc17, %int.convert_checked.loc17_44.2 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc17_44.6: ref %i32 = struct_access file.%x.var, element1 [concrete = constants.%.5fc] +// CHECK:STDOUT: %.loc17_44.7: init %i32 = initialize_from %.loc17_44.5 to %.loc17_44.6 [concrete = constants.%int_2.ef8] +// CHECK:STDOUT: %.loc17_44.8: init %struct_type.a.b.501 = struct_init (%.loc17_44.4, %.loc17_44.7) to file.%x.var [concrete = constants.%struct] +// CHECK:STDOUT: %.loc17_1: init %struct_type.a.b.501 = converted %.loc17_44.1, %.loc17_44.8 [concrete = constants.%struct] +// CHECK:STDOUT: assign file.%x.var, %.loc17_1 // CHECK:STDOUT: %x.ref: ref %struct_type.a.b.501 = name_ref x, file.%x [concrete = file.%x.var] -// CHECK:STDOUT: %.loc15_29.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.22f] -// CHECK:STDOUT: %.loc15_29.2: %i32 = bind_value %.loc15_29.1 -// CHECK:STDOUT: %.loc15_29.3: ref %i32 = struct_access file.%y.var, element0 [concrete = constants.%.4ca] -// CHECK:STDOUT: %.loc15_29.4: init %i32 = initialize_from %.loc15_29.2 to %.loc15_29.3 -// CHECK:STDOUT: %.loc15_29.5: ref %i32 = struct_access %x.ref, element1 [concrete = constants.%.5fc] -// CHECK:STDOUT: %.loc15_29.6: %i32 = bind_value %.loc15_29.5 -// CHECK:STDOUT: %.loc15_29.7: ref %i32 = struct_access file.%y.var, element1 [concrete = constants.%.86e] -// CHECK:STDOUT: %.loc15_29.8: init %i32 = initialize_from %.loc15_29.6 to %.loc15_29.7 -// CHECK:STDOUT: %.loc15_29.9: init %struct_type.a.b.501 = struct_init (%.loc15_29.4, %.loc15_29.8) to file.%y.var -// CHECK:STDOUT: %.loc15_1: init %struct_type.a.b.501 = converted %x.ref, %.loc15_29.9 -// CHECK:STDOUT: assign file.%y.var, %.loc15_1 +// CHECK:STDOUT: %.loc18_29.1: ref %i32 = struct_access %x.ref, element0 [concrete = constants.%.22f] +// CHECK:STDOUT: %.loc18_29.2: %i32 = bind_value %.loc18_29.1 +// CHECK:STDOUT: %.loc18_29.3: ref %i32 = struct_access file.%y.var, element0 [concrete = constants.%.4ca] +// CHECK:STDOUT: %.loc18_29.4: init %i32 = initialize_from %.loc18_29.2 to %.loc18_29.3 +// CHECK:STDOUT: %.loc18_29.5: ref %i32 = struct_access %x.ref, element1 [concrete = constants.%.5fc] +// CHECK:STDOUT: %.loc18_29.6: %i32 = bind_value %.loc18_29.5 +// CHECK:STDOUT: %.loc18_29.7: ref %i32 = struct_access file.%y.var, element1 [concrete = constants.%.86e] +// CHECK:STDOUT: %.loc18_29.8: init %i32 = initialize_from %.loc18_29.6 to %.loc18_29.7 +// CHECK:STDOUT: %.loc18_29.9: init %struct_type.a.b.501 = struct_init (%.loc18_29.4, %.loc18_29.8) to file.%y.var +// CHECK:STDOUT: %.loc18_1: init %struct_type.a.b.501 = converted %x.ref, %.loc18_29.9 +// CHECK:STDOUT: assign file.%y.var, %.loc18_1 // CHECK:STDOUT: return // CHECK:STDOUT: } // CHECK:STDOUT: