tuple_as_element.carbon 1.5 KB

12345678910111213141516171819202122232425262728293031
  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: {.a: i32, .b: (i32,)} = {.a = 1, .b = (2,)};
  7. var y: {.a: i32, .b: (i32,)} = x;
  8. // CHECK:STDOUT: file "tuple_as_element.carbon" {
  9. // CHECK:STDOUT: %.loc7_23: type = stub_reference i32
  10. // CHECK:STDOUT: %.loc7_27.1: type = tuple_type (type)
  11. // CHECK:STDOUT: %.loc7_27.2: (type,) = tuple_literal (%.loc7_23)
  12. // CHECK:STDOUT: %.loc7_27.3: type = tuple_type (i32)
  13. // CHECK:STDOUT: %.loc7_28: type = struct_type {.a: i32, .b: (i32,)}
  14. // CHECK:STDOUT: %x: ref {.a: i32, .b: (i32,)} = var "x"
  15. // CHECK:STDOUT: %.loc7_38: i32 = int_literal 1
  16. // CHECK:STDOUT: %.loc7_36: i32 = stub_reference %.loc7_38
  17. // CHECK:STDOUT: %.loc7_47.1: i32 = int_literal 2
  18. // CHECK:STDOUT: %.loc7_47.2: i32 = stub_reference %.loc7_47.1
  19. // CHECK:STDOUT: %.loc7_49: (i32,) = tuple_literal (%.loc7_47.2)
  20. // CHECK:STDOUT: %.loc7_44: (i32,) = stub_reference %.loc7_49
  21. // CHECK:STDOUT: %.loc7_50: {.a: i32, .b: (i32,)} = struct_literal (%.loc7_36, %.loc7_44)
  22. // CHECK:STDOUT: assign %x, %.loc7_50
  23. // CHECK:STDOUT: %.loc8_23: type = stub_reference i32
  24. // CHECK:STDOUT: %.loc8_27: (type,) = tuple_literal (%.loc8_23)
  25. // CHECK:STDOUT: %.loc8_28: type = struct_type {.a: i32, .b: (i32,)}
  26. // CHECK:STDOUT: %y: ref {.a: i32, .b: (i32,)} = var "y"
  27. // CHECK:STDOUT: %.loc7_5: {.a: i32, .b: (i32,)} = bind_value %x
  28. // CHECK:STDOUT: assign %y, %.loc7_5
  29. // CHECK:STDOUT: }