empty.carbon 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/tuple/no_prelude/empty.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/tuple/no_prelude/empty.carbon
  10. var x: () = ();
  11. var y: () = x;
  12. // CHECK:STDOUT: --- empty.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  16. // CHECK:STDOUT: %tuple: %.1 = tuple_value () [template]
  17. // CHECK:STDOUT: }
  18. // CHECK:STDOUT:
  19. // CHECK:STDOUT: file {
  20. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  21. // CHECK:STDOUT: .x = %x
  22. // CHECK:STDOUT: .y = %y
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT: %.loc11_9.1: %.1 = tuple_literal ()
  25. // CHECK:STDOUT: %.loc11_9.2: type = converted %.loc11_9.1, constants.%.1 [template = constants.%.1]
  26. // CHECK:STDOUT: %x.var: ref %.1 = var x
  27. // CHECK:STDOUT: %x: ref %.1 = bind_name x, %x.var
  28. // CHECK:STDOUT: %.loc12_9.1: %.1 = tuple_literal ()
  29. // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
  30. // CHECK:STDOUT: %y.var: ref %.1 = var y
  31. // CHECK:STDOUT: %y: ref %.1 = bind_name y, %y.var
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: fn @__global_init() {
  35. // CHECK:STDOUT: !entry:
  36. // CHECK:STDOUT: %.loc11_14.1: %.1 = tuple_literal ()
  37. // CHECK:STDOUT: %.loc11_14.2: init %.1 = tuple_init () to file.%x.var [template = constants.%tuple]
  38. // CHECK:STDOUT: %.loc11_15: init %.1 = converted %.loc11_14.1, %.loc11_14.2 [template = constants.%tuple]
  39. // CHECK:STDOUT: assign file.%x.var, %.loc11_15
  40. // CHECK:STDOUT: %x.ref: ref %.1 = name_ref x, file.%x
  41. // CHECK:STDOUT: %.loc12_13: init %.1 = tuple_init () to file.%y.var [template = constants.%tuple]
  42. // CHECK:STDOUT: %.loc12_14: init %.1 = converted %x.ref, %.loc12_13 [template = constants.%tuple]
  43. // CHECK:STDOUT: assign file.%y.var, %.loc12_14
  44. // CHECK:STDOUT: return
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: