access.carbon 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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/facet/no_prelude/access.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/no_prelude/access.carbon
  10. // --- access_assoc_fn.carbon
  11. library "[[@TEST_NAME]]";
  12. interface I {
  13. fn DoIt();
  14. }
  15. fn Use(T:! I) {
  16. T.DoIt();
  17. }
  18. // --- assoc_fn_using_self.carbon
  19. library "[[@TEST_NAME]]";
  20. interface I {
  21. fn Make() -> Self;
  22. }
  23. fn Use(T:! I) -> T {
  24. return T.Make();
  25. }
  26. // --- fail_todo_access_assoc_method.carbon
  27. library "[[@TEST_NAME]]";
  28. interface I {
  29. fn Copy[self: Self]() -> Self;
  30. }
  31. fn Use[T:! I](x: T) -> T {
  32. // CHECK:STDERR: fail_todo_access_assoc_method.carbon:[[@LINE+4]]:10: error: type `T` does not support qualified expressions [QualifiedExprUnsupported]
  33. // CHECK:STDERR: return x.Copy();
  34. // CHECK:STDERR: ^~~~~~
  35. // CHECK:STDERR:
  36. return x.Copy();
  37. }
  38. // --- access_assoc_method_indirect.carbon
  39. library "[[@TEST_NAME]]";
  40. interface I {
  41. fn Copy[self: Self]() -> Self;
  42. }
  43. fn UseIndirect[T:! I](x: T) -> T {
  44. return x.(T.Copy)();
  45. }
  46. // CHECK:STDOUT: --- access_assoc_fn.carbon
  47. // CHECK:STDOUT:
  48. // CHECK:STDOUT: constants {
  49. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  50. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  51. // CHECK:STDOUT: %DoIt.type: type = fn_type @DoIt [template]
  52. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  53. // CHECK:STDOUT: %DoIt: %DoIt.type = struct_value () [template]
  54. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  55. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%DoIt.decl [template]
  56. // CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
  57. // CHECK:STDOUT: %T.patt: %I.type = symbolic_binding_pattern T, 0 [symbolic]
  58. // CHECK:STDOUT: %Use.type: type = fn_type @Use [template]
  59. // CHECK:STDOUT: %Use: %Use.type = struct_value () [template]
  60. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  61. // CHECK:STDOUT: %T.as_wit: <witness> = facet_access_witness %T [symbolic]
  62. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type, %T.as_wit [symbolic]
  63. // CHECK:STDOUT: %.d9e: type = fn_type_with_self_type %DoIt.type, %I.facet [symbolic]
  64. // CHECK:STDOUT: %impl.elem0: %.d9e = impl_witness_access %T.as_wit, element0 [symbolic]
  65. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @DoIt(%I.facet) [symbolic]
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: file {
  69. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  70. // CHECK:STDOUT: .I = %I.decl
  71. // CHECK:STDOUT: .Use = %Use.decl
  72. // CHECK:STDOUT: }
  73. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  74. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {
  75. // CHECK:STDOUT: %T.patt.loc8_8.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  76. // CHECK:STDOUT: %T.param_patt: %I.type = value_param_pattern %T.patt.loc8_8.1, runtime_param<none> [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  77. // CHECK:STDOUT: } {
  78. // CHECK:STDOUT: %T.param: %I.type = value_param runtime_param<none>
  79. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  80. // CHECK:STDOUT: %T.loc8_8.1: %I.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_8.2 (constants.%T)]
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT:
  84. // CHECK:STDOUT: interface @I {
  85. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  86. // CHECK:STDOUT: %DoIt.decl: %DoIt.type = fn_decl @DoIt [template = constants.%DoIt] {} {}
  87. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %DoIt.decl [template = constants.%assoc0]
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: !members:
  90. // CHECK:STDOUT: .Self = %Self
  91. // CHECK:STDOUT: .DoIt = %assoc0
  92. // CHECK:STDOUT: witness = (%DoIt.decl)
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: generic fn @DoIt(@I.%Self: %I.type) {
  96. // CHECK:STDOUT: fn();
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: generic fn @Use(%T.loc8_8.1: %I.type) {
  100. // CHECK:STDOUT: %T.loc8_8.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_8.2 (constants.%T)]
  101. // CHECK:STDOUT: %T.patt.loc8_8.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: !definition:
  104. // CHECK:STDOUT: %T.as_type.loc9_4.2: type = facet_access_type %T.loc8_8.2 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)]
  105. // CHECK:STDOUT: %T.as_wit.loc9_4.2: <witness> = facet_access_witness %T.loc8_8.2 [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)]
  106. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type.loc9_4.2, %T.as_wit.loc9_4.2 [symbolic = %I.facet (constants.%I.facet)]
  107. // CHECK:STDOUT: %.loc9_4.2: type = fn_type_with_self_type constants.%DoIt.type, %I.facet [symbolic = %.loc9_4.2 (constants.%.d9e)]
  108. // CHECK:STDOUT: %impl.elem0.loc9_4.2: @Use.%.loc9_4.2 (%.d9e) = impl_witness_access %T.as_wit.loc9_4.2, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)]
  109. // CHECK:STDOUT: %specific_fn.loc9_4.2: <specific function> = specific_function %impl.elem0.loc9_4.2, @DoIt(%I.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn)]
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: fn(%T.param_patt: %I.type) {
  112. // CHECK:STDOUT: !entry:
  113. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc8_8.1 [symbolic = %T.loc8_8.2 (constants.%T)]
  114. // CHECK:STDOUT: %DoIt.ref: %I.assoc_type = name_ref DoIt, @I.%assoc0 [template = constants.%assoc0]
  115. // CHECK:STDOUT: %T.as_type.loc9_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)]
  116. // CHECK:STDOUT: %.loc9_4.1: type = converted %T.ref, %T.as_type.loc9_4.1 [symbolic = %T.as_type.loc9_4.2 (constants.%T.as_type)]
  117. // CHECK:STDOUT: %T.as_wit.loc9_4.1: <witness> = facet_access_witness %T.ref [symbolic = %T.as_wit.loc9_4.2 (constants.%T.as_wit)]
  118. // CHECK:STDOUT: %impl.elem0.loc9_4.1: @Use.%.loc9_4.2 (%.d9e) = impl_witness_access %T.as_wit.loc9_4.1, element0 [symbolic = %impl.elem0.loc9_4.2 (constants.%impl.elem0)]
  119. // CHECK:STDOUT: %specific_fn.loc9_4.1: <specific function> = specific_function %impl.elem0.loc9_4.1, @DoIt(constants.%I.facet) [symbolic = %specific_fn.loc9_4.2 (constants.%specific_fn)]
  120. // CHECK:STDOUT: %DoIt.call: init %empty_tuple.type = call %specific_fn.loc9_4.1()
  121. // CHECK:STDOUT: return
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: specific @DoIt(constants.%Self) {}
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: specific @Use(constants.%T) {
  128. // CHECK:STDOUT: %T.loc8_8.2 => constants.%T
  129. // CHECK:STDOUT: %T.patt.loc8_8.2 => constants.%T
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: specific @DoIt(constants.%I.facet) {}
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: specific @DoIt(@Use.%I.facet) {}
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: --- assoc_fn_using_self.carbon
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: constants {
  139. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  140. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  141. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  142. // CHECK:STDOUT: %Make.type: type = fn_type @Make [template]
  143. // CHECK:STDOUT: %Make: %Make.type = struct_value () [template]
  144. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  145. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Make.decl [template]
  146. // CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
  147. // CHECK:STDOUT: %T.patt: %I.type = symbolic_binding_pattern T, 0 [symbolic]
  148. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  149. // CHECK:STDOUT: %Use.type: type = fn_type @Use [template]
  150. // CHECK:STDOUT: %Use: %Use.type = struct_value () [template]
  151. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type [symbolic]
  152. // CHECK:STDOUT: %T.as_wit: <witness> = facet_access_witness %T [symbolic]
  153. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type, %T.as_wit [symbolic]
  154. // CHECK:STDOUT: %.aaf: type = fn_type_with_self_type %Make.type, %I.facet [symbolic]
  155. // CHECK:STDOUT: %impl.elem0: %.aaf = impl_witness_access %T.as_wit, element0 [symbolic]
  156. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Make(%I.facet) [symbolic]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: file {
  160. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  161. // CHECK:STDOUT: .I = %I.decl
  162. // CHECK:STDOUT: .Use = %Use.decl
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  165. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {
  166. // CHECK:STDOUT: %T.patt.loc8_8.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  167. // CHECK:STDOUT: %T.param_patt: %I.type = value_param_pattern %T.patt.loc8_8.1, runtime_param<none> [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  168. // CHECK:STDOUT: %return.patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = return_slot_pattern
  169. // CHECK:STDOUT: %return.param_patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = out_param_pattern %return.patt, runtime_param0
  170. // CHECK:STDOUT: } {
  171. // CHECK:STDOUT: %T.ref.loc8: %I.type = name_ref T, %T.loc8_8.1 [symbolic = %T.loc8_8.2 (constants.%T)]
  172. // CHECK:STDOUT: %T.as_type.loc8_18.1: type = facet_access_type %T.ref.loc8 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  173. // CHECK:STDOUT: %.loc8: type = converted %T.ref.loc8, %T.as_type.loc8_18.1 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  174. // CHECK:STDOUT: %T.param: %I.type = value_param runtime_param<none>
  175. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  176. // CHECK:STDOUT: %T.loc8_8.1: %I.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_8.2 (constants.%T)]
  177. // CHECK:STDOUT: %return.param: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = out_param runtime_param0
  178. // CHECK:STDOUT: %return: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = return_slot %return.param
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: interface @I {
  183. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  184. // CHECK:STDOUT: %Make.decl: %Make.type = fn_decl @Make [template = constants.%Make] {
  185. // CHECK:STDOUT: %return.patt: @Make.%Self.as_type.loc5_16.1 (%Self.as_type) = return_slot_pattern
  186. // CHECK:STDOUT: %return.param_patt: @Make.%Self.as_type.loc5_16.1 (%Self.as_type) = out_param_pattern %return.patt, runtime_param0
  187. // CHECK:STDOUT: } {
  188. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  189. // CHECK:STDOUT: %Self.as_type.loc5_16.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc5_16.1 (constants.%Self.as_type)]
  190. // CHECK:STDOUT: %.loc5: type = converted %Self.ref, %Self.as_type.loc5_16.2 [symbolic = %Self.as_type.loc5_16.1 (constants.%Self.as_type)]
  191. // CHECK:STDOUT: %return.param: ref @Make.%Self.as_type.loc5_16.1 (%Self.as_type) = out_param runtime_param0
  192. // CHECK:STDOUT: %return: ref @Make.%Self.as_type.loc5_16.1 (%Self.as_type) = return_slot %return.param
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %Make.decl [template = constants.%assoc0]
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: !members:
  197. // CHECK:STDOUT: .Self = %Self
  198. // CHECK:STDOUT: .Make = %assoc0
  199. // CHECK:STDOUT: witness = (%Make.decl)
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: generic fn @Make(@I.%Self: %I.type) {
  203. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  204. // CHECK:STDOUT: %Self.as_type.loc5_16.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_16.1 (constants.%Self.as_type)]
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: fn() -> @Make.%Self.as_type.loc5_16.1 (%Self.as_type);
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: generic fn @Use(%T.loc8_8.1: %I.type) {
  210. // CHECK:STDOUT: %T.loc8_8.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_8.2 (constants.%T)]
  211. // CHECK:STDOUT: %T.patt.loc8_8.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  212. // CHECK:STDOUT: %T.as_type.loc8_18.2: type = facet_access_type %T.loc8_8.2 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: !definition:
  215. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @Use.%T.as_type.loc8_18.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)]
  216. // CHECK:STDOUT: %T.as_wit.loc9_11.2: <witness> = facet_access_witness %T.loc8_8.2 [symbolic = %T.as_wit.loc9_11.2 (constants.%T.as_wit)]
  217. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type.loc8_18.2, %T.as_wit.loc9_11.2 [symbolic = %I.facet (constants.%I.facet)]
  218. // CHECK:STDOUT: %.loc9_11.2: type = fn_type_with_self_type constants.%Make.type, %I.facet [symbolic = %.loc9_11.2 (constants.%.aaf)]
  219. // CHECK:STDOUT: %impl.elem0.loc9_11.2: @Use.%.loc9_11.2 (%.aaf) = impl_witness_access %T.as_wit.loc9_11.2, element0 [symbolic = %impl.elem0.loc9_11.2 (constants.%impl.elem0)]
  220. // CHECK:STDOUT: %specific_fn.loc9_11.2: <specific function> = specific_function %impl.elem0.loc9_11.2, @Make(%I.facet) [symbolic = %specific_fn.loc9_11.2 (constants.%specific_fn)]
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: fn(%T.param_patt: %I.type) -> @Use.%T.as_type.loc8_18.2 (%T.as_type) {
  223. // CHECK:STDOUT: !entry:
  224. // CHECK:STDOUT: %T.ref.loc9: %I.type = name_ref T, %T.loc8_8.1 [symbolic = %T.loc8_8.2 (constants.%T)]
  225. // CHECK:STDOUT: %Make.ref: %I.assoc_type = name_ref Make, @I.%assoc0 [template = constants.%assoc0]
  226. // CHECK:STDOUT: %T.as_type.loc9: type = facet_access_type %T.ref.loc9 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  227. // CHECK:STDOUT: %.loc9_11.1: type = converted %T.ref.loc9, %T.as_type.loc9 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  228. // CHECK:STDOUT: %T.as_wit.loc9_11.1: <witness> = facet_access_witness %T.ref.loc9 [symbolic = %T.as_wit.loc9_11.2 (constants.%T.as_wit)]
  229. // CHECK:STDOUT: %impl.elem0.loc9_11.1: @Use.%.loc9_11.2 (%.aaf) = impl_witness_access %T.as_wit.loc9_11.1, element0 [symbolic = %impl.elem0.loc9_11.2 (constants.%impl.elem0)]
  230. // CHECK:STDOUT: %specific_fn.loc9_11.1: <specific function> = specific_function %impl.elem0.loc9_11.1, @Make(constants.%I.facet) [symbolic = %specific_fn.loc9_11.2 (constants.%specific_fn)]
  231. // CHECK:STDOUT: %Make.call: init @Use.%T.as_type.loc8_18.2 (%T.as_type) = call %specific_fn.loc9_11.1()
  232. // CHECK:STDOUT: %.loc9_17.1: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = temporary_storage
  233. // CHECK:STDOUT: %.loc9_17.2: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = temporary %.loc9_17.1, %Make.call
  234. // CHECK:STDOUT: %.loc9_17.3: @Use.%T.as_type.loc8_18.2 (%T.as_type) = bind_value %.loc9_17.2
  235. // CHECK:STDOUT: return %.loc9_17.3
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: specific @Make(constants.%Self) {
  240. // CHECK:STDOUT: %Self => constants.%Self
  241. // CHECK:STDOUT: %Self.as_type.loc5_16.1 => constants.%Self.as_type
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: specific @Use(constants.%T) {
  245. // CHECK:STDOUT: %T.loc8_8.2 => constants.%T
  246. // CHECK:STDOUT: %T.patt.loc8_8.2 => constants.%T
  247. // CHECK:STDOUT: %T.as_type.loc8_18.2 => constants.%T.as_type
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: specific @Make(constants.%I.facet) {
  251. // CHECK:STDOUT: %Self => constants.%I.facet
  252. // CHECK:STDOUT: %Self.as_type.loc5_16.1 => constants.%T.as_type
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @Make(@Use.%I.facet) {}
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: --- fail_todo_access_assoc_method.carbon
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: constants {
  260. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  261. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  262. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  263. // CHECK:STDOUT: %Copy.type: type = fn_type @Copy [template]
  264. // CHECK:STDOUT: %Copy: %Copy.type = struct_value () [template]
  265. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  266. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Copy.decl [template]
  267. // CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
  268. // CHECK:STDOUT: %T.patt: %I.type = symbolic_binding_pattern T, 0 [symbolic]
  269. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  270. // CHECK:STDOUT: %Use.type: type = fn_type @Use [template]
  271. // CHECK:STDOUT: %Use: %Use.type = struct_value () [template]
  272. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type [symbolic]
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: file {
  276. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  277. // CHECK:STDOUT: .I = %I.decl
  278. // CHECK:STDOUT: .Use = %Use.decl
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  281. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [template = constants.%Use] {
  282. // CHECK:STDOUT: %T.patt.loc8_8.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  283. // CHECK:STDOUT: %T.param_patt: %I.type = value_param_pattern %T.patt.loc8_8.1, runtime_param<none> [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  284. // CHECK:STDOUT: %x.patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = binding_pattern x
  285. // CHECK:STDOUT: %x.param_patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0
  286. // CHECK:STDOUT: %return.patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = return_slot_pattern
  287. // CHECK:STDOUT: %return.param_patt: @Use.%T.as_type.loc8_18.2 (%T.as_type) = out_param_pattern %return.patt, runtime_param1
  288. // CHECK:STDOUT: } {
  289. // CHECK:STDOUT: %T.ref.loc8_24: %I.type = name_ref T, %T.loc8_8.1 [symbolic = %T.loc8_8.2 (constants.%T)]
  290. // CHECK:STDOUT: %T.as_type.loc8_24: type = facet_access_type %T.ref.loc8_24 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  291. // CHECK:STDOUT: %.loc8_24: type = converted %T.ref.loc8_24, %T.as_type.loc8_24 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  292. // CHECK:STDOUT: %T.param: %I.type = value_param runtime_param<none>
  293. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  294. // CHECK:STDOUT: %T.loc8_8.1: %I.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_8.2 (constants.%T)]
  295. // CHECK:STDOUT: %x.param: @Use.%T.as_type.loc8_18.2 (%T.as_type) = value_param runtime_param0
  296. // CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.2 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)] {
  297. // CHECK:STDOUT: %T.ref.loc8_18: %I.type = name_ref T, %T.loc8_8.1 [symbolic = %T.loc8_8.2 (constants.%T)]
  298. // CHECK:STDOUT: %T.as_type.loc8_18.1: type = facet_access_type %T.ref.loc8_18 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  299. // CHECK:STDOUT: %.loc8_18.2: type = converted %T.ref.loc8_18, %T.as_type.loc8_18.1 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT: %x: @Use.%T.as_type.loc8_18.2 (%T.as_type) = bind_name x, %x.param
  302. // CHECK:STDOUT: %return.param: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = out_param runtime_param1
  303. // CHECK:STDOUT: %return: ref @Use.%T.as_type.loc8_18.2 (%T.as_type) = return_slot %return.param
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: interface @I {
  308. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  309. // CHECK:STDOUT: %Copy.decl: %Copy.type = fn_decl @Copy [template = constants.%Copy] {
  310. // CHECK:STDOUT: %self.patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = binding_pattern self
  311. // CHECK:STDOUT: %self.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0
  312. // CHECK:STDOUT: %return.patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = return_slot_pattern
  313. // CHECK:STDOUT: %return.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = out_param_pattern %return.patt, runtime_param1
  314. // CHECK:STDOUT: } {
  315. // CHECK:STDOUT: %Self.ref.loc5_28: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  316. // CHECK:STDOUT: %Self.as_type.loc5_28: type = facet_access_type %Self.ref.loc5_28 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  317. // CHECK:STDOUT: %.loc5_28: type = converted %Self.ref.loc5_28, %Self.as_type.loc5_28 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  318. // CHECK:STDOUT: %self.param: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = value_param runtime_param0
  319. // CHECK:STDOUT: %.loc5_17.1: type = splice_block %.loc5_17.2 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)] {
  320. // CHECK:STDOUT: %Self.ref.loc5_17: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  321. // CHECK:STDOUT: %Self.as_type.loc5_17.2: type = facet_access_type %Self.ref.loc5_17 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  322. // CHECK:STDOUT: %.loc5_17.2: type = converted %Self.ref.loc5_17, %Self.as_type.loc5_17.2 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT: %self: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = bind_name self, %self.param
  325. // CHECK:STDOUT: %return.param: ref @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = out_param runtime_param1
  326. // CHECK:STDOUT: %return: ref @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = return_slot %return.param
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %Copy.decl [template = constants.%assoc0]
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: !members:
  331. // CHECK:STDOUT: .Self = %Self
  332. // CHECK:STDOUT: .Copy = %assoc0
  333. // CHECK:STDOUT: witness = (%Copy.decl)
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: generic fn @Copy(@I.%Self: %I.type) {
  337. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  338. // CHECK:STDOUT: %Self.as_type.loc5_17.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: fn[%self.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type)]() -> @Copy.%Self.as_type.loc5_17.1 (%Self.as_type);
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: generic fn @Use(%T.loc8_8.1: %I.type) {
  344. // CHECK:STDOUT: %T.loc8_8.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_8.2 (constants.%T)]
  345. // CHECK:STDOUT: %T.patt.loc8_8.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_8.2 (constants.%T.patt)]
  346. // CHECK:STDOUT: %T.as_type.loc8_18.2: type = facet_access_type %T.loc8_8.2 [symbolic = %T.as_type.loc8_18.2 (constants.%T.as_type)]
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: !definition:
  349. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @Use.%T.as_type.loc8_18.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)]
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: fn[%T.param_patt: %I.type](%x.param_patt: @Use.%T.as_type.loc8_18.2 (%T.as_type)) -> @Use.%T.as_type.loc8_18.2 (%T.as_type) {
  352. // CHECK:STDOUT: !entry:
  353. // CHECK:STDOUT: %x.ref: @Use.%T.as_type.loc8_18.2 (%T.as_type) = name_ref x, %x
  354. // CHECK:STDOUT: return <error>
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @Copy(constants.%Self) {
  359. // CHECK:STDOUT: %Self => constants.%Self
  360. // CHECK:STDOUT: %Self.as_type.loc5_17.1 => constants.%Self.as_type
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: specific @Use(constants.%T) {
  364. // CHECK:STDOUT: %T.loc8_8.2 => constants.%T
  365. // CHECK:STDOUT: %T.patt.loc8_8.2 => constants.%T
  366. // CHECK:STDOUT: %T.as_type.loc8_18.2 => constants.%T.as_type
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: --- access_assoc_method_indirect.carbon
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: constants {
  372. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  373. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  374. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  375. // CHECK:STDOUT: %Copy.type: type = fn_type @Copy [template]
  376. // CHECK:STDOUT: %Copy: %Copy.type = struct_value () [template]
  377. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [template]
  378. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Copy.decl [template]
  379. // CHECK:STDOUT: %T: %I.type = bind_symbolic_name T, 0 [symbolic]
  380. // CHECK:STDOUT: %T.patt: %I.type = symbolic_binding_pattern T, 0 [symbolic]
  381. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  382. // CHECK:STDOUT: %UseIndirect.type: type = fn_type @UseIndirect [template]
  383. // CHECK:STDOUT: %UseIndirect: %UseIndirect.type = struct_value () [template]
  384. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type [symbolic]
  385. // CHECK:STDOUT: %T.as_wit: <witness> = facet_access_witness %T [symbolic]
  386. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type, %T.as_wit [symbolic]
  387. // CHECK:STDOUT: %.4ef: type = fn_type_with_self_type %Copy.type, %I.facet [symbolic]
  388. // CHECK:STDOUT: %impl.elem0: %.4ef = impl_witness_access %T.as_wit, element0 [symbolic]
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: file {
  392. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  393. // CHECK:STDOUT: .I = %I.decl
  394. // CHECK:STDOUT: .UseIndirect = %UseIndirect.decl
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  397. // CHECK:STDOUT: %UseIndirect.decl: %UseIndirect.type = fn_decl @UseIndirect [template = constants.%UseIndirect] {
  398. // CHECK:STDOUT: %T.patt.loc8_16.1: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_16.2 (constants.%T.patt)]
  399. // CHECK:STDOUT: %T.param_patt: %I.type = value_param_pattern %T.patt.loc8_16.1, runtime_param<none> [symbolic = %T.patt.loc8_16.2 (constants.%T.patt)]
  400. // CHECK:STDOUT: %x.patt: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = binding_pattern x
  401. // CHECK:STDOUT: %x.param_patt: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = value_param_pattern %x.patt, runtime_param0
  402. // CHECK:STDOUT: %return.patt: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = return_slot_pattern
  403. // CHECK:STDOUT: %return.param_patt: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = out_param_pattern %return.patt, runtime_param1
  404. // CHECK:STDOUT: } {
  405. // CHECK:STDOUT: %T.ref.loc8_32: %I.type = name_ref T, %T.loc8_16.1 [symbolic = %T.loc8_16.2 (constants.%T)]
  406. // CHECK:STDOUT: %T.as_type.loc8_32: type = facet_access_type %T.ref.loc8_32 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  407. // CHECK:STDOUT: %.loc8_32: type = converted %T.ref.loc8_32, %T.as_type.loc8_32 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  408. // CHECK:STDOUT: %T.param: %I.type = value_param runtime_param<none>
  409. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  410. // CHECK:STDOUT: %T.loc8_16.1: %I.type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_16.2 (constants.%T)]
  411. // CHECK:STDOUT: %x.param: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = value_param runtime_param0
  412. // CHECK:STDOUT: %.loc8_26.1: type = splice_block %.loc8_26.2 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)] {
  413. // CHECK:STDOUT: %T.ref.loc8_26: %I.type = name_ref T, %T.loc8_16.1 [symbolic = %T.loc8_16.2 (constants.%T)]
  414. // CHECK:STDOUT: %T.as_type.loc8_26.1: type = facet_access_type %T.ref.loc8_26 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  415. // CHECK:STDOUT: %.loc8_26.2: type = converted %T.ref.loc8_26, %T.as_type.loc8_26.1 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT: %x: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = bind_name x, %x.param
  418. // CHECK:STDOUT: %return.param: ref @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = out_param runtime_param1
  419. // CHECK:STDOUT: %return: ref @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = return_slot %return.param
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: interface @I {
  424. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  425. // CHECK:STDOUT: %Copy.decl: %Copy.type = fn_decl @Copy [template = constants.%Copy] {
  426. // CHECK:STDOUT: %self.patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = binding_pattern self
  427. // CHECK:STDOUT: %self.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = value_param_pattern %self.patt, runtime_param0
  428. // CHECK:STDOUT: %return.patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = return_slot_pattern
  429. // CHECK:STDOUT: %return.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = out_param_pattern %return.patt, runtime_param1
  430. // CHECK:STDOUT: } {
  431. // CHECK:STDOUT: %Self.ref.loc5_28: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  432. // CHECK:STDOUT: %Self.as_type.loc5_28: type = facet_access_type %Self.ref.loc5_28 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  433. // CHECK:STDOUT: %.loc5_28: type = converted %Self.ref.loc5_28, %Self.as_type.loc5_28 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  434. // CHECK:STDOUT: %self.param: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = value_param runtime_param0
  435. // CHECK:STDOUT: %.loc5_17.1: type = splice_block %.loc5_17.2 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)] {
  436. // CHECK:STDOUT: %Self.ref.loc5_17: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  437. // CHECK:STDOUT: %Self.as_type.loc5_17.2: type = facet_access_type %Self.ref.loc5_17 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  438. // CHECK:STDOUT: %.loc5_17.2: type = converted %Self.ref.loc5_17, %Self.as_type.loc5_17.2 [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: %self: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = bind_name self, %self.param
  441. // CHECK:STDOUT: %return.param: ref @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = out_param runtime_param1
  442. // CHECK:STDOUT: %return: ref @Copy.%Self.as_type.loc5_17.1 (%Self.as_type) = return_slot %return.param
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %Copy.decl [template = constants.%assoc0]
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: !members:
  447. // CHECK:STDOUT: .Self = %Self
  448. // CHECK:STDOUT: .Copy = %assoc0
  449. // CHECK:STDOUT: witness = (%Copy.decl)
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: generic fn @Copy(@I.%Self: %I.type) {
  453. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  454. // CHECK:STDOUT: %Self.as_type.loc5_17.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc5_17.1 (constants.%Self.as_type)]
  455. // CHECK:STDOUT:
  456. // CHECK:STDOUT: fn[%self.param_patt: @Copy.%Self.as_type.loc5_17.1 (%Self.as_type)]() -> @Copy.%Self.as_type.loc5_17.1 (%Self.as_type);
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: generic fn @UseIndirect(%T.loc8_16.1: %I.type) {
  460. // CHECK:STDOUT: %T.loc8_16.2: %I.type = bind_symbolic_name T, 0 [symbolic = %T.loc8_16.2 (constants.%T)]
  461. // CHECK:STDOUT: %T.patt.loc8_16.2: %I.type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_16.2 (constants.%T.patt)]
  462. // CHECK:STDOUT: %T.as_type.loc8_26.2: type = facet_access_type %T.loc8_16.2 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: !definition:
  465. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) [symbolic = %require_complete (constants.%require_complete)]
  466. // CHECK:STDOUT: %T.as_wit.loc9_14.2: <witness> = facet_access_witness %T.loc8_16.2 [symbolic = %T.as_wit.loc9_14.2 (constants.%T.as_wit)]
  467. // CHECK:STDOUT: %I.facet: %I.type = facet_value %T.as_type.loc8_26.2, %T.as_wit.loc9_14.2 [symbolic = %I.facet (constants.%I.facet)]
  468. // CHECK:STDOUT: %.loc9_14.2: type = fn_type_with_self_type constants.%Copy.type, %I.facet [symbolic = %.loc9_14.2 (constants.%.4ef)]
  469. // CHECK:STDOUT: %impl.elem0.loc9_14.2: @UseIndirect.%.loc9_14.2 (%.4ef) = impl_witness_access %T.as_wit.loc9_14.2, element0 [symbolic = %impl.elem0.loc9_14.2 (constants.%impl.elem0)]
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: fn[%T.param_patt: %I.type](%x.param_patt: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type)) -> @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) {
  472. // CHECK:STDOUT: !entry:
  473. // CHECK:STDOUT: %x.ref: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = name_ref x, %x
  474. // CHECK:STDOUT: %T.ref.loc9: %I.type = name_ref T, %T.loc8_16.1 [symbolic = %T.loc8_16.2 (constants.%T)]
  475. // CHECK:STDOUT: %Copy.ref: %I.assoc_type = name_ref Copy, @I.%assoc0 [template = constants.%assoc0]
  476. // CHECK:STDOUT: %T.as_type.loc9: type = facet_access_type %T.ref.loc9 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  477. // CHECK:STDOUT: %.loc9_14.1: type = converted %T.ref.loc9, %T.as_type.loc9 [symbolic = %T.as_type.loc8_26.2 (constants.%T.as_type)]
  478. // CHECK:STDOUT: %T.as_wit.loc9_14.1: <witness> = facet_access_witness %T.ref.loc9 [symbolic = %T.as_wit.loc9_14.2 (constants.%T.as_wit)]
  479. // CHECK:STDOUT: %impl.elem0.loc9_14.1: @UseIndirect.%.loc9_14.2 (%.4ef) = impl_witness_access %T.as_wit.loc9_14.1, element0 [symbolic = %impl.elem0.loc9_14.2 (constants.%impl.elem0)]
  480. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %x.ref, %impl.elem0.loc9_14.1
  481. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %bound_method, @Copy(constants.%I.facet)
  482. // CHECK:STDOUT: %Copy.call: init @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = call %specific_fn(%x.ref)
  483. // CHECK:STDOUT: %.loc9_21.1: ref @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = temporary_storage
  484. // CHECK:STDOUT: %.loc9_21.2: ref @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = temporary %.loc9_21.1, %Copy.call
  485. // CHECK:STDOUT: %.loc9_21.3: @UseIndirect.%T.as_type.loc8_26.2 (%T.as_type) = bind_value %.loc9_21.2
  486. // CHECK:STDOUT: return %.loc9_21.3
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: specific @Copy(constants.%Self) {
  491. // CHECK:STDOUT: %Self => constants.%Self
  492. // CHECK:STDOUT: %Self.as_type.loc5_17.1 => constants.%Self.as_type
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: specific @UseIndirect(constants.%T) {
  496. // CHECK:STDOUT: %T.loc8_16.2 => constants.%T
  497. // CHECK:STDOUT: %T.patt.loc8_16.2 => constants.%T
  498. // CHECK:STDOUT: %T.as_type.loc8_26.2 => constants.%T.as_type
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: specific @Copy(constants.%I.facet) {
  502. // CHECK:STDOUT: %Self => constants.%I.facet
  503. // CHECK:STDOUT: %Self.as_type.loc5_17.1 => constants.%T.as_type
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT: