mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-17 21:30:44 +00:00
This implements a direction decided in a [recent discussion](https://docs.google.com/document/d/1Iut5f2TQBrtBNIduF4vJYOKfw7MbS8xH_J01_Q4e6Rk/edit?resourcekey=0-mc_vh5UzrzXfU4kO-3tOjA&tab=t.0#heading=h.mas1g68xx9ct) to switch away from "template constant" when naming a constant that doesn't depend on any generic parameters, because that creates confusion with template-dependent constant values that depend on a template parameter.
61 lines
3.2 KiB
Plaintext
61 lines
3.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
|
|
// 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: %empty_struct_type: type = struct_type {} [concrete]
|
|
// CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [concrete] {
|
|
// CHECK:STDOUT: .x = %x
|
|
// CHECK:STDOUT: .y = %y
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %x.patt: %empty_struct_type = binding_pattern x
|
|
// CHECK:STDOUT: %.loc11_1: %empty_struct_type = var_pattern %x.patt
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %x.var: ref %empty_struct_type = var x
|
|
// CHECK:STDOUT: %.loc11_9.1: type = splice_block %.loc11_9.3 [concrete = constants.%empty_struct_type] {
|
|
// CHECK:STDOUT: %.loc11_9.2: %empty_struct_type = struct_literal ()
|
|
// CHECK:STDOUT: %.loc11_9.3: type = converted %.loc11_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %x: ref %empty_struct_type = bind_name x, %x.var
|
|
// CHECK:STDOUT: name_binding_decl {
|
|
// CHECK:STDOUT: %y.patt: %empty_struct_type = binding_pattern y
|
|
// CHECK:STDOUT: %.loc12_1: %empty_struct_type = var_pattern %y.patt
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %y.var: ref %empty_struct_type = var y
|
|
// CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_struct_type] {
|
|
// CHECK:STDOUT: %.loc12_9.2: %empty_struct_type = struct_literal ()
|
|
// CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %y: ref %empty_struct_type = bind_name y, %y.var
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc11_14.1: %empty_struct_type = struct_literal ()
|
|
// CHECK:STDOUT: %.loc11_14.2: init %empty_struct_type = struct_init () to file.%x.var [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc11_1: init %empty_struct_type = converted %.loc11_14.1, %.loc11_14.2 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: assign file.%x.var, %.loc11_1
|
|
// CHECK:STDOUT: %x.ref: ref %empty_struct_type = name_ref x, file.%x
|
|
// CHECK:STDOUT: %.loc12_13: init %empty_struct_type = struct_init () to file.%y.var [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: %.loc12_1: init %empty_struct_type = converted %x.ref, %.loc12_13 [concrete = constants.%empty_struct]
|
|
// CHECK:STDOUT: assign file.%y.var, %.loc12_1
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|