Files
carbon-lang/toolchain/check/testdata/struct/no_prelude/empty.carbon
T
Richard Smith 1c07f959a8 Format types in SemIR using the formatting for their instruction. (#4035)
Don't use the pretty-printed type name, because that's intended for
diagnostics, not for a theoretically machine-readable format like SemIR.

Types are always constants, so omit the leading `constant.` on the type
instruction name.
2024-06-06 15:12:48 +00:00

50 lines
2.3 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
// TIP: To test this file alone, run:
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/struct/no_prelude/empty.carbon
// TIP: To dump output, run:
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/struct/no_prelude/empty.carbon
var x: {} = {};
var y: {} = x;
// CHECK:STDOUT: --- empty.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: type = struct_type {} [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %struct: %.1 = struct_value () [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: file {
// CHECK:STDOUT: package: <namespace> = namespace [template] {
// CHECK:STDOUT: .x = %x
// CHECK:STDOUT: .y = %y
// CHECK:STDOUT: }
// CHECK:STDOUT: %.loc11_9.1: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc11_9.2: type = converted %.loc11_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %x.var: ref %.1 = var x
// CHECK:STDOUT: %x: ref %.1 = bind_name x, %x.var
// CHECK:STDOUT: %.loc12_9.1: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
// CHECK:STDOUT: %y.var: ref %.1 = var y
// CHECK:STDOUT: %y: ref %.1 = bind_name y, %y.var
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc11_14.1: %.1 = struct_literal ()
// CHECK:STDOUT: %.loc11_14.2: init %.1 = struct_init () to file.%x.var [template = constants.%struct]
// CHECK:STDOUT: %.loc11_15: init %.1 = converted %.loc11_14.1, %.loc11_14.2 [template = constants.%struct]
// CHECK:STDOUT: assign file.%x.var, %.loc11_15
// CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x
// CHECK:STDOUT: %.loc12_13: init %.1 = struct_init () to file.%y.var [template = constants.%struct]
// CHECK:STDOUT: %.loc12_14: init %.1 = converted %x.ref, %.loc12_13 [template = constants.%struct]
// CHECK:STDOUT: assign file.%y.var, %.loc12_14
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT: