self_in_signature.carbon 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/self_in_signature.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/self_in_signature.carbon
  14. interface UseSelf {
  15. fn F[self: Self](x: Self) -> Self;
  16. }
  17. class C {}
  18. class D {}
  19. impl C as UseSelf {
  20. fn F[self: C](x: C) -> C { return {}; }
  21. }
  22. impl D as UseSelf {
  23. fn F[self: Self](x: Self) -> Self { return {}; }
  24. }
  25. interface SelfNested {
  26. fn F(x: (Self*, {.x: Self, .y: ()}));
  27. }
  28. impl C as SelfNested {
  29. fn F(x: (C*, {.x: C, .y: ()}));
  30. }
  31. impl D as SelfNested {
  32. fn F(x: (Self*, {.x: Self, .y: ()}));
  33. }
  34. // CHECK:STDOUT: --- self_in_signature.carbon
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: constants {
  37. // CHECK:STDOUT: %UseSelf.type: type = facet_type <@UseSelf> [concrete]
  38. // CHECK:STDOUT: %Self.085: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic]
  39. // CHECK:STDOUT: %Self.as_type.599: type = facet_access_type %Self.085 [symbolic]
  40. // CHECK:STDOUT: %pattern_type.3ef: type = pattern_type %Self.as_type.599 [symbolic]
  41. // CHECK:STDOUT: %UseSelf.F.type: type = fn_type @UseSelf.F [concrete]
  42. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  43. // CHECK:STDOUT: %UseSelf.F: %UseSelf.F.type = struct_value () [concrete]
  44. // CHECK:STDOUT: %UseSelf.assoc_type: type = assoc_entity_type @UseSelf [concrete]
  45. // CHECK:STDOUT: %assoc0.24c: %UseSelf.assoc_type = assoc_entity element0, @UseSelf.%UseSelf.F.decl [concrete]
  46. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  47. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  48. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  49. // CHECK:STDOUT: %D: type = class_type @D [concrete]
  50. // CHECK:STDOUT: %UseSelf.impl_witness.b25: <witness> = impl_witness file.%UseSelf.impl_witness_table.loc23 [concrete]
  51. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  52. // CHECK:STDOUT: %C.as.UseSelf.impl.F.type: type = fn_type @C.as.UseSelf.impl.F [concrete]
  53. // CHECK:STDOUT: %C.as.UseSelf.impl.F: %C.as.UseSelf.impl.F.type = struct_value () [concrete]
  54. // CHECK:STDOUT: %UseSelf.facet.727: %UseSelf.type = facet_value %C, (%UseSelf.impl_witness.b25) [concrete]
  55. // CHECK:STDOUT: %C.val: %C = struct_value () [concrete]
  56. // CHECK:STDOUT: %UseSelf.impl_witness.f90: <witness> = impl_witness file.%UseSelf.impl_witness_table.loc27 [concrete]
  57. // CHECK:STDOUT: %pattern_type.510: type = pattern_type %D [concrete]
  58. // CHECK:STDOUT: %D.as.UseSelf.impl.F.type: type = fn_type @D.as.UseSelf.impl.F [concrete]
  59. // CHECK:STDOUT: %D.as.UseSelf.impl.F: %D.as.UseSelf.impl.F.type = struct_value () [concrete]
  60. // CHECK:STDOUT: %UseSelf.facet.d11: %UseSelf.type = facet_value %D, (%UseSelf.impl_witness.f90) [concrete]
  61. // CHECK:STDOUT: %D.val: %D = struct_value () [concrete]
  62. // CHECK:STDOUT: %SelfNested.type: type = facet_type <@SelfNested> [concrete]
  63. // CHECK:STDOUT: %Self.2ff: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic]
  64. // CHECK:STDOUT: %Self.as_type.e1e: type = facet_access_type %Self.2ff [symbolic]
  65. // CHECK:STDOUT: %ptr.e87: type = ptr_type %Self.as_type.e1e [symbolic]
  66. // CHECK:STDOUT: %struct_type.x.y.270: type = struct_type {.x: %Self.as_type.e1e, .y: %empty_tuple.type} [symbolic]
  67. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [concrete]
  68. // CHECK:STDOUT: %tuple.type.46b: type = tuple_type (%ptr.e87, %struct_type.x.y.270) [symbolic]
  69. // CHECK:STDOUT: %pattern_type.5a1: type = pattern_type %tuple.type.46b [symbolic]
  70. // CHECK:STDOUT: %SelfNested.F.type: type = fn_type @SelfNested.F [concrete]
  71. // CHECK:STDOUT: %SelfNested.F: %SelfNested.F.type = struct_value () [concrete]
  72. // CHECK:STDOUT: %SelfNested.assoc_type: type = assoc_entity_type @SelfNested [concrete]
  73. // CHECK:STDOUT: %assoc0.beb: %SelfNested.assoc_type = assoc_entity element0, @SelfNested.%SelfNested.F.decl [concrete]
  74. // CHECK:STDOUT: %SelfNested.impl_witness.5d5: <witness> = impl_witness file.%SelfNested.impl_witness_table.loc35 [concrete]
  75. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  76. // CHECK:STDOUT: %struct_type.x.y.2f0: type = struct_type {.x: %C, .y: %empty_tuple.type} [concrete]
  77. // CHECK:STDOUT: %tuple.type.a17: type = tuple_type (%ptr.019, %struct_type.x.y.2f0) [concrete]
  78. // CHECK:STDOUT: %pattern_type.809: type = pattern_type %tuple.type.a17 [concrete]
  79. // CHECK:STDOUT: %C.as.SelfNested.impl.F.type: type = fn_type @C.as.SelfNested.impl.F [concrete]
  80. // CHECK:STDOUT: %C.as.SelfNested.impl.F: %C.as.SelfNested.impl.F.type = struct_value () [concrete]
  81. // CHECK:STDOUT: %SelfNested.facet.2b2: %SelfNested.type = facet_value %C, (%SelfNested.impl_witness.5d5) [concrete]
  82. // CHECK:STDOUT: %SelfNested.impl_witness.16b: <witness> = impl_witness file.%SelfNested.impl_witness_table.loc39 [concrete]
  83. // CHECK:STDOUT: %ptr.19c: type = ptr_type %D [concrete]
  84. // CHECK:STDOUT: %struct_type.x.y.527: type = struct_type {.x: %D, .y: %empty_tuple.type} [concrete]
  85. // CHECK:STDOUT: %tuple.type.a5f: type = tuple_type (%ptr.19c, %struct_type.x.y.527) [concrete]
  86. // CHECK:STDOUT: %pattern_type.b43: type = pattern_type %tuple.type.a5f [concrete]
  87. // CHECK:STDOUT: %D.as.SelfNested.impl.F.type: type = fn_type @D.as.SelfNested.impl.F [concrete]
  88. // CHECK:STDOUT: %D.as.SelfNested.impl.F: %D.as.SelfNested.impl.F.type = struct_value () [concrete]
  89. // CHECK:STDOUT: %SelfNested.facet.f2c: %SelfNested.type = facet_value %D, (%SelfNested.impl_witness.16b) [concrete]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: file {
  93. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  94. // CHECK:STDOUT: .UseSelf = %UseSelf.decl
  95. // CHECK:STDOUT: .C = %C.decl
  96. // CHECK:STDOUT: .D = %D.decl
  97. // CHECK:STDOUT: .SelfNested = %SelfNested.decl
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT: %UseSelf.decl: type = interface_decl @UseSelf [concrete = constants.%UseSelf.type] {} {}
  100. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  101. // CHECK:STDOUT: %D.decl: type = class_decl @D [concrete = constants.%D] {} {}
  102. // CHECK:STDOUT: impl_decl @C.as.UseSelf.impl [concrete] {} {
  103. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  104. // CHECK:STDOUT: %UseSelf.ref: type = name_ref UseSelf, file.%UseSelf.decl [concrete = constants.%UseSelf.type]
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT: %UseSelf.impl_witness_table.loc23 = impl_witness_table (@C.as.UseSelf.impl.%C.as.UseSelf.impl.F.decl), @C.as.UseSelf.impl [concrete]
  107. // CHECK:STDOUT: %UseSelf.impl_witness.loc23: <witness> = impl_witness %UseSelf.impl_witness_table.loc23 [concrete = constants.%UseSelf.impl_witness.b25]
  108. // CHECK:STDOUT: impl_decl @D.as.UseSelf.impl [concrete] {} {
  109. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  110. // CHECK:STDOUT: %UseSelf.ref: type = name_ref UseSelf, file.%UseSelf.decl [concrete = constants.%UseSelf.type]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %UseSelf.impl_witness_table.loc27 = impl_witness_table (@D.as.UseSelf.impl.%D.as.UseSelf.impl.F.decl), @D.as.UseSelf.impl [concrete]
  113. // CHECK:STDOUT: %UseSelf.impl_witness.loc27: <witness> = impl_witness %UseSelf.impl_witness_table.loc27 [concrete = constants.%UseSelf.impl_witness.f90]
  114. // CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [concrete = constants.%SelfNested.type] {} {}
  115. // CHECK:STDOUT: impl_decl @C.as.SelfNested.impl [concrete] {} {
  116. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  117. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT: %SelfNested.impl_witness_table.loc35 = impl_witness_table (@C.as.SelfNested.impl.%C.as.SelfNested.impl.F.decl), @C.as.SelfNested.impl [concrete]
  120. // CHECK:STDOUT: %SelfNested.impl_witness.loc35: <witness> = impl_witness %SelfNested.impl_witness_table.loc35 [concrete = constants.%SelfNested.impl_witness.5d5]
  121. // CHECK:STDOUT: impl_decl @D.as.SelfNested.impl [concrete] {} {
  122. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [concrete = constants.%D]
  123. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [concrete = constants.%SelfNested.type]
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT: %SelfNested.impl_witness_table.loc39 = impl_witness_table (@D.as.SelfNested.impl.%D.as.SelfNested.impl.F.decl), @D.as.SelfNested.impl [concrete]
  126. // CHECK:STDOUT: %SelfNested.impl_witness.loc39: <witness> = impl_witness %SelfNested.impl_witness_table.loc39 [concrete = constants.%SelfNested.impl_witness.16b]
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: interface @UseSelf {
  130. // CHECK:STDOUT: %Self: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.085]
  131. // CHECK:STDOUT: %UseSelf.F.decl: %UseSelf.F.type = fn_decl @UseSelf.F [concrete = constants.%UseSelf.F] {
  132. // CHECK:STDOUT: %self.patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = binding_pattern self [concrete]
  133. // CHECK:STDOUT: %self.param_patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = value_param_pattern %self.patt, call_param0 [concrete]
  134. // CHECK:STDOUT: %x.patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = binding_pattern x [concrete]
  135. // CHECK:STDOUT: %x.param_patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = value_param_pattern %x.patt, call_param1 [concrete]
  136. // CHECK:STDOUT: %return.patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = return_slot_pattern [concrete]
  137. // CHECK:STDOUT: %return.param_patt: @UseSelf.F.%pattern_type (%pattern_type.3ef) = out_param_pattern %return.patt, call_param2 [concrete]
  138. // CHECK:STDOUT: } {
  139. // CHECK:STDOUT: %Self.ref.loc16_32: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.085)]
  140. // CHECK:STDOUT: %Self.as_type.loc16_32: type = facet_access_type %Self.ref.loc16_32 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  141. // CHECK:STDOUT: %.loc16_32: type = converted %Self.ref.loc16_32, %Self.as_type.loc16_32 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  142. // CHECK:STDOUT: %self.param: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = value_param call_param0
  143. // CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)] {
  144. // CHECK:STDOUT: %Self.ref.loc16_14: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.085)]
  145. // CHECK:STDOUT: %Self.as_type.loc16_14.2: type = facet_access_type %Self.ref.loc16_14 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  146. // CHECK:STDOUT: %.loc16_14.2: type = converted %Self.ref.loc16_14, %Self.as_type.loc16_14.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %self: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = bind_name self, %self.param
  149. // CHECK:STDOUT: %x.param: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = value_param call_param1
  150. // CHECK:STDOUT: %.loc16_23.1: type = splice_block %.loc16_23.2 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)] {
  151. // CHECK:STDOUT: %Self.ref.loc16_23: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.085)]
  152. // CHECK:STDOUT: %Self.as_type.loc16_23: type = facet_access_type %Self.ref.loc16_23 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  153. // CHECK:STDOUT: %.loc16_23.2: type = converted %Self.ref.loc16_23, %Self.as_type.loc16_23 [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT: %x: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = bind_name x, %x.param
  156. // CHECK:STDOUT: %return.param: ref @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = out_param call_param2
  157. // CHECK:STDOUT: %return: ref @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599) = return_slot %return.param
  158. // CHECK:STDOUT: }
  159. // CHECK:STDOUT: %assoc0: %UseSelf.assoc_type = assoc_entity element0, %UseSelf.F.decl [concrete = constants.%assoc0.24c]
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: !members:
  162. // CHECK:STDOUT: .Self = %Self
  163. // CHECK:STDOUT: .F = %assoc0
  164. // CHECK:STDOUT: witness = (%UseSelf.F.decl)
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: interface @SelfNested {
  168. // CHECK:STDOUT: %Self: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2ff]
  169. // CHECK:STDOUT: %SelfNested.F.decl: %SelfNested.F.type = fn_decl @SelfNested.F [concrete = constants.%SelfNested.F] {
  170. // CHECK:STDOUT: %x.patt: @SelfNested.F.%pattern_type (%pattern_type.5a1) = binding_pattern x [concrete]
  171. // CHECK:STDOUT: %x.param_patt: @SelfNested.F.%pattern_type (%pattern_type.5a1) = value_param_pattern %x.patt, call_param0 [concrete]
  172. // CHECK:STDOUT: } {
  173. // CHECK:STDOUT: %x.param: @SelfNested.F.%tuple.type (%tuple.type.46b) = value_param call_param0
  174. // CHECK:STDOUT: %.loc32_37.1: type = splice_block %.loc32_37.3 [symbolic = %tuple.type (constants.%tuple.type.46b)] {
  175. // CHECK:STDOUT: %Self.ref.loc32_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.2ff)]
  176. // CHECK:STDOUT: %Self.as_type.loc32_16.2: type = facet_access_type %Self.ref.loc32_12 [symbolic = %Self.as_type.loc32_16.1 (constants.%Self.as_type.e1e)]
  177. // CHECK:STDOUT: %.loc32_16: type = converted %Self.ref.loc32_12, %Self.as_type.loc32_16.2 [symbolic = %Self.as_type.loc32_16.1 (constants.%Self.as_type.e1e)]
  178. // CHECK:STDOUT: %ptr.loc32_16.2: type = ptr_type %.loc32_16 [symbolic = %ptr.loc32_16.1 (constants.%ptr.e87)]
  179. // CHECK:STDOUT: %Self.ref.loc32_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.2ff)]
  180. // CHECK:STDOUT: %Self.as_type.loc32_24: type = facet_access_type %Self.ref.loc32_24 [symbolic = %Self.as_type.loc32_16.1 (constants.%Self.as_type.e1e)]
  181. // CHECK:STDOUT: %.loc32_24: type = converted %Self.ref.loc32_24, %Self.as_type.loc32_24 [symbolic = %Self.as_type.loc32_16.1 (constants.%Self.as_type.e1e)]
  182. // CHECK:STDOUT: %.loc32_35.1: %empty_tuple.type = tuple_literal ()
  183. // CHECK:STDOUT: %.loc32_35.2: type = converted %.loc32_35.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  184. // CHECK:STDOUT: %struct_type.x.y.loc32_36.2: type = struct_type {.x: @SelfNested.F.%Self.as_type.loc32_16.1 (%Self.as_type.e1e), .y: %empty_tuple.type} [symbolic = %struct_type.x.y.loc32_36.1 (constants.%struct_type.x.y.270)]
  185. // CHECK:STDOUT: %.loc32_37.2: %tuple.type.24b = tuple_literal (%ptr.loc32_16.2, %struct_type.x.y.loc32_36.2)
  186. // CHECK:STDOUT: %.loc32_37.3: type = converted %.loc32_37.2, constants.%tuple.type.46b [symbolic = %tuple.type (constants.%tuple.type.46b)]
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %x: @SelfNested.F.%tuple.type (%tuple.type.46b) = bind_name x, %x.param
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT: %assoc0: %SelfNested.assoc_type = assoc_entity element0, %SelfNested.F.decl [concrete = constants.%assoc0.beb]
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: !members:
  193. // CHECK:STDOUT: .Self = %Self
  194. // CHECK:STDOUT: .F = %assoc0
  195. // CHECK:STDOUT: witness = (%SelfNested.F.decl)
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: impl @C.as.UseSelf.impl: %C.ref as %UseSelf.ref {
  199. // CHECK:STDOUT: %C.as.UseSelf.impl.F.decl: %C.as.UseSelf.impl.F.type = fn_decl @C.as.UseSelf.impl.F [concrete = constants.%C.as.UseSelf.impl.F] {
  200. // CHECK:STDOUT: %self.patt: %pattern_type.c48 = binding_pattern self [concrete]
  201. // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = value_param_pattern %self.patt, call_param0 [concrete]
  202. // CHECK:STDOUT: %x.patt: %pattern_type.c48 = binding_pattern x [concrete]
  203. // CHECK:STDOUT: %x.param_patt: %pattern_type.c48 = value_param_pattern %x.patt, call_param1 [concrete]
  204. // CHECK:STDOUT: %return.patt: %pattern_type.c48 = return_slot_pattern [concrete]
  205. // CHECK:STDOUT: %return.param_patt: %pattern_type.c48 = out_param_pattern %return.patt, call_param2 [concrete]
  206. // CHECK:STDOUT: } {
  207. // CHECK:STDOUT: %C.ref.loc24_26: type = name_ref C, file.%C.decl [concrete = constants.%C]
  208. // CHECK:STDOUT: %self.param: %C = value_param call_param0
  209. // CHECK:STDOUT: %C.ref.loc24_14: type = name_ref C, file.%C.decl [concrete = constants.%C]
  210. // CHECK:STDOUT: %self: %C = bind_name self, %self.param
  211. // CHECK:STDOUT: %x.param: %C = value_param call_param1
  212. // CHECK:STDOUT: %C.ref.loc24_20: type = name_ref C, file.%C.decl [concrete = constants.%C]
  213. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  214. // CHECK:STDOUT: %return.param: ref %C = out_param call_param2
  215. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: !members:
  219. // CHECK:STDOUT: .C = <poisoned>
  220. // CHECK:STDOUT: .F = %C.as.UseSelf.impl.F.decl
  221. // CHECK:STDOUT: witness = file.%UseSelf.impl_witness.loc23
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: impl @D.as.UseSelf.impl: %D.ref as %UseSelf.ref {
  225. // CHECK:STDOUT: %D.as.UseSelf.impl.F.decl: %D.as.UseSelf.impl.F.type = fn_decl @D.as.UseSelf.impl.F [concrete = constants.%D.as.UseSelf.impl.F] {
  226. // CHECK:STDOUT: %self.patt: %pattern_type.510 = binding_pattern self [concrete]
  227. // CHECK:STDOUT: %self.param_patt: %pattern_type.510 = value_param_pattern %self.patt, call_param0 [concrete]
  228. // CHECK:STDOUT: %x.patt: %pattern_type.510 = binding_pattern x [concrete]
  229. // CHECK:STDOUT: %x.param_patt: %pattern_type.510 = value_param_pattern %x.patt, call_param1 [concrete]
  230. // CHECK:STDOUT: %return.patt: %pattern_type.510 = return_slot_pattern [concrete]
  231. // CHECK:STDOUT: %return.param_patt: %pattern_type.510 = out_param_pattern %return.patt, call_param2 [concrete]
  232. // CHECK:STDOUT: } {
  233. // CHECK:STDOUT: %Self.ref.loc28_32: type = name_ref Self, @D.as.UseSelf.impl.%D.ref [concrete = constants.%D]
  234. // CHECK:STDOUT: %self.param: %D = value_param call_param0
  235. // CHECK:STDOUT: %Self.ref.loc28_14: type = name_ref Self, @D.as.UseSelf.impl.%D.ref [concrete = constants.%D]
  236. // CHECK:STDOUT: %self: %D = bind_name self, %self.param
  237. // CHECK:STDOUT: %x.param: %D = value_param call_param1
  238. // CHECK:STDOUT: %Self.ref.loc28_23: type = name_ref Self, @D.as.UseSelf.impl.%D.ref [concrete = constants.%D]
  239. // CHECK:STDOUT: %x: %D = bind_name x, %x.param
  240. // CHECK:STDOUT: %return.param: ref %D = out_param call_param2
  241. // CHECK:STDOUT: %return: ref %D = return_slot %return.param
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: !members:
  245. // CHECK:STDOUT: .F = %D.as.UseSelf.impl.F.decl
  246. // CHECK:STDOUT: witness = file.%UseSelf.impl_witness.loc27
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: impl @C.as.SelfNested.impl: %C.ref as %SelfNested.ref {
  250. // CHECK:STDOUT: %C.as.SelfNested.impl.F.decl: %C.as.SelfNested.impl.F.type = fn_decl @C.as.SelfNested.impl.F [concrete = constants.%C.as.SelfNested.impl.F] {
  251. // CHECK:STDOUT: %x.patt: %pattern_type.809 = binding_pattern x [concrete]
  252. // CHECK:STDOUT: %x.param_patt: %pattern_type.809 = value_param_pattern %x.patt, call_param0 [concrete]
  253. // CHECK:STDOUT: } {
  254. // CHECK:STDOUT: %x.param: %tuple.type.a17 = value_param call_param0
  255. // CHECK:STDOUT: %.loc36_31.1: type = splice_block %.loc36_31.3 [concrete = constants.%tuple.type.a17] {
  256. // CHECK:STDOUT: %C.ref.loc36_12: type = name_ref C, file.%C.decl [concrete = constants.%C]
  257. // CHECK:STDOUT: %ptr: type = ptr_type %C.ref.loc36_12 [concrete = constants.%ptr.019]
  258. // CHECK:STDOUT: %C.ref.loc36_21: type = name_ref C, file.%C.decl [concrete = constants.%C]
  259. // CHECK:STDOUT: %.loc36_29.1: %empty_tuple.type = tuple_literal ()
  260. // CHECK:STDOUT: %.loc36_29.2: type = converted %.loc36_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  261. // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %C, .y: %empty_tuple.type} [concrete = constants.%struct_type.x.y.2f0]
  262. // CHECK:STDOUT: %.loc36_31.2: %tuple.type.24b = tuple_literal (%ptr, %struct_type.x.y)
  263. // CHECK:STDOUT: %.loc36_31.3: type = converted %.loc36_31.2, constants.%tuple.type.a17 [concrete = constants.%tuple.type.a17]
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %x: %tuple.type.a17 = bind_name x, %x.param
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: !members:
  269. // CHECK:STDOUT: .C = <poisoned>
  270. // CHECK:STDOUT: .F = %C.as.SelfNested.impl.F.decl
  271. // CHECK:STDOUT: witness = file.%SelfNested.impl_witness.loc35
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: impl @D.as.SelfNested.impl: %D.ref as %SelfNested.ref {
  275. // CHECK:STDOUT: %D.as.SelfNested.impl.F.decl: %D.as.SelfNested.impl.F.type = fn_decl @D.as.SelfNested.impl.F [concrete = constants.%D.as.SelfNested.impl.F] {
  276. // CHECK:STDOUT: %x.patt: %pattern_type.b43 = binding_pattern x [concrete]
  277. // CHECK:STDOUT: %x.param_patt: %pattern_type.b43 = value_param_pattern %x.patt, call_param0 [concrete]
  278. // CHECK:STDOUT: } {
  279. // CHECK:STDOUT: %x.param: %tuple.type.a5f = value_param call_param0
  280. // CHECK:STDOUT: %.loc40_37.1: type = splice_block %.loc40_37.3 [concrete = constants.%tuple.type.a5f] {
  281. // CHECK:STDOUT: %Self.ref.loc40_12: type = name_ref Self, @D.as.SelfNested.impl.%D.ref [concrete = constants.%D]
  282. // CHECK:STDOUT: %ptr: type = ptr_type %Self.ref.loc40_12 [concrete = constants.%ptr.19c]
  283. // CHECK:STDOUT: %Self.ref.loc40_24: type = name_ref Self, @D.as.SelfNested.impl.%D.ref [concrete = constants.%D]
  284. // CHECK:STDOUT: %.loc40_35.1: %empty_tuple.type = tuple_literal ()
  285. // CHECK:STDOUT: %.loc40_35.2: type = converted %.loc40_35.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  286. // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %D, .y: %empty_tuple.type} [concrete = constants.%struct_type.x.y.527]
  287. // CHECK:STDOUT: %.loc40_37.2: %tuple.type.24b = tuple_literal (%ptr, %struct_type.x.y)
  288. // CHECK:STDOUT: %.loc40_37.3: type = converted %.loc40_37.2, constants.%tuple.type.a5f [concrete = constants.%tuple.type.a5f]
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: %x: %tuple.type.a5f = bind_name x, %x.param
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: !members:
  294. // CHECK:STDOUT: .F = %D.as.SelfNested.impl.F.decl
  295. // CHECK:STDOUT: witness = file.%SelfNested.impl_witness.loc39
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: class @C {
  299. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  300. // CHECK:STDOUT: complete_type_witness = %complete_type
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: !members:
  303. // CHECK:STDOUT: .Self = constants.%C
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: class @D {
  307. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  308. // CHECK:STDOUT: complete_type_witness = %complete_type
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: !members:
  311. // CHECK:STDOUT: .Self = constants.%D
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: generic fn @UseSelf.F(@UseSelf.%Self: %UseSelf.type) {
  315. // CHECK:STDOUT: %Self: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.085)]
  316. // CHECK:STDOUT: %Self.as_type.loc16_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc16_14.1 (constants.%Self.as_type.599)]
  317. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc16_14.1 [symbolic = %pattern_type (constants.%pattern_type.3ef)]
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: fn(%self.param: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599), %x.param: @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599)) -> @UseSelf.F.%Self.as_type.loc16_14.1 (%Self.as_type.599);
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: fn @C.as.UseSelf.impl.F(%self.param: %C, %x.param: %C) -> %return.param: %C {
  323. // CHECK:STDOUT: !entry:
  324. // CHECK:STDOUT: %.loc24_38.1: %empty_struct_type = struct_literal ()
  325. // CHECK:STDOUT: %.loc24_38.2: init %C = class_init (), %return [concrete = constants.%C.val]
  326. // CHECK:STDOUT: %.loc24_39: init %C = converted %.loc24_38.1, %.loc24_38.2 [concrete = constants.%C.val]
  327. // CHECK:STDOUT: return %.loc24_39 to %return
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: fn @D.as.UseSelf.impl.F(%self.param: %D, %x.param: %D) -> %return.param: %D {
  331. // CHECK:STDOUT: !entry:
  332. // CHECK:STDOUT: %.loc28_47.1: %empty_struct_type = struct_literal ()
  333. // CHECK:STDOUT: %.loc28_47.2: init %D = class_init (), %return [concrete = constants.%D.val]
  334. // CHECK:STDOUT: %.loc28_48: init %D = converted %.loc28_47.1, %.loc28_47.2 [concrete = constants.%D.val]
  335. // CHECK:STDOUT: return %.loc28_48 to %return
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: generic fn @SelfNested.F(@SelfNested.%Self: %SelfNested.type) {
  339. // CHECK:STDOUT: %Self: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.2ff)]
  340. // CHECK:STDOUT: %Self.as_type.loc32_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc32_16.1 (constants.%Self.as_type.e1e)]
  341. // CHECK:STDOUT: %ptr.loc32_16.1: type = ptr_type %Self.as_type.loc32_16.1 [symbolic = %ptr.loc32_16.1 (constants.%ptr.e87)]
  342. // CHECK:STDOUT: %struct_type.x.y.loc32_36.1: type = struct_type {.x: @SelfNested.F.%Self.as_type.loc32_16.1 (%Self.as_type.e1e), .y: %empty_tuple.type} [symbolic = %struct_type.x.y.loc32_36.1 (constants.%struct_type.x.y.270)]
  343. // CHECK:STDOUT: %tuple.type: type = tuple_type (%ptr.loc32_16.1, %struct_type.x.y.loc32_36.1) [symbolic = %tuple.type (constants.%tuple.type.46b)]
  344. // CHECK:STDOUT: %pattern_type: type = pattern_type %tuple.type [symbolic = %pattern_type (constants.%pattern_type.5a1)]
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: fn(%x.param: @SelfNested.F.%tuple.type (%tuple.type.46b));
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: fn @C.as.SelfNested.impl.F(%x.param: %tuple.type.a17);
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: fn @D.as.SelfNested.impl.F(%x.param: %tuple.type.a5f);
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: specific @UseSelf.F(constants.%Self.085) {
  354. // CHECK:STDOUT: %Self => constants.%Self.085
  355. // CHECK:STDOUT: %Self.as_type.loc16_14.1 => constants.%Self.as_type.599
  356. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.3ef
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: specific @UseSelf.F(constants.%UseSelf.facet.727) {
  360. // CHECK:STDOUT: %Self => constants.%UseSelf.facet.727
  361. // CHECK:STDOUT: %Self.as_type.loc16_14.1 => constants.%C
  362. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c48
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: specific @UseSelf.F(constants.%UseSelf.facet.d11) {
  366. // CHECK:STDOUT: %Self => constants.%UseSelf.facet.d11
  367. // CHECK:STDOUT: %Self.as_type.loc16_14.1 => constants.%D
  368. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.510
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: specific @SelfNested.F(constants.%Self.2ff) {
  372. // CHECK:STDOUT: %Self => constants.%Self.2ff
  373. // CHECK:STDOUT: %Self.as_type.loc32_16.1 => constants.%Self.as_type.e1e
  374. // CHECK:STDOUT: %ptr.loc32_16.1 => constants.%ptr.e87
  375. // CHECK:STDOUT: %struct_type.x.y.loc32_36.1 => constants.%struct_type.x.y.270
  376. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.46b
  377. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.5a1
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: specific @SelfNested.F(constants.%SelfNested.facet.2b2) {
  381. // CHECK:STDOUT: %Self => constants.%SelfNested.facet.2b2
  382. // CHECK:STDOUT: %Self.as_type.loc32_16.1 => constants.%C
  383. // CHECK:STDOUT: %ptr.loc32_16.1 => constants.%ptr.019
  384. // CHECK:STDOUT: %struct_type.x.y.loc32_36.1 => constants.%struct_type.x.y.2f0
  385. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.a17
  386. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.809
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: specific @SelfNested.F(constants.%SelfNested.facet.f2c) {
  390. // CHECK:STDOUT: %Self => constants.%SelfNested.facet.f2c
  391. // CHECK:STDOUT: %Self.as_type.loc32_16.1 => constants.%D
  392. // CHECK:STDOUT: %ptr.loc32_16.1 => constants.%ptr.19c
  393. // CHECK:STDOUT: %struct_type.x.y.loc32_36.1 => constants.%struct_type.x.y.527
  394. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.a5f
  395. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.b43
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT: