Skip to content

Commit 270174c

Browse files
authored
Move the ir test (#5510)
This test has its own directory, since #3056. We haven't added any more, so fold it into basics. Also simplify it a little using `else`, and `no_prelude`. Note, I'm not even sure how much we need this test given the `%.loc<line>_<col>`, but I feel slightly worse deleting it.
1 parent 69ab97d commit 270174c

File tree

2 files changed

+63
-123
lines changed

2 files changed

+63
-123
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
2+
// Exceptions. See /LICENSE for license information.
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
//
5+
// EXTRA-ARGS: --dump-sem-ir-ranges=only
6+
//
7+
// AUTOUPDATE
8+
// TIP: To test this file alone, run:
9+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/duplicate_name_same_line.carbon
10+
// TIP: To dump output, run:
11+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/duplicate_name_same_line.carbon
12+
13+
fn A() {
14+
if (true) {
15+
// This declares `n` in two different scopes, it's just showing the IR
16+
// behavior of having both on the same line.
17+
//@dump-sem-ir-begin
18+
var n: (); } else { var n: ();
19+
//@dump-sem-ir-end
20+
}
21+
}
22+
23+
// CHECK:STDOUT: --- duplicate_name_same_line.carbon
24+
// CHECK:STDOUT:
25+
// CHECK:STDOUT: constants {
26+
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
27+
// CHECK:STDOUT: %pattern_type: type = pattern_type %empty_tuple.type [concrete]
28+
// CHECK:STDOUT: }
29+
// CHECK:STDOUT:
30+
// CHECK:STDOUT: fn @A() {
31+
// CHECK:STDOUT: !entry:
32+
// CHECK:STDOUT: <elided>
33+
// CHECK:STDOUT:
34+
// CHECK:STDOUT: !if.then:
35+
// CHECK:STDOUT: name_binding_decl {
36+
// CHECK:STDOUT: %n.patt.loc18_9: %pattern_type = binding_pattern n [concrete]
37+
// CHECK:STDOUT: %n.var_patt.loc18_5: %pattern_type = var_pattern %n.patt.loc18_9 [concrete]
38+
// CHECK:STDOUT: }
39+
// CHECK:STDOUT: %n.var.loc18_5: ref %empty_tuple.type = var %n.var_patt.loc18_5
40+
// CHECK:STDOUT: %.loc18_13.1: type = splice_block %.loc18_13.3 [concrete = constants.%empty_tuple.type] {
41+
// CHECK:STDOUT: %.loc18_13.2: %empty_tuple.type = tuple_literal ()
42+
// CHECK:STDOUT: %.loc18_13.3: type = converted %.loc18_13.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
43+
// CHECK:STDOUT: }
44+
// CHECK:STDOUT: %n.loc18_9: ref %empty_tuple.type = bind_name n, %n.var.loc18_5
45+
// CHECK:STDOUT: <elided>
46+
// CHECK:STDOUT:
47+
// CHECK:STDOUT: !if.else:
48+
// CHECK:STDOUT: name_binding_decl {
49+
// CHECK:STDOUT: %n.patt.loc18_29: %pattern_type = binding_pattern n [concrete]
50+
// CHECK:STDOUT: %n.var_patt.loc18_25: %pattern_type = var_pattern %n.patt.loc18_29 [concrete]
51+
// CHECK:STDOUT: }
52+
// CHECK:STDOUT: %n.var.loc18_25: ref %empty_tuple.type = var %n.var_patt.loc18_25
53+
// CHECK:STDOUT: %.loc18_33.1: type = splice_block %.loc18_33.3 [concrete = constants.%empty_tuple.type] {
54+
// CHECK:STDOUT: %.loc18_33.2: %empty_tuple.type = tuple_literal ()
55+
// CHECK:STDOUT: %.loc18_33.3: type = converted %.loc18_33.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
56+
// CHECK:STDOUT: }
57+
// CHECK:STDOUT: %n.loc18_29: ref %empty_tuple.type = bind_name n, %n.var.loc18_25
58+
// CHECK:STDOUT: <elided>
59+
// CHECK:STDOUT:
60+
// CHECK:STDOUT: !if.done:
61+
// CHECK:STDOUT: <elided>
62+
// CHECK:STDOUT: }
63+
// CHECK:STDOUT:

toolchain/check/testdata/ir/duplicate_name_same_line.carbon

Lines changed: 0 additions & 123 deletions
This file was deleted.

0 commit comments

Comments
 (0)