alias_of_alias.carbon 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. class C { var v: i32; }
  7. alias a = C;
  8. alias b = a;
  9. alias c = b;
  10. let d: c = {.v = 0};
  11. // CHECK:STDOUT: --- alias_of_alias.carbon
  12. // CHECK:STDOUT:
  13. // CHECK:STDOUT: constants {
  14. // CHECK:STDOUT: %C: type = class_type @C [template]
  15. // CHECK:STDOUT: %.1: type = unbound_element_type C, i32 [template]
  16. // CHECK:STDOUT: %.2: type = struct_type {.v: i32} [template]
  17. // CHECK:STDOUT: %.3: type = ptr_type {.v: i32} [template]
  18. // CHECK:STDOUT: %.4: i32 = int_literal 0 [template]
  19. // CHECK:STDOUT: %.5: C = struct_value (%.4) [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .Core = %Core
  25. // CHECK:STDOUT: .C = %C.decl
  26. // CHECK:STDOUT: .a = %a
  27. // CHECK:STDOUT: .b = %b
  28. // CHECK:STDOUT: .c = %c
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  31. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  32. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  33. // CHECK:STDOUT: %a: type = bind_alias a, %C.decl [template = constants.%C]
  34. // CHECK:STDOUT: %a.ref: type = name_ref a, %a [template = constants.%C]
  35. // CHECK:STDOUT: %b: type = bind_alias b, %a [template = constants.%C]
  36. // CHECK:STDOUT: %b.ref: type = name_ref b, %b [template = constants.%C]
  37. // CHECK:STDOUT: %c: type = bind_alias c, %b [template = constants.%C]
  38. // CHECK:STDOUT: %c.ref: type = name_ref c, %c [template = constants.%C]
  39. // CHECK:STDOUT: %.loc11_18: i32 = int_literal 0 [template = constants.%.4]
  40. // CHECK:STDOUT: %.loc11_19.1: {.v: i32} = struct_literal (%.loc11_18)
  41. // CHECK:STDOUT: %.loc11_19.2: ref C = temporary_storage
  42. // CHECK:STDOUT: %.loc11_19.3: ref i32 = class_element_access %.loc11_19.2, element0
  43. // CHECK:STDOUT: %.loc11_19.4: init i32 = initialize_from %.loc11_18 to %.loc11_19.3 [template = constants.%.4]
  44. // CHECK:STDOUT: %.loc11_19.5: init C = class_init (%.loc11_19.4), %.loc11_19.2 [template = constants.%.5]
  45. // CHECK:STDOUT: %.loc11_19.6: ref C = temporary %.loc11_19.2, %.loc11_19.5
  46. // CHECK:STDOUT: %.loc11_19.7: ref C = converted %.loc11_19.1, %.loc11_19.6
  47. // CHECK:STDOUT: %.loc11_19.8: C = bind_value %.loc11_19.7
  48. // CHECK:STDOUT: %d: C = bind_name d, %.loc11_19.8
  49. // CHECK:STDOUT: }
  50. // CHECK:STDOUT:
  51. // CHECK:STDOUT: class @C {
  52. // CHECK:STDOUT: %.loc7: <unbound element of class C> = field_decl v, element0 [template]
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: !members:
  55. // CHECK:STDOUT: .Self = constants.%C
  56. // CHECK:STDOUT: .v = %.loc7
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT: