nested_tuple.carbon 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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, i32), i32) = ((12, 76), 6);
  7. // CHECK:STDOUT: --- nested_tuple.carbon
  8. // CHECK:STDOUT:
  9. // CHECK:STDOUT: constants {
  10. // CHECK:STDOUT: %.1: type = tuple_type (type, type) [template]
  11. // CHECK:STDOUT: %.2: type = tuple_type ((type, type), type) [template]
  12. // CHECK:STDOUT: %.3: type = tuple_type (i32, i32) [template]
  13. // CHECK:STDOUT: %.4: type = tuple_type ((i32, i32), i32) [template]
  14. // CHECK:STDOUT: %.5: type = ptr_type (i32, i32) [template]
  15. // CHECK:STDOUT: %.6: type = tuple_type ((i32, i32)*, i32) [template]
  16. // CHECK:STDOUT: %.7: type = ptr_type ((i32, i32)*, i32) [template]
  17. // CHECK:STDOUT: %.8: i32 = int_literal 12 [template]
  18. // CHECK:STDOUT: %.9: i32 = int_literal 76 [template]
  19. // CHECK:STDOUT: %.10: i32 = int_literal 6 [template]
  20. // CHECK:STDOUT: %.11: (i32, i32) = tuple_value (%.8, %.9) [template]
  21. // CHECK:STDOUT: %.12: ((i32, i32), i32) = tuple_value (%.11, %.10) [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .x = %x
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %.loc7_18.1: (type, type) = tuple_literal (i32, i32)
  29. // CHECK:STDOUT: %.loc7_24.1: ((type, type), type) = tuple_literal (%.loc7_18.1, i32)
  30. // CHECK:STDOUT: %.loc7_18.2: type = converted %.loc7_18.1, constants.%.3 [template = constants.%.3]
  31. // CHECK:STDOUT: %.loc7_24.2: type = converted %.loc7_24.1, constants.%.4 [template = constants.%.4]
  32. // CHECK:STDOUT: %x.var: ref ((i32, i32), i32) = var x
  33. // CHECK:STDOUT: %x: ref ((i32, i32), i32) = bind_name x, %x.var
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @__global_init() {
  37. // CHECK:STDOUT: !entry:
  38. // CHECK:STDOUT: %.loc7_30: i32 = int_literal 12 [template = constants.%.8]
  39. // CHECK:STDOUT: %.loc7_34: i32 = int_literal 76 [template = constants.%.9]
  40. // CHECK:STDOUT: %.loc7_36.1: (i32, i32) = tuple_literal (%.loc7_30, %.loc7_34)
  41. // CHECK:STDOUT: %.loc7_39: i32 = int_literal 6 [template = constants.%.10]
  42. // CHECK:STDOUT: %.loc7_40.1: ((i32, i32), i32) = tuple_literal (%.loc7_36.1, %.loc7_39)
  43. // CHECK:STDOUT: %.loc7_40.2: ref (i32, i32) = tuple_access file.%x.var, element0
  44. // CHECK:STDOUT: %.loc7_36.2: ref i32 = tuple_access %.loc7_40.2, element0
  45. // CHECK:STDOUT: %.loc7_36.3: init i32 = initialize_from %.loc7_30 to %.loc7_36.2 [template = constants.%.8]
  46. // CHECK:STDOUT: %.loc7_36.4: ref i32 = tuple_access %.loc7_40.2, element1
  47. // CHECK:STDOUT: %.loc7_36.5: init i32 = initialize_from %.loc7_34 to %.loc7_36.4 [template = constants.%.9]
  48. // CHECK:STDOUT: %.loc7_36.6: init (i32, i32) = tuple_init (%.loc7_36.3, %.loc7_36.5) to %.loc7_40.2 [template = constants.%.11]
  49. // CHECK:STDOUT: %.loc7_36.7: init (i32, i32) = converted %.loc7_36.1, %.loc7_36.6 [template = constants.%.11]
  50. // CHECK:STDOUT: %.loc7_40.3: ref i32 = tuple_access file.%x.var, element1
  51. // CHECK:STDOUT: %.loc7_40.4: init i32 = initialize_from %.loc7_39 to %.loc7_40.3 [template = constants.%.10]
  52. // CHECK:STDOUT: %.loc7_40.5: init ((i32, i32), i32) = tuple_init (%.loc7_36.7, %.loc7_40.4) to file.%x.var [template = constants.%.12]
  53. // CHECK:STDOUT: %.loc7_40.6: init ((i32, i32), i32) = converted %.loc7_40.1, %.loc7_40.5 [template = constants.%.12]
  54. // CHECK:STDOUT: assign file.%x.var, %.loc7_40.6
  55. // CHECK:STDOUT: return
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT: