Files
carbon-lang/toolchain/check/testdata/struct/member_access.carbon
T
Jon Ross-Perkins 9ae41b2965 Update SemIR yaml and text for multi-file. (#3217)
Building on #3214 and #3215, updates sem_ir yaml to be:

```
- filename: name
  sem_ir: [ ... ]
```

Also, changes the textual format from `package { ... }` to `file
<filename> { ... }`. My thought on packages there is:

```
file "foo.carbon" {
  package MyPackage

  ...
}
```

The reason for putting the file first is that it's easier if we put what
we're grouping on first, whereas the package is an "annotation" on the
file.
2023-09-13 17:08:18 +00:00

28 lines
1.2 KiB
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
var x: {.a: f64, .b: i32} = {.a = 0.0, .b = 1};
var y: i32 = x.b;
var z: i32 = y;
// CHECK:STDOUT: file "member_access.carbon" {
// CHECK:STDOUT: %.loc7_25: type = struct_type {.a: f64, .b: i32}
// CHECK:STDOUT: %x: ref {.a: f64, .b: i32} = var "x"
// CHECK:STDOUT: %.loc7_35: f64 = real_literal 0e-1
// CHECK:STDOUT: %.loc7_33: f64 = stub_reference %.loc7_35
// CHECK:STDOUT: %.loc7_45: i32 = int_literal 1
// CHECK:STDOUT: %.loc7_43: i32 = stub_reference %.loc7_45
// CHECK:STDOUT: %.loc7_46: {.a: f64, .b: i32} = struct_literal (%.loc7_33, %.loc7_43)
// CHECK:STDOUT: assign %x, %.loc7_46
// CHECK:STDOUT: %y: ref i32 = var "y"
// CHECK:STDOUT: %.loc8_15.1: ref i32 = struct_access %x, member1
// CHECK:STDOUT: %.loc8_15.2: i32 = bind_value %.loc8_15.1
// CHECK:STDOUT: assign %y, %.loc8_15.2
// CHECK:STDOUT: %z: ref i32 = var "z"
// CHECK:STDOUT: %.loc8_5: i32 = bind_value %y
// CHECK:STDOUT: assign %z, %.loc8_5
// CHECK:STDOUT: }