self.carbon 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 UseSelf {
  7. fn F[self: Self]() -> Self;
  8. }
  9. // CHECK:STDOUT: --- self.carbon
  10. // CHECK:STDOUT:
  11. // CHECK:STDOUT: constants {
  12. // CHECK:STDOUT: %.1: type = interface_type @UseSelf [template]
  13. // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic]
  14. // CHECK:STDOUT: %F: type = fn_type @F [template]
  15. // CHECK:STDOUT: %.2: type = tuple_type () [template]
  16. // CHECK:STDOUT: %struct: F = struct_value () [template]
  17. // CHECK:STDOUT: %.3: type = assoc_entity_type @UseSelf, F [template]
  18. // CHECK:STDOUT: %.4: <associated F in UseSelf> = assoc_entity element0, @UseSelf.%F.decl [template]
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: file {
  22. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  23. // CHECK:STDOUT: .UseSelf = %UseSelf.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %UseSelf.decl: type = interface_decl @UseSelf [template = constants.%.1] {}
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: interface @UseSelf {
  29. // CHECK:STDOUT: %Self: UseSelf = bind_symbolic_name Self 0 [symbolic = constants.%Self]
  30. // CHECK:STDOUT: %F.decl: F = fn_decl @F [template = constants.%struct] {
  31. // CHECK:STDOUT: %Self.ref.loc8_14: UseSelf = name_ref Self, %Self [symbolic = constants.%Self]
  32. // CHECK:STDOUT: %.loc8_14.1: type = facet_type_access %Self.ref.loc8_14 [symbolic = constants.%Self]
  33. // CHECK:STDOUT: %.loc8_14.2: type = converted %Self.ref.loc8_14, %.loc8_14.1 [symbolic = constants.%Self]
  34. // CHECK:STDOUT: %self.loc8_8.1: Self = param self
  35. // CHECK:STDOUT: %self.loc8_8.2: Self = bind_name self, %self.loc8_8.1
  36. // CHECK:STDOUT: %Self.ref.loc8_25: UseSelf = name_ref Self, %Self [symbolic = constants.%Self]
  37. // CHECK:STDOUT: %.loc8_25.1: type = facet_type_access %Self.ref.loc8_25 [symbolic = constants.%Self]
  38. // CHECK:STDOUT: %.loc8_25.2: type = converted %Self.ref.loc8_25, %.loc8_25.1 [symbolic = constants.%Self]
  39. // CHECK:STDOUT: %return.var: ref Self = var <return slot>
  40. // CHECK:STDOUT: }
  41. // CHECK:STDOUT: %.loc8_29: <associated F in UseSelf> = assoc_entity element0, %F.decl [template = constants.%.4]
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: !members:
  44. // CHECK:STDOUT: .Self = %Self
  45. // CHECK:STDOUT: .F = %.loc8_29
  46. // CHECK:STDOUT: witness = (%F.decl)
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT:
  49. // CHECK:STDOUT: fn @F[@UseSelf.%self.loc8_8.2: Self]() -> Self;
  50. // CHECK:STDOUT: