Skip to content

Commit 0b530de

Browse files
authored
Add range flag settings to operators files (#5567)
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.
1 parent a01648c commit 0b530de

40 files changed

+1252
-1135
lines changed

toolchain/check/testdata/operators/builtin/and.carbon

Lines changed: 180 additions & 177 deletions
Large diffs are not rendered by default.

toolchain/check/testdata/operators/builtin/assignment.carbon

Lines changed: 150 additions & 147 deletions
Large diffs are not rendered by default.

toolchain/check/testdata/operators/builtin/bit_and.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// EXTRA-ARGS: --no-dump-sem-ir
5+
// EXTRA-ARGS: --dump-sem-ir-ranges=only
66
//
77
// AUTOUPDATE
88
// TIP: To test this file alone, run:

toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_not_in_function.carbon

toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_and_or_partial_constant.carbon

toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_assignment_to_error.carbon
@@ -50,12 +53,12 @@ fn Main() {
5053
// CHECK:STDOUT: fn @Main() {
5154
// CHECK:STDOUT: !entry:
5255
// CHECK:STDOUT: %undeclared.ref: <error> = name_ref undeclared, <error> [concrete = <error>]
53-
// CHECK:STDOUT: %int_42.loc16: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
56+
// CHECK:STDOUT: %int_42.loc19: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
5457
// CHECK:STDOUT: assign %undeclared.ref, <error>
5558
// CHECK:STDOUT: %also_undeclared.ref: <error> = name_ref also_undeclared, <error> [concrete = <error>]
56-
// CHECK:STDOUT: %.loc21: ref <error> = deref <error> [concrete = <error>]
57-
// CHECK:STDOUT: %int_42.loc21: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
58-
// CHECK:STDOUT: assign %.loc21, <error>
59+
// CHECK:STDOUT: %.loc24: ref <error> = deref <error> [concrete = <error>]
60+
// CHECK:STDOUT: %int_42.loc24: Core.IntLiteral = int_value 42 [concrete = constants.%int_42]
61+
// CHECK:STDOUT: assign %.loc24, <error>
5962
// CHECK:STDOUT: return
6063
// CHECK:STDOUT: }
6164
// CHECK:STDOUT:

toolchain/check/testdata/operators/builtin/fail_assignment_to_non_assignable.carbon

Lines changed: 145 additions & 142 deletions
Large diffs are not rendered by default.

toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_redundant_compound_access.carbon
@@ -95,13 +98,13 @@ fn Main() {
9598
// CHECK:STDOUT: !entry:
9699
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
97100
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
98-
// CHECK:STDOUT: %bound_method.loc11_25.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound.d04]
101+
// CHECK:STDOUT: %bound_method.loc14_25.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound.d04]
99102
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
100-
// CHECK:STDOUT: %bound_method.loc11_25.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.b6e]
101-
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc11_25.2(%int_0) [concrete = constants.%int_0.6a9]
102-
// CHECK:STDOUT: %.loc11_25.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
103-
// CHECK:STDOUT: %.loc11_25.2: %i32 = converted %int_0, %.loc11_25.1 [concrete = constants.%int_0.6a9]
104-
// CHECK:STDOUT: return %.loc11_25.2
103+
// CHECK:STDOUT: %bound_method.loc14_25.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method.b6e]
104+
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc14_25.2(%int_0) [concrete = constants.%int_0.6a9]
105+
// CHECK:STDOUT: %.loc14_25.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
106+
// CHECK:STDOUT: %.loc14_25.2: %i32 = converted %int_0, %.loc14_25.1 [concrete = constants.%int_0.6a9]
107+
// CHECK:STDOUT: return %.loc14_25.2
105108
// CHECK:STDOUT: }
106109
// CHECK:STDOUT:
107110
// CHECK:STDOUT: fn @Main() {
@@ -113,27 +116,27 @@ fn Main() {
113116
// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt
114117
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
115118
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
116-
// CHECK:STDOUT: %bound_method.loc14_3.1: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound.b30]
119+
// CHECK:STDOUT: %bound_method.loc17_3.1: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound.b30]
117120
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
118-
// CHECK:STDOUT: %bound_method.loc14_3.2: <bound method> = bound_method %int_3, %specific_fn [concrete = constants.%bound_method.047]
119-
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc14_3.2(%int_3) [concrete = constants.%int_3.822]
120-
// CHECK:STDOUT: %.loc14_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822]
121-
// CHECK:STDOUT: assign %a.var, %.loc14_3
122-
// CHECK:STDOUT: %.loc14_10: type = splice_block %i32 [concrete = constants.%i32] {
121+
// CHECK:STDOUT: %bound_method.loc17_3.2: <bound method> = bound_method %int_3, %specific_fn [concrete = constants.%bound_method.047]
122+
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc17_3.2(%int_3) [concrete = constants.%int_3.822]
123+
// CHECK:STDOUT: %.loc17_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822]
124+
// CHECK:STDOUT: assign %a.var, %.loc17_3
125+
// CHECK:STDOUT: %.loc17_10: type = splice_block %i32 [concrete = constants.%i32] {
123126
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
124127
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
125128
// CHECK:STDOUT: }
126129
// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
127-
// CHECK:STDOUT: %a.ref.loc19_3: ref %i32 = name_ref a, %a
128-
// CHECK:STDOUT: %a.ref.loc19_7: ref %i32 = name_ref a, %a
129-
// CHECK:STDOUT: %a.ref.loc19_10: ref %i32 = name_ref a, %a
130-
// CHECK:STDOUT: %.loc19: %i32 = bind_value %a.ref.loc19_10
131-
// CHECK:STDOUT: assign %a.ref.loc19_3, %.loc19
132-
// CHECK:STDOUT: %a.ref.loc24_3: ref %i32 = name_ref a, %a
133-
// CHECK:STDOUT: %a.ref.loc24_7: ref %i32 = name_ref a, %a
130+
// CHECK:STDOUT: %a.ref.loc22_3: ref %i32 = name_ref a, %a
131+
// CHECK:STDOUT: %a.ref.loc22_7: ref %i32 = name_ref a, %a
132+
// CHECK:STDOUT: %a.ref.loc22_10: ref %i32 = name_ref a, %a
133+
// CHECK:STDOUT: %.loc22: %i32 = bind_value %a.ref.loc22_10
134+
// CHECK:STDOUT: assign %a.ref.loc22_3, %.loc22
135+
// CHECK:STDOUT: %a.ref.loc27_3: ref %i32 = name_ref a, %a
136+
// CHECK:STDOUT: %a.ref.loc27_7: ref %i32 = name_ref a, %a
134137
// CHECK:STDOUT: %F.ref: %F.type = name_ref F, file.%F.decl [concrete = constants.%F]
135138
// CHECK:STDOUT: %F.call: init %i32 = call %F.ref()
136-
// CHECK:STDOUT: assign %a.ref.loc24_3, %F.call
139+
// CHECK:STDOUT: assign %a.ref.loc27_3, %F.call
137140
// CHECK:STDOUT: return
138141
// CHECK:STDOUT: }
139142
// CHECK:STDOUT:

toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch.carbon
@@ -60,13 +63,13 @@ fn Main() {
6063
// CHECK:STDOUT: }
6164
// CHECK:STDOUT: %x.var: ref bool = var %x.var_patt
6265
// CHECK:STDOUT: %int_12: Core.IntLiteral = int_value 12 [concrete = constants.%int_12]
63-
// CHECK:STDOUT: %.loc19_17.1: bool = converted %int_12, <error> [concrete = <error>]
64-
// CHECK:STDOUT: %.loc19_17.2: <error> = not <error> [concrete = <error>]
66+
// CHECK:STDOUT: %.loc22_17.1: bool = converted %int_12, <error> [concrete = <error>]
67+
// CHECK:STDOUT: %.loc22_17.2: <error> = not <error> [concrete = <error>]
6568
// CHECK:STDOUT: assign %x.var, <error>
66-
// CHECK:STDOUT: %.loc19_10.1: type = splice_block %.loc19_10.3 [concrete = bool] {
69+
// CHECK:STDOUT: %.loc22_10.1: type = splice_block %.loc22_10.3 [concrete = bool] {
6770
// CHECK:STDOUT: %bool.make_type: init type = call constants.%Bool() [concrete = bool]
68-
// CHECK:STDOUT: %.loc19_10.2: type = value_of_initializer %bool.make_type [concrete = bool]
69-
// CHECK:STDOUT: %.loc19_10.3: type = converted %bool.make_type, %.loc19_10.2 [concrete = bool]
71+
// CHECK:STDOUT: %.loc22_10.2: type = value_of_initializer %bool.make_type [concrete = bool]
72+
// CHECK:STDOUT: %.loc22_10.3: type = converted %bool.make_type, %.loc22_10.2 [concrete = bool]
7073
// CHECK:STDOUT: }
7174
// CHECK:STDOUT: %x: ref bool = bind_name x, %x.var
7275
// CHECK:STDOUT: return

toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5+
// TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
6+
// EXTRA-ARGS: --dump-sem-ir-ranges=if-present
7+
//
58
// AUTOUPDATE
69
// TIP: To test this file alone, run:
710
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/operators/builtin/fail_type_mismatch_assignment.carbon
@@ -81,20 +84,20 @@ fn Main() {
8184
// CHECK:STDOUT: %a.var: ref %i32 = var %a.var_patt
8285
// CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
8386
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
84-
// CHECK:STDOUT: %bound_method.loc12_3.1: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound]
87+
// CHECK:STDOUT: %bound_method.loc15_3.1: <bound method> = bound_method %int_3, %impl.elem0 [concrete = constants.%Convert.bound]
8588
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
86-
// CHECK:STDOUT: %bound_method.loc12_3.2: <bound method> = bound_method %int_3, %specific_fn [concrete = constants.%bound_method]
87-
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc12_3.2(%int_3) [concrete = constants.%int_3.822]
88-
// CHECK:STDOUT: %.loc12_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822]
89-
// CHECK:STDOUT: assign %a.var, %.loc12_3
90-
// CHECK:STDOUT: %.loc12_10: type = splice_block %i32 [concrete = constants.%i32] {
89+
// CHECK:STDOUT: %bound_method.loc15_3.2: <bound method> = bound_method %int_3, %specific_fn [concrete = constants.%bound_method]
90+
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc15_3.2(%int_3) [concrete = constants.%int_3.822]
91+
// CHECK:STDOUT: %.loc15_3: init %i32 = converted %int_3, %int.convert_checked [concrete = constants.%int_3.822]
92+
// CHECK:STDOUT: assign %a.var, %.loc15_3
93+
// CHECK:STDOUT: %.loc15_10: type = splice_block %i32 [concrete = constants.%i32] {
9194
// CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
9295
// CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
9396
// CHECK:STDOUT: }
9497
// CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
9598
// CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
9699
// CHECK:STDOUT: %float: f64 = float_literal 5.6000000000000005 [concrete = constants.%float]
97-
// CHECK:STDOUT: %.loc20: %i32 = converted %float, <error> [concrete = <error>]
100+
// CHECK:STDOUT: %.loc23: %i32 = converted %float, <error> [concrete = <error>]
98101
// CHECK:STDOUT: assign %a.ref, <error>
99102
// CHECK:STDOUT: return
100103
// CHECK:STDOUT: }

0 commit comments

Comments
 (0)