self_in_signature.carbon 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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/impl/no_prelude/self_in_signature.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/no_prelude/self_in_signature.carbon
  10. interface UseSelf {
  11. fn F[self: Self](x: Self) -> Self;
  12. }
  13. class C {}
  14. class D {}
  15. impl C as UseSelf {
  16. fn F[self: C](x: C) -> C { return {}; }
  17. }
  18. impl D as UseSelf {
  19. fn F[self: Self](x: Self) -> Self { return {}; }
  20. }
  21. interface SelfNested {
  22. fn F(x: (Self*, {.x: Self, .y: ()}));
  23. }
  24. impl C as SelfNested {
  25. fn F(x: (C*, {.x: C, .y: ()}));
  26. }
  27. impl D as SelfNested {
  28. fn F(x: (Self*, {.x: Self, .y: ()}));
  29. }
  30. // CHECK:STDOUT: --- self_in_signature.carbon
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: constants {
  33. // CHECK:STDOUT: %UseSelf.type: type = facet_type <@UseSelf> [template]
  34. // CHECK:STDOUT: %Self.aee: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic]
  35. // CHECK:STDOUT: %Self.as_type.3e2: type = facet_access_type %Self.aee [symbolic]
  36. // CHECK:STDOUT: %F.type.a69: type = fn_type @F.1 [template]
  37. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  38. // CHECK:STDOUT: %F.e5a: %F.type.a69 = struct_value () [template]
  39. // CHECK:STDOUT: %F.assoc_type.c96: type = assoc_entity_type %UseSelf.type, %F.type.a69 [template]
  40. // CHECK:STDOUT: %assoc0.8e9: %F.assoc_type.c96 = assoc_entity element0, @UseSelf.%F.decl [template]
  41. // CHECK:STDOUT: %C: type = class_type @C [template]
  42. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  43. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  44. // CHECK:STDOUT: %D: type = class_type @D [template]
  45. // CHECK:STDOUT: %impl_witness.c6f: <witness> = impl_witness (@impl.1.%F.decl) [template]
  46. // CHECK:STDOUT: %F.type.261: type = fn_type @F.2 [template]
  47. // CHECK:STDOUT: %F.63a: %F.type.261 = struct_value () [template]
  48. // CHECK:STDOUT: %UseSelf.facet.c5b: %UseSelf.type = facet_value %C, %impl_witness.c6f [template]
  49. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  50. // CHECK:STDOUT: %impl_witness.02b: <witness> = impl_witness (@impl.2.%F.decl) [template]
  51. // CHECK:STDOUT: %F.type.5ab: type = fn_type @F.3 [template]
  52. // CHECK:STDOUT: %F.d6a: %F.type.5ab = struct_value () [template]
  53. // CHECK:STDOUT: %UseSelf.facet.af5: %UseSelf.type = facet_value %D, %impl_witness.02b [template]
  54. // CHECK:STDOUT: %D.val: %D = struct_value () [template]
  55. // CHECK:STDOUT: %SelfNested.type: type = facet_type <@SelfNested> [template]
  56. // CHECK:STDOUT: %Self.36c: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic]
  57. // CHECK:STDOUT: %Self.as_type.966: type = facet_access_type %Self.36c [symbolic]
  58. // CHECK:STDOUT: %ptr.af7: type = ptr_type %Self.as_type.966 [symbolic]
  59. // CHECK:STDOUT: %struct_type.x.y.0dc: type = struct_type {.x: %Self.as_type.966, .y: %empty_tuple.type} [symbolic]
  60. // CHECK:STDOUT: %tuple.type.24b: type = tuple_type (type, type) [template]
  61. // CHECK:STDOUT: %tuple.type.7e5: type = tuple_type (%ptr.af7, %struct_type.x.y.0dc) [symbolic]
  62. // CHECK:STDOUT: %F.type.f33: type = fn_type @F.4 [template]
  63. // CHECK:STDOUT: %F.04f: %F.type.f33 = struct_value () [template]
  64. // CHECK:STDOUT: %F.assoc_type.c02: type = assoc_entity_type %SelfNested.type, %F.type.f33 [template]
  65. // CHECK:STDOUT: %assoc0.982: %F.assoc_type.c02 = assoc_entity element0, @SelfNested.%F.decl [template]
  66. // CHECK:STDOUT: %impl_witness.d90: <witness> = impl_witness (@impl.3.%F.decl) [template]
  67. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [template]
  68. // CHECK:STDOUT: %struct_type.x.y.2f0: type = struct_type {.x: %C, .y: %empty_tuple.type} [template]
  69. // CHECK:STDOUT: %tuple.type.a17: type = tuple_type (%ptr.019, %struct_type.x.y.2f0) [template]
  70. // CHECK:STDOUT: %F.type.9b5: type = fn_type @F.5 [template]
  71. // CHECK:STDOUT: %F.c45: %F.type.9b5 = struct_value () [template]
  72. // CHECK:STDOUT: %SelfNested.facet.d94: %SelfNested.type = facet_value %C, %impl_witness.d90 [template]
  73. // CHECK:STDOUT: %impl_witness.55c: <witness> = impl_witness (@impl.4.%F.decl) [template]
  74. // CHECK:STDOUT: %ptr.19c: type = ptr_type %D [template]
  75. // CHECK:STDOUT: %struct_type.x.y.527: type = struct_type {.x: %D, .y: %empty_tuple.type} [template]
  76. // CHECK:STDOUT: %tuple.type.a5f: type = tuple_type (%ptr.19c, %struct_type.x.y.527) [template]
  77. // CHECK:STDOUT: %F.type.3cb: type = fn_type @F.6 [template]
  78. // CHECK:STDOUT: %F.3b6: %F.type.3cb = struct_value () [template]
  79. // CHECK:STDOUT: %SelfNested.facet.2f0: %SelfNested.type = facet_value %D, %impl_witness.55c [template]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: file {
  83. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  84. // CHECK:STDOUT: .UseSelf = %UseSelf.decl
  85. // CHECK:STDOUT: .C = %C.decl
  86. // CHECK:STDOUT: .D = %D.decl
  87. // CHECK:STDOUT: .SelfNested = %SelfNested.decl
  88. // CHECK:STDOUT: }
  89. // CHECK:STDOUT: %UseSelf.decl: type = interface_decl @UseSelf [template = constants.%UseSelf.type] {} {}
  90. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  91. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  92. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  93. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  94. // CHECK:STDOUT: %UseSelf.ref: type = name_ref UseSelf, file.%UseSelf.decl [template = constants.%UseSelf.type]
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: %impl_witness.loc19: <witness> = impl_witness (@impl.1.%F.decl) [template = constants.%impl_witness.c6f]
  97. // CHECK:STDOUT: impl_decl @impl.2 [template] {} {
  98. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  99. // CHECK:STDOUT: %UseSelf.ref: type = name_ref UseSelf, file.%UseSelf.decl [template = constants.%UseSelf.type]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: %impl_witness.loc23: <witness> = impl_witness (@impl.2.%F.decl) [template = constants.%impl_witness.02b]
  102. // CHECK:STDOUT: %SelfNested.decl: type = interface_decl @SelfNested [template = constants.%SelfNested.type] {} {}
  103. // CHECK:STDOUT: impl_decl @impl.3 [template] {} {
  104. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  105. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%SelfNested.type]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: %impl_witness.loc31: <witness> = impl_witness (@impl.3.%F.decl) [template = constants.%impl_witness.d90]
  108. // CHECK:STDOUT: impl_decl @impl.4 [template] {} {
  109. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  110. // CHECK:STDOUT: %SelfNested.ref: type = name_ref SelfNested, file.%SelfNested.decl [template = constants.%SelfNested.type]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: %impl_witness.loc35: <witness> = impl_witness (@impl.4.%F.decl) [template = constants.%impl_witness.55c]
  113. // CHECK:STDOUT: }
  114. // CHECK:STDOUT:
  115. // CHECK:STDOUT: interface @UseSelf {
  116. // CHECK:STDOUT: %Self: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.aee]
  117. // CHECK:STDOUT: %F.decl: %F.type.a69 = fn_decl @F.1 [template = constants.%F.e5a] {
  118. // CHECK:STDOUT: %self.patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = binding_pattern self
  119. // CHECK:STDOUT: %self.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = value_param_pattern %self.patt, runtime_param0
  120. // CHECK:STDOUT: %x.patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = binding_pattern x
  121. // CHECK:STDOUT: %x.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = value_param_pattern %x.patt, runtime_param1
  122. // CHECK:STDOUT: %return.patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = return_slot_pattern
  123. // CHECK:STDOUT: %return.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = out_param_pattern %return.patt, runtime_param2
  124. // CHECK:STDOUT: } {
  125. // CHECK:STDOUT: %Self.ref.loc12_32: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.aee)]
  126. // CHECK:STDOUT: %Self.as_type.loc12_32: type = facet_access_type %Self.ref.loc12_32 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  127. // CHECK:STDOUT: %.loc12_32: type = converted %Self.ref.loc12_32, %Self.as_type.loc12_32 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  128. // CHECK:STDOUT: %self.param: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = value_param runtime_param0
  129. // CHECK:STDOUT: %.loc12_14.1: type = splice_block %.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)] {
  130. // CHECK:STDOUT: %Self.ref.loc12_14: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.aee)]
  131. // CHECK:STDOUT: %Self.as_type.loc12_14.2: type = facet_access_type %Self.ref.loc12_14 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  132. // CHECK:STDOUT: %.loc12_14.2: type = converted %Self.ref.loc12_14, %Self.as_type.loc12_14.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT: %self: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = bind_name self, %self.param
  135. // CHECK:STDOUT: %x.param: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = value_param runtime_param1
  136. // CHECK:STDOUT: %.loc12_23.1: type = splice_block %.loc12_23.2 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)] {
  137. // CHECK:STDOUT: %Self.ref.loc12_23: %UseSelf.type = name_ref Self, @UseSelf.%Self [symbolic = %Self (constants.%Self.aee)]
  138. // CHECK:STDOUT: %Self.as_type.loc12_23: type = facet_access_type %Self.ref.loc12_23 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  139. // CHECK:STDOUT: %.loc12_23.2: type = converted %Self.ref.loc12_23, %Self.as_type.loc12_23 [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT: %x: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = bind_name x, %x.param
  142. // CHECK:STDOUT: %return.param: ref @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = out_param runtime_param2
  143. // CHECK:STDOUT: %return: ref @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2) = return_slot %return.param
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: %assoc0: %F.assoc_type.c96 = assoc_entity element0, %F.decl [template = constants.%assoc0.8e9]
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: !members:
  148. // CHECK:STDOUT: .Self = %Self
  149. // CHECK:STDOUT: .F = %assoc0
  150. // CHECK:STDOUT: witness = (%F.decl)
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: interface @SelfNested {
  154. // CHECK:STDOUT: %Self: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.36c]
  155. // CHECK:STDOUT: %F.decl: %F.type.f33 = fn_decl @F.4 [template = constants.%F.04f] {
  156. // CHECK:STDOUT: %x.patt: @F.4.%tuple.type (%tuple.type.7e5) = binding_pattern x
  157. // CHECK:STDOUT: %x.param_patt: @F.4.%tuple.type (%tuple.type.7e5) = value_param_pattern %x.patt, runtime_param0
  158. // CHECK:STDOUT: } {
  159. // CHECK:STDOUT: %x.param: @F.4.%tuple.type (%tuple.type.7e5) = value_param runtime_param0
  160. // CHECK:STDOUT: %.loc28_37.1: type = splice_block %.loc28_37.3 [symbolic = %tuple.type (constants.%tuple.type.7e5)] {
  161. // CHECK:STDOUT: %Self.ref.loc28_12: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.36c)]
  162. // CHECK:STDOUT: %Self.as_type.loc28_16.2: type = facet_access_type %Self.ref.loc28_12 [symbolic = %Self.as_type.loc28_16.1 (constants.%Self.as_type.966)]
  163. // CHECK:STDOUT: %.loc28_16: type = converted %Self.ref.loc28_12, %Self.as_type.loc28_16.2 [symbolic = %Self.as_type.loc28_16.1 (constants.%Self.as_type.966)]
  164. // CHECK:STDOUT: %ptr.loc28_16.2: type = ptr_type %Self.as_type.966 [symbolic = %ptr.loc28_16.1 (constants.%ptr.af7)]
  165. // CHECK:STDOUT: %Self.ref.loc28_24: %SelfNested.type = name_ref Self, @SelfNested.%Self [symbolic = %Self (constants.%Self.36c)]
  166. // CHECK:STDOUT: %Self.as_type.loc28_24: type = facet_access_type %Self.ref.loc28_24 [symbolic = %Self.as_type.loc28_16.1 (constants.%Self.as_type.966)]
  167. // CHECK:STDOUT: %.loc28_24: type = converted %Self.ref.loc28_24, %Self.as_type.loc28_24 [symbolic = %Self.as_type.loc28_16.1 (constants.%Self.as_type.966)]
  168. // CHECK:STDOUT: %.loc28_35.1: %empty_tuple.type = tuple_literal ()
  169. // CHECK:STDOUT: %.loc28_35.2: type = converted %.loc28_35.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  170. // CHECK:STDOUT: %struct_type.x.y.loc28_36.2: type = struct_type {.x: %Self.as_type.966, .y: %empty_tuple.type} [symbolic = %struct_type.x.y.loc28_36.1 (constants.%struct_type.x.y.0dc)]
  171. // CHECK:STDOUT: %.loc28_37.2: %tuple.type.24b = tuple_literal (%ptr.loc28_16.2, %struct_type.x.y.loc28_36.2)
  172. // CHECK:STDOUT: %.loc28_37.3: type = converted %.loc28_37.2, constants.%tuple.type.7e5 [symbolic = %tuple.type (constants.%tuple.type.7e5)]
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %x: @F.4.%tuple.type (%tuple.type.7e5) = bind_name x, %x.param
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %assoc0: %F.assoc_type.c02 = assoc_entity element0, %F.decl [template = constants.%assoc0.982]
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: !members:
  179. // CHECK:STDOUT: .Self = %Self
  180. // CHECK:STDOUT: .F = %assoc0
  181. // CHECK:STDOUT: witness = (%F.decl)
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: impl @impl.1: %C.ref as %UseSelf.ref {
  185. // CHECK:STDOUT: %F.decl: %F.type.261 = fn_decl @F.2 [template = constants.%F.63a] {
  186. // CHECK:STDOUT: %self.patt: %C = binding_pattern self
  187. // CHECK:STDOUT: %self.param_patt: %C = value_param_pattern %self.patt, runtime_param0
  188. // CHECK:STDOUT: %x.patt: %C = binding_pattern x
  189. // CHECK:STDOUT: %x.param_patt: %C = value_param_pattern %x.patt, runtime_param1
  190. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  191. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param2
  192. // CHECK:STDOUT: } {
  193. // CHECK:STDOUT: %C.ref.loc20_26: type = name_ref C, file.%C.decl [template = constants.%C]
  194. // CHECK:STDOUT: %self.param: %C = value_param runtime_param0
  195. // CHECK:STDOUT: %C.ref.loc20_14: type = name_ref C, file.%C.decl [template = constants.%C]
  196. // CHECK:STDOUT: %self: %C = bind_name self, %self.param
  197. // CHECK:STDOUT: %x.param: %C = value_param runtime_param1
  198. // CHECK:STDOUT: %C.ref.loc20_20: type = name_ref C, file.%C.decl [template = constants.%C]
  199. // CHECK:STDOUT: %x: %C = bind_name x, %x.param
  200. // CHECK:STDOUT: %return.param: ref %C = out_param runtime_param2
  201. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: !members:
  205. // CHECK:STDOUT: .F = %F.decl
  206. // CHECK:STDOUT: witness = file.%impl_witness.loc19
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: impl @impl.2: %D.ref as %UseSelf.ref {
  210. // CHECK:STDOUT: %F.decl: %F.type.5ab = fn_decl @F.3 [template = constants.%F.d6a] {
  211. // CHECK:STDOUT: %self.patt: %D = binding_pattern self
  212. // CHECK:STDOUT: %self.param_patt: %D = value_param_pattern %self.patt, runtime_param0
  213. // CHECK:STDOUT: %x.patt: %D = binding_pattern x
  214. // CHECK:STDOUT: %x.param_patt: %D = value_param_pattern %x.patt, runtime_param1
  215. // CHECK:STDOUT: %return.patt: %D = return_slot_pattern
  216. // CHECK:STDOUT: %return.param_patt: %D = out_param_pattern %return.patt, runtime_param2
  217. // CHECK:STDOUT: } {
  218. // CHECK:STDOUT: %Self.ref.loc24_32: type = name_ref Self, @impl.2.%D.ref [template = constants.%D]
  219. // CHECK:STDOUT: %self.param: %D = value_param runtime_param0
  220. // CHECK:STDOUT: %Self.ref.loc24_14: type = name_ref Self, @impl.2.%D.ref [template = constants.%D]
  221. // CHECK:STDOUT: %self: %D = bind_name self, %self.param
  222. // CHECK:STDOUT: %x.param: %D = value_param runtime_param1
  223. // CHECK:STDOUT: %Self.ref.loc24_23: type = name_ref Self, @impl.2.%D.ref [template = constants.%D]
  224. // CHECK:STDOUT: %x: %D = bind_name x, %x.param
  225. // CHECK:STDOUT: %return.param: ref %D = out_param runtime_param2
  226. // CHECK:STDOUT: %return: ref %D = return_slot %return.param
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: !members:
  230. // CHECK:STDOUT: .F = %F.decl
  231. // CHECK:STDOUT: witness = file.%impl_witness.loc23
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: impl @impl.3: %C.ref as %SelfNested.ref {
  235. // CHECK:STDOUT: %F.decl: %F.type.9b5 = fn_decl @F.5 [template = constants.%F.c45] {
  236. // CHECK:STDOUT: %x.patt: %tuple.type.a17 = binding_pattern x
  237. // CHECK:STDOUT: %x.param_patt: %tuple.type.a17 = value_param_pattern %x.patt, runtime_param0
  238. // CHECK:STDOUT: } {
  239. // CHECK:STDOUT: %x.param: %tuple.type.a17 = value_param runtime_param0
  240. // CHECK:STDOUT: %.loc32_31.1: type = splice_block %.loc32_31.3 [template = constants.%tuple.type.a17] {
  241. // CHECK:STDOUT: %C.ref.loc32_12: type = name_ref C, file.%C.decl [template = constants.%C]
  242. // CHECK:STDOUT: %ptr: type = ptr_type %C [template = constants.%ptr.019]
  243. // CHECK:STDOUT: %C.ref.loc32_21: type = name_ref C, file.%C.decl [template = constants.%C]
  244. // CHECK:STDOUT: %.loc32_29.1: %empty_tuple.type = tuple_literal ()
  245. // CHECK:STDOUT: %.loc32_29.2: type = converted %.loc32_29.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  246. // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %C, .y: %empty_tuple.type} [template = constants.%struct_type.x.y.2f0]
  247. // CHECK:STDOUT: %.loc32_31.2: %tuple.type.24b = tuple_literal (%ptr, %struct_type.x.y)
  248. // CHECK:STDOUT: %.loc32_31.3: type = converted %.loc32_31.2, constants.%tuple.type.a17 [template = constants.%tuple.type.a17]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: %x: %tuple.type.a17 = bind_name x, %x.param
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: !members:
  254. // CHECK:STDOUT: .F = %F.decl
  255. // CHECK:STDOUT: witness = file.%impl_witness.loc31
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: impl @impl.4: %D.ref as %SelfNested.ref {
  259. // CHECK:STDOUT: %F.decl: %F.type.3cb = fn_decl @F.6 [template = constants.%F.3b6] {
  260. // CHECK:STDOUT: %x.patt: %tuple.type.a5f = binding_pattern x
  261. // CHECK:STDOUT: %x.param_patt: %tuple.type.a5f = value_param_pattern %x.patt, runtime_param0
  262. // CHECK:STDOUT: } {
  263. // CHECK:STDOUT: %x.param: %tuple.type.a5f = value_param runtime_param0
  264. // CHECK:STDOUT: %.loc36_37.1: type = splice_block %.loc36_37.3 [template = constants.%tuple.type.a5f] {
  265. // CHECK:STDOUT: %Self.ref.loc36_12: type = name_ref Self, @impl.4.%D.ref [template = constants.%D]
  266. // CHECK:STDOUT: %ptr: type = ptr_type %D [template = constants.%ptr.19c]
  267. // CHECK:STDOUT: %Self.ref.loc36_24: type = name_ref Self, @impl.4.%D.ref [template = constants.%D]
  268. // CHECK:STDOUT: %.loc36_35.1: %empty_tuple.type = tuple_literal ()
  269. // CHECK:STDOUT: %.loc36_35.2: type = converted %.loc36_35.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  270. // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: %D, .y: %empty_tuple.type} [template = constants.%struct_type.x.y.527]
  271. // CHECK:STDOUT: %.loc36_37.2: %tuple.type.24b = tuple_literal (%ptr, %struct_type.x.y)
  272. // CHECK:STDOUT: %.loc36_37.3: type = converted %.loc36_37.2, constants.%tuple.type.a5f [template = constants.%tuple.type.a5f]
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT: %x: %tuple.type.a5f = bind_name x, %x.param
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !members:
  278. // CHECK:STDOUT: .F = %F.decl
  279. // CHECK:STDOUT: witness = file.%impl_witness.loc35
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: class @C {
  283. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: !members:
  286. // CHECK:STDOUT: .Self = constants.%C
  287. // CHECK:STDOUT: complete_type_witness = %complete_type
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: class @D {
  291. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: !members:
  294. // CHECK:STDOUT: .Self = constants.%D
  295. // CHECK:STDOUT: complete_type_witness = %complete_type
  296. // CHECK:STDOUT: }
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: generic fn @F.1(@UseSelf.%Self: %UseSelf.type) {
  299. // CHECK:STDOUT: %Self: %UseSelf.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.aee)]
  300. // CHECK:STDOUT: %Self.as_type.loc12_14.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_14.1 (constants.%Self.as_type.3e2)]
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: fn[%self.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2)](%x.param_patt: @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2)) -> @F.1.%Self.as_type.loc12_14.1 (%Self.as_type.3e2);
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: fn @F.2[%self.param_patt: %C](%x.param_patt: %C) -> %return.param_patt: %C {
  306. // CHECK:STDOUT: !entry:
  307. // CHECK:STDOUT: %.loc20_38.1: %empty_struct_type = struct_literal ()
  308. // CHECK:STDOUT: %.loc20_38.2: init %C = class_init (), %return [template = constants.%C.val]
  309. // CHECK:STDOUT: %.loc20_39: init %C = converted %.loc20_38.1, %.loc20_38.2 [template = constants.%C.val]
  310. // CHECK:STDOUT: return %.loc20_39 to %return
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: fn @F.3[%self.param_patt: %D](%x.param_patt: %D) -> %return.param_patt: %D {
  314. // CHECK:STDOUT: !entry:
  315. // CHECK:STDOUT: %.loc24_47.1: %empty_struct_type = struct_literal ()
  316. // CHECK:STDOUT: %.loc24_47.2: init %D = class_init (), %return [template = constants.%D.val]
  317. // CHECK:STDOUT: %.loc24_48: init %D = converted %.loc24_47.1, %.loc24_47.2 [template = constants.%D.val]
  318. // CHECK:STDOUT: return %.loc24_48 to %return
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: generic fn @F.4(@SelfNested.%Self: %SelfNested.type) {
  322. // CHECK:STDOUT: %Self: %SelfNested.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.36c)]
  323. // CHECK:STDOUT: %Self.as_type.loc28_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc28_16.1 (constants.%Self.as_type.966)]
  324. // CHECK:STDOUT: %ptr.loc28_16.1: type = ptr_type @F.4.%Self.as_type.loc28_16.1 (%Self.as_type.966) [symbolic = %ptr.loc28_16.1 (constants.%ptr.af7)]
  325. // CHECK:STDOUT: %struct_type.x.y.loc28_36.1: type = struct_type {.x: @F.4.%Self.as_type.loc28_16.1 (%Self.as_type.966), .y: %empty_tuple.type} [symbolic = %struct_type.x.y.loc28_36.1 (constants.%struct_type.x.y.0dc)]
  326. // CHECK:STDOUT: %tuple.type: type = tuple_type (@F.4.%ptr.loc28_16.1 (%ptr.af7), @F.4.%struct_type.x.y.loc28_36.1 (%struct_type.x.y.0dc)) [symbolic = %tuple.type (constants.%tuple.type.7e5)]
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: fn(%x.param_patt: @F.4.%tuple.type (%tuple.type.7e5));
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: fn @F.5(%x.param_patt: %tuple.type.a17);
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: fn @F.6(%x.param_patt: %tuple.type.a5f);
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: specific @F.1(constants.%Self.aee) {
  336. // CHECK:STDOUT: %Self => constants.%Self.aee
  337. // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%Self.as_type.3e2
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: specific @F.1(constants.%UseSelf.facet.c5b) {
  341. // CHECK:STDOUT: %Self => constants.%UseSelf.facet.c5b
  342. // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%C
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: specific @F.1(constants.%UseSelf.facet.af5) {
  346. // CHECK:STDOUT: %Self => constants.%UseSelf.facet.af5
  347. // CHECK:STDOUT: %Self.as_type.loc12_14.1 => constants.%D
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: specific @F.4(constants.%Self.36c) {
  351. // CHECK:STDOUT: %Self => constants.%Self.36c
  352. // CHECK:STDOUT: %Self.as_type.loc28_16.1 => constants.%Self.as_type.966
  353. // CHECK:STDOUT: %ptr.loc28_16.1 => constants.%ptr.af7
  354. // CHECK:STDOUT: %struct_type.x.y.loc28_36.1 => constants.%struct_type.x.y.0dc
  355. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.7e5
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @F.4(constants.%SelfNested.facet.d94) {
  359. // CHECK:STDOUT: %Self => constants.%SelfNested.facet.d94
  360. // CHECK:STDOUT: %Self.as_type.loc28_16.1 => constants.%C
  361. // CHECK:STDOUT: %ptr.loc28_16.1 => constants.%ptr.019
  362. // CHECK:STDOUT: %struct_type.x.y.loc28_36.1 => constants.%struct_type.x.y.2f0
  363. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.a17
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: specific @F.4(constants.%SelfNested.facet.2f0) {
  367. // CHECK:STDOUT: %Self => constants.%SelfNested.facet.2f0
  368. // CHECK:STDOUT: %Self.as_type.loc28_16.1 => constants.%D
  369. // CHECK:STDOUT: %ptr.loc28_16.1 => constants.%ptr.19c
  370. // CHECK:STDOUT: %struct_type.x.y.loc28_36.1 => constants.%struct_type.x.y.527
  371. // CHECK:STDOUT: %tuple.type => constants.%tuple.type.a5f
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: