alias_of_alias.carbon 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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/alias/no_prelude/alias_of_alias.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/alias/no_prelude/alias_of_alias.carbon
  10. class C {}
  11. alias a = C;
  12. alias b = a;
  13. alias c = b;
  14. let d: c = {};
  15. // CHECK:STDOUT: --- alias_of_alias.carbon
  16. // CHECK:STDOUT:
  17. // CHECK:STDOUT: constants {
  18. // CHECK:STDOUT: %C: type = class_type @C [template]
  19. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  20. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  21. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  22. // CHECK:STDOUT: }
  23. // CHECK:STDOUT:
  24. // CHECK:STDOUT: file {
  25. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  26. // CHECK:STDOUT: .C = %C.decl
  27. // CHECK:STDOUT: .a = %a
  28. // CHECK:STDOUT: .b = %b
  29. // CHECK:STDOUT: .c = %c
  30. // CHECK:STDOUT: .d = %d
  31. // CHECK:STDOUT: }
  32. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  33. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  34. // CHECK:STDOUT: %a: type = bind_alias a, %C.decl [template = constants.%C]
  35. // CHECK:STDOUT: %a.ref: type = name_ref a, %a [template = constants.%C]
  36. // CHECK:STDOUT: %b: type = bind_alias b, %a [template = constants.%C]
  37. // CHECK:STDOUT: %b.ref: type = name_ref b, %b [template = constants.%C]
  38. // CHECK:STDOUT: %c: type = bind_alias c, %b [template = constants.%C]
  39. // CHECK:STDOUT: name_binding_decl {
  40. // CHECK:STDOUT: %d.patt: %C = binding_pattern d
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %c.ref: type = name_ref c, %c [template = constants.%C]
  43. // CHECK:STDOUT: %.loc15_13.1: ref %C = temporary_storage
  44. // CHECK:STDOUT: %.loc15_13.2: init %C = class_init (), %.loc15_13.1 [template = constants.%C.val]
  45. // CHECK:STDOUT: %.loc15_13.3: ref %C = temporary %.loc15_13.1, %.loc15_13.2
  46. // CHECK:STDOUT: %.loc15_13.4: ref %C = converted @__global_init.%.loc15, %.loc15_13.3
  47. // CHECK:STDOUT: %d: ref %C = bind_name d, %.loc15_13.4
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: class @C {
  51. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  52. // CHECK:STDOUT: complete_type_witness = %complete_type
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: !members:
  55. // CHECK:STDOUT: .Self = constants.%C
  56. // CHECK:STDOUT: }
  57. // CHECK:STDOUT:
  58. // CHECK:STDOUT: fn @__global_init() {
  59. // CHECK:STDOUT: !entry:
  60. // CHECK:STDOUT: %.loc15: %empty_struct_type = struct_literal ()
  61. // CHECK:STDOUT: return
  62. // CHECK:STDOUT: }
  63. // CHECK:STDOUT: