one_element.carbon 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. var x: (i32,) = (4,);
  7. var y: (i32,) = x;
  8. // CHECK:STDOUT: --- one_element.carbon
  9. // CHECK:STDOUT:
  10. // CHECK:STDOUT: constants {
  11. // CHECK:STDOUT: %.1: type = tuple_type (type) [template]
  12. // CHECK:STDOUT: %.2: type = tuple_type (i32) [template]
  13. // CHECK:STDOUT: %.3: i32 = int_literal 4 [template]
  14. // CHECK:STDOUT: %.4: (i32,) = tuple_value (%.3) [template]
  15. // CHECK:STDOUT: }
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: file {
  18. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  19. // CHECK:STDOUT: .x = %x
  20. // CHECK:STDOUT: .y = %y
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT: %.loc7_13.1: (type,) = tuple_literal (i32)
  23. // CHECK:STDOUT: %.loc7_13.2: type = converted %.loc7_13.1, constants.%.2 [template = constants.%.2]
  24. // CHECK:STDOUT: %x.var: ref (i32,) = var x
  25. // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var
  26. // CHECK:STDOUT: %.loc8_13.1: (type,) = tuple_literal (i32)
  27. // CHECK:STDOUT: %.loc8_13.2: type = converted %.loc8_13.1, constants.%.2 [template = constants.%.2]
  28. // CHECK:STDOUT: %y.var: ref (i32,) = var y
  29. // CHECK:STDOUT: %y: ref (i32,) = bind_name y, %y.var
  30. // CHECK:STDOUT: }
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: fn @__global_init() {
  33. // CHECK:STDOUT: !entry:
  34. // CHECK:STDOUT: %.loc7_18: i32 = int_literal 4 [template = constants.%.3]
  35. // CHECK:STDOUT: %.loc7_20.1: (i32,) = tuple_literal (%.loc7_18)
  36. // CHECK:STDOUT: %.loc7_20.2: init (i32,) = tuple_init (%.loc7_18) to file.%x.var [template = constants.%.4]
  37. // CHECK:STDOUT: %.loc7_20.3: init (i32,) = converted %.loc7_20.1, %.loc7_20.2 [template = constants.%.4]
  38. // CHECK:STDOUT: assign file.%x.var, %.loc7_20.3
  39. // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, file.%x
  40. // CHECK:STDOUT: %.loc8_17.1: ref i32 = tuple_access %x.ref, element0
  41. // CHECK:STDOUT: %.loc8_17.2: i32 = bind_value %.loc8_17.1
  42. // CHECK:STDOUT: %.loc8_17.3: init (i32,) = tuple_init (%.loc8_17.2) to file.%y.var
  43. // CHECK:STDOUT: %.loc8_17.4: init (i32,) = converted %x.ref, %.loc8_17.3
  44. // CHECK:STDOUT: assign file.%y.var, %.loc8_17.4
  45. // CHECK:STDOUT: return
  46. // CHECK:STDOUT: }
  47. // CHECK:STDOUT: