impl_as.carbon 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. interface Simple {
  7. fn F();
  8. }
  9. class C {
  10. impl as Simple {
  11. fn F() {}
  12. }
  13. }
  14. // CHECK:STDOUT: --- impl_as.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %.1: type = interface_type @Simple [template]
  18. // CHECK:STDOUT: %.2: type = assoc_entity_type @Simple, <function> [template]
  19. // CHECK:STDOUT: %.3: <associated <function> in Simple> = assoc_entity element0, @Simple.%F [template]
  20. // CHECK:STDOUT: %C: type = class_type @C [template]
  21. // CHECK:STDOUT: %.4: <witness> = interface_witness @Simple, (@impl.%F) [template]
  22. // CHECK:STDOUT: %.5: type = struct_type {} [template]
  23. // CHECK:STDOUT: }
  24. // CHECK:STDOUT:
  25. // CHECK:STDOUT: file {
  26. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  27. // CHECK:STDOUT: .Simple = %Simple.decl
  28. // CHECK:STDOUT: .C = %C.decl
  29. // CHECK:STDOUT: }
  30. // CHECK:STDOUT: %Simple.decl: type = interface_decl @Simple [template = constants.%.1] {}
  31. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {}
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: interface @Simple {
  35. // CHECK:STDOUT: %Self: Simple = bind_symbolic_name Self [symbolic]
  36. // CHECK:STDOUT: %F: <function> = fn_decl @F.1 [template] {}
  37. // CHECK:STDOUT: %.loc8: <associated <function> in Simple> = assoc_entity element0, %F [template = constants.%.3]
  38. // CHECK:STDOUT:
  39. // CHECK:STDOUT: !members:
  40. // CHECK:STDOUT: .Self = %Self
  41. // CHECK:STDOUT: .F = %.loc8
  42. // CHECK:STDOUT: witness = (%F)
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: impl @impl: C as Simple {
  46. // CHECK:STDOUT: %F: <function> = fn_decl @F.2 [template] {}
  47. // CHECK:STDOUT: %.1: <witness> = interface_witness @Simple, (%F) [template = constants.%.4]
  48. // CHECK:STDOUT:
  49. // CHECK:STDOUT: !members:
  50. // CHECK:STDOUT: .F = %F
  51. // CHECK:STDOUT: witness = %.1
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: class @C {
  55. // CHECK:STDOUT: impl_decl @impl {
  56. // CHECK:STDOUT: %Simple.ref: type = name_ref Simple, file.%Simple.decl [template = constants.%.1]
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: !members:
  60. // CHECK:STDOUT: .Self = constants.%C
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: fn @F.1();
  64. // CHECK:STDOUT:
  65. // CHECK:STDOUT: fn @F.2() {
  66. // CHECK:STDOUT: !entry:
  67. // CHECK:STDOUT: return
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT: