Skip to content

Commit 2e3fb4d

Browse files
authored
Add range flag settings to namespace files (#5566)
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 8fb5bce commit 2e3fb4d

23 files changed

+134
-68
lines changed

toolchain/check/testdata/namespace/add_to_import.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/namespace/add_to_import.carbon

toolchain/check/testdata/namespace/alias.carbon

Lines changed: 17 additions & 14 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/namespace/alias.carbon
@@ -79,7 +82,7 @@ fn D() -> i32 { return C(); }
7982
// CHECK:STDOUT: %NS: <namespace> = namespace [concrete] {
8083
// CHECK:STDOUT: .A = %A.decl
8184
// CHECK:STDOUT: }
82-
// CHECK:STDOUT: %NS.ref.loc13: <namespace> = name_ref NS, %NS [concrete = %NS]
85+
// CHECK:STDOUT: %NS.ref.loc16: <namespace> = name_ref NS, %NS [concrete = %NS]
8386
// CHECK:STDOUT: %ns: <namespace> = bind_alias ns, %NS [concrete = %NS]
8487
// CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {
8588
// CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
@@ -99,7 +102,7 @@ fn D() -> i32 { return C(); }
99102
// CHECK:STDOUT: %return.param: ref %i32 = out_param call_param0
100103
// CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
101104
// CHECK:STDOUT: }
102-
// CHECK:STDOUT: %NS.ref.loc19: <namespace> = name_ref NS, %NS [concrete = %NS]
105+
// CHECK:STDOUT: %NS.ref.loc22: <namespace> = name_ref NS, %NS [concrete = %NS]
103106
// CHECK:STDOUT: %A.ref: %A.type = name_ref A, %A.decl [concrete = constants.%A]
104107
// CHECK:STDOUT: %C: %A.type = bind_alias C, %A.decl [concrete = constants.%A]
105108
// CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {
@@ -117,31 +120,31 @@ fn D() -> i32 { return C(); }
117120
// CHECK:STDOUT: !entry:
118121
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
119122
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
120-
// CHECK:STDOUT: %bound_method.loc15_28.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
123+
// CHECK:STDOUT: %bound_method.loc18_28.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
121124
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
122-
// CHECK:STDOUT: %bound_method.loc15_28.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
123-
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc15_28.2(%int_0) [concrete = constants.%int_0.6a9]
124-
// CHECK:STDOUT: %.loc15_28.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
125-
// CHECK:STDOUT: %.loc15_28.2: %i32 = converted %int_0, %.loc15_28.1 [concrete = constants.%int_0.6a9]
126-
// CHECK:STDOUT: return %.loc15_28.2
125+
// CHECK:STDOUT: %bound_method.loc18_28.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
126+
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc18_28.2(%int_0) [concrete = constants.%int_0.6a9]
127+
// CHECK:STDOUT: %.loc18_28.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
128+
// CHECK:STDOUT: %.loc18_28.2: %i32 = converted %int_0, %.loc18_28.1 [concrete = constants.%int_0.6a9]
129+
// CHECK:STDOUT: return %.loc18_28.2
127130
// CHECK:STDOUT: }
128131
// CHECK:STDOUT:
129132
// CHECK:STDOUT: fn @B() -> %i32 {
130133
// CHECK:STDOUT: !entry:
131134
// CHECK:STDOUT: %ns.ref: <namespace> = name_ref ns, file.%ns [concrete = file.%NS]
132135
// CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A]
133136
// CHECK:STDOUT: %A.call: init %i32 = call %A.ref()
134-
// CHECK:STDOUT: %.loc17_30.1: %i32 = value_of_initializer %A.call
135-
// CHECK:STDOUT: %.loc17_30.2: %i32 = converted %A.call, %.loc17_30.1
136-
// CHECK:STDOUT: return %.loc17_30.2
137+
// CHECK:STDOUT: %.loc20_30.1: %i32 = value_of_initializer %A.call
138+
// CHECK:STDOUT: %.loc20_30.2: %i32 = converted %A.call, %.loc20_30.1
139+
// CHECK:STDOUT: return %.loc20_30.2
137140
// CHECK:STDOUT: }
138141
// CHECK:STDOUT:
139142
// CHECK:STDOUT: fn @D() -> %i32 {
140143
// CHECK:STDOUT: !entry:
141144
// CHECK:STDOUT: %C.ref: %A.type = name_ref C, file.%C [concrete = constants.%A]
142145
// CHECK:STDOUT: %A.call: init %i32 = call %C.ref()
143-
// CHECK:STDOUT: %.loc21_27.1: %i32 = value_of_initializer %A.call
144-
// CHECK:STDOUT: %.loc21_27.2: %i32 = converted %A.call, %.loc21_27.1
145-
// CHECK:STDOUT: return %.loc21_27.2
146+
// CHECK:STDOUT: %.loc24_27.1: %i32 = value_of_initializer %A.call
147+
// CHECK:STDOUT: %.loc24_27.2: %i32 = converted %A.call, %.loc24_27.1
148+
// CHECK:STDOUT: return %.loc24_27.2
146149
// CHECK:STDOUT: }
147150
// CHECK:STDOUT:

toolchain/check/testdata/namespace/fail_conflict_after_merge.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/namespace/fail_conflict_after_merge.carbon

toolchain/check/testdata/namespace/fail_conflict_imported_namespace_first.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/namespace/fail_conflict_imported_namespace_first.carbon

toolchain/check/testdata/namespace/fail_conflict_imported_namespace_nested.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/namespace/fail_conflict_imported_namespace_nested.carbon

toolchain/check/testdata/namespace/fail_conflict_imported_namespace_second.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/namespace/fail_conflict_imported_namespace_second.carbon

toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_first.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/namespace/fail_conflict_in_imports_namespace_first.carbon

toolchain/check/testdata/namespace/fail_conflict_in_imports_namespace_second.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/namespace/fail_conflict_in_imports_namespace_second.carbon

toolchain/check/testdata/namespace/fail_decl_in_alias.carbon

Lines changed: 9 additions & 6 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/namespace/fail_decl_in_alias.carbon
@@ -89,12 +92,12 @@ fn ns.A() -> i32 { return 0; }
8992
// CHECK:STDOUT: !entry:
9093
// CHECK:STDOUT: %int_0: Core.IntLiteral = int_value 0 [concrete = constants.%int_0.5c6]
9194
// CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
92-
// CHECK:STDOUT: %bound_method.loc23_28.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
95+
// CHECK:STDOUT: %bound_method.loc26_28.1: <bound method> = bound_method %int_0, %impl.elem0 [concrete = constants.%Convert.bound]
9396
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
94-
// CHECK:STDOUT: %bound_method.loc23_28.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
95-
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc23_28.2(%int_0) [concrete = constants.%int_0.6a9]
96-
// CHECK:STDOUT: %.loc23_28.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
97-
// CHECK:STDOUT: %.loc23_28.2: %i32 = converted %int_0, %.loc23_28.1 [concrete = constants.%int_0.6a9]
98-
// CHECK:STDOUT: return %.loc23_28.2
97+
// CHECK:STDOUT: %bound_method.loc26_28.2: <bound method> = bound_method %int_0, %specific_fn [concrete = constants.%bound_method]
98+
// CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc26_28.2(%int_0) [concrete = constants.%int_0.6a9]
99+
// CHECK:STDOUT: %.loc26_28.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_0.6a9]
100+
// CHECK:STDOUT: %.loc26_28.2: %i32 = converted %int_0, %.loc26_28.1 [concrete = constants.%int_0.6a9]
101+
// CHECK:STDOUT: return %.loc26_28.2
99102
// CHECK:STDOUT: }
100103
// CHECK:STDOUT:

toolchain/check/testdata/namespace/fail_duplicate.carbon

Lines changed: 6 additions & 3 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/namespace/fail_duplicate.carbon
@@ -46,10 +49,10 @@ fn Foo.Baz() {
4649
// CHECK:STDOUT: }
4750
// CHECK:STDOUT: %Core.import = import Core
4851
// CHECK:STDOUT: %Foo: <namespace> = namespace [concrete] {
49-
// CHECK:STDOUT: .Baz = %Baz.decl.loc13
52+
// CHECK:STDOUT: .Baz = %Baz.decl.loc16
5053
// CHECK:STDOUT: }
51-
// CHECK:STDOUT: %Baz.decl.loc13: %Baz.type.8987ba.1 = fn_decl @Baz.1 [concrete = constants.%Baz.eb4c34.1] {} {}
52-
// CHECK:STDOUT: %Baz.decl.loc23: %Baz.type.8987ba.2 = fn_decl @Baz.2 [concrete = constants.%Baz.eb4c34.2] {} {}
54+
// CHECK:STDOUT: %Baz.decl.loc16: %Baz.type.8987ba.1 = fn_decl @Baz.1 [concrete = constants.%Baz.eb4c34.1] {} {}
55+
// CHECK:STDOUT: %Baz.decl.loc26: %Baz.type.8987ba.2 = fn_decl @Baz.2 [concrete = constants.%Baz.eb4c34.2] {} {}
5356
// CHECK:STDOUT: }
5457
// CHECK:STDOUT:
5558
// CHECK:STDOUT: fn @Baz.1() {

0 commit comments

Comments
 (0)