Files
carbon-lang/toolchain/check/testdata/struct/member_access.carbon
T
Richard Smith 71e9fb7511 Disable raw IR printing in tests by default. (#3204)
Add a couple more tests to check/testdata/basic/ to explicitly test the
raw dump.
2023-09-07 21:11:44 +00:00

28 lines
1.1 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: package {
// 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_value (%.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: }