call_method_on_generic_facet.carbon 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  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/function/generic/call_method_on_generic_facet.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/generic/call_method_on_generic_facet.carbon
  10. interface Generic(Scalar:! type) {
  11. fn F();
  12. }
  13. class GenericParam {}
  14. class ImplsGeneric {}
  15. impl ImplsGeneric as Generic(GenericParam) {
  16. fn F() {}
  17. }
  18. interface Other {
  19. fn G();
  20. }
  21. impl ImplsGeneric as Other {
  22. fn G();
  23. }
  24. fn CallGenericMethod(T:! type, U:! Generic(T)) {
  25. U.F();
  26. }
  27. fn G() {
  28. CallGenericMethod(GenericParam, ImplsGeneric);
  29. }
  30. // CHECK:STDOUT: --- call_method_on_generic_facet.carbon
  31. // CHECK:STDOUT:
  32. // CHECK:STDOUT: constants {
  33. // CHECK:STDOUT: %Scalar: type = bind_symbolic_name Scalar, 0 [symbolic]
  34. // CHECK:STDOUT: %Scalar.patt: type = symbolic_binding_pattern Scalar, 0 [symbolic]
  35. // CHECK:STDOUT: %Generic.type.c21: type = generic_interface_type @Generic [concrete]
  36. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  37. // CHECK:STDOUT: %Generic.generic: %Generic.type.c21 = struct_value () [concrete]
  38. // CHECK:STDOUT: %Generic.type.91ccba.1: type = facet_type <@Generic, @Generic(%Scalar)> [symbolic]
  39. // CHECK:STDOUT: %Self.dee: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic]
  40. // CHECK:STDOUT: %F.type.f439a9.1: type = fn_type @F.1, @Generic(%Scalar) [symbolic]
  41. // CHECK:STDOUT: %F.8a2d67.1: %F.type.f439a9.1 = struct_value () [symbolic]
  42. // CHECK:STDOUT: %Generic.assoc_type.de973d.1: type = assoc_entity_type %Generic.type.91ccba.1 [symbolic]
  43. // CHECK:STDOUT: %assoc0.29ce53.1: %Generic.assoc_type.de973d.1 = assoc_entity element0, @Generic.%F.decl [symbolic]
  44. // CHECK:STDOUT: %GenericParam: type = class_type @GenericParam [concrete]
  45. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  46. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  47. // CHECK:STDOUT: %ImplsGeneric: type = class_type @ImplsGeneric [concrete]
  48. // CHECK:STDOUT: %Generic.type.769: type = facet_type <@Generic, @Generic(%GenericParam)> [concrete]
  49. // CHECK:STDOUT: %F.type.4cf: type = fn_type @F.1, @Generic(%GenericParam) [concrete]
  50. // CHECK:STDOUT: %F.118: %F.type.4cf = struct_value () [concrete]
  51. // CHECK:STDOUT: %Generic.assoc_type.9f1: type = assoc_entity_type %Generic.type.769 [concrete]
  52. // CHECK:STDOUT: %assoc0.9b7: %Generic.assoc_type.9f1 = assoc_entity element0, @Generic.%F.decl [concrete]
  53. // CHECK:STDOUT: %impl_witness.b42: <witness> = impl_witness (@impl.046.%F.decl) [concrete]
  54. // CHECK:STDOUT: %F.type.17b: type = fn_type @F.2 [concrete]
  55. // CHECK:STDOUT: %F.a56: %F.type.17b = struct_value () [concrete]
  56. // CHECK:STDOUT: %Generic.facet.8bd: %Generic.type.769 = facet_value %ImplsGeneric, (%impl_witness.b42) [concrete]
  57. // CHECK:STDOUT: %Other.type: type = facet_type <@Other> [concrete]
  58. // CHECK:STDOUT: %Self.807: %Other.type = bind_symbolic_name Self, 0 [symbolic]
  59. // CHECK:STDOUT: %G.type.0c6: type = fn_type @G.1 [concrete]
  60. // CHECK:STDOUT: %G.17f: %G.type.0c6 = struct_value () [concrete]
  61. // CHECK:STDOUT: %Other.assoc_type: type = assoc_entity_type %Other.type [concrete]
  62. // CHECK:STDOUT: %assoc0.5ce: %Other.assoc_type = assoc_entity element0, @Other.%G.decl [concrete]
  63. // CHECK:STDOUT: %impl_witness.51c: <witness> = impl_witness (@impl.728.%G.decl) [concrete]
  64. // CHECK:STDOUT: %G.type.58d: type = fn_type @G.2 [concrete]
  65. // CHECK:STDOUT: %G.b67: %G.type.58d = struct_value () [concrete]
  66. // CHECK:STDOUT: %Other.facet: %Other.type = facet_value %ImplsGeneric, (%impl_witness.51c) [concrete]
  67. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  68. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  69. // CHECK:STDOUT: %Generic.type.91ccba.2: type = facet_type <@Generic, @Generic(%T)> [symbolic]
  70. // CHECK:STDOUT: %U: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic]
  71. // CHECK:STDOUT: %U.patt: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic]
  72. // CHECK:STDOUT: %CallGenericMethod.type: type = fn_type @CallGenericMethod [concrete]
  73. // CHECK:STDOUT: %CallGenericMethod: %CallGenericMethod.type = struct_value () [concrete]
  74. // CHECK:STDOUT: %F.type.f439a9.2: type = fn_type @F.1, @Generic(%T) [symbolic]
  75. // CHECK:STDOUT: %F.8a2d67.2: %F.type.f439a9.2 = struct_value () [symbolic]
  76. // CHECK:STDOUT: %Generic.assoc_type.de973d.2: type = assoc_entity_type %Generic.type.91ccba.2 [symbolic]
  77. // CHECK:STDOUT: %assoc0.29ce53.2: %Generic.assoc_type.de973d.2 = assoc_entity element0, @Generic.%F.decl [symbolic]
  78. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %Generic.type.91ccba.2 [symbolic]
  79. // CHECK:STDOUT: %U.as_type: type = facet_access_type %U [symbolic]
  80. // CHECK:STDOUT: %U.as_wit.iface0: <witness> = facet_access_witness %U, element0 [symbolic]
  81. // CHECK:STDOUT: %Generic.facet.0aa: %Generic.type.91ccba.2 = facet_value %U.as_type, (%U.as_wit.iface0) [symbolic]
  82. // CHECK:STDOUT: %.10b: type = fn_type_with_self_type %F.type.f439a9.2, %Generic.facet.0aa [symbolic]
  83. // CHECK:STDOUT: %impl.elem0: %.10b = impl_witness_access %U.as_wit.iface0, element0 [symbolic]
  84. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @F.1(%T, %Generic.facet.0aa) [symbolic]
  85. // CHECK:STDOUT: %G.type.9f9: type = fn_type @G.3 [concrete]
  86. // CHECK:STDOUT: %G.57b: %G.type.9f9 = struct_value () [concrete]
  87. // CHECK:STDOUT: %CallGenericMethod.specific_fn: <specific function> = specific_function %CallGenericMethod, @CallGenericMethod(%GenericParam, %Generic.facet.8bd) [concrete]
  88. // CHECK:STDOUT: %complete_type.997: <witness> = complete_type_witness %Generic.type.769 [concrete]
  89. // CHECK:STDOUT: %.1eb: type = fn_type_with_self_type %F.type.4cf, %Generic.facet.8bd [concrete]
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: imports {
  93. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  94. // CHECK:STDOUT: import Core//prelude
  95. // CHECK:STDOUT: import Core//prelude/...
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: file {
  100. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  101. // CHECK:STDOUT: .Core = imports.%Core
  102. // CHECK:STDOUT: .Generic = %Generic.decl
  103. // CHECK:STDOUT: .GenericParam = %GenericParam.decl
  104. // CHECK:STDOUT: .ImplsGeneric = %ImplsGeneric.decl
  105. // CHECK:STDOUT: .Other = %Other.decl
  106. // CHECK:STDOUT: .CallGenericMethod = %CallGenericMethod.decl
  107. // CHECK:STDOUT: .G = %G.decl
  108. // CHECK:STDOUT: }
  109. // CHECK:STDOUT: %Core.import = import Core
  110. // CHECK:STDOUT: %Generic.decl: %Generic.type.c21 = interface_decl @Generic [concrete = constants.%Generic.generic] {
  111. // CHECK:STDOUT: %Scalar.patt.loc11_19.1: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc11_19.2 (constants.%Scalar.patt)]
  112. // CHECK:STDOUT: } {
  113. // CHECK:STDOUT: %Scalar.loc11_19.1: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc11_19.2 (constants.%Scalar)]
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT: %GenericParam.decl: type = class_decl @GenericParam [concrete = constants.%GenericParam] {} {}
  116. // CHECK:STDOUT: %ImplsGeneric.decl: type = class_decl @ImplsGeneric [concrete = constants.%ImplsGeneric] {} {}
  117. // CHECK:STDOUT: impl_decl @impl.046 [concrete] {} {
  118. // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric]
  119. // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic]
  120. // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam]
  121. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(constants.%GenericParam)> [concrete = constants.%Generic.type.769]
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT: %impl_witness.loc18: <witness> = impl_witness (@impl.046.%F.decl) [concrete = constants.%impl_witness.b42]
  124. // CHECK:STDOUT: %Other.decl: type = interface_decl @Other [concrete = constants.%Other.type] {} {}
  125. // CHECK:STDOUT: impl_decl @impl.728 [concrete] {} {
  126. // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric]
  127. // CHECK:STDOUT: %Other.ref: type = name_ref Other, file.%Other.decl [concrete = constants.%Other.type]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT: %impl_witness.loc25: <witness> = impl_witness (@impl.728.%G.decl) [concrete = constants.%impl_witness.51c]
  130. // CHECK:STDOUT: %CallGenericMethod.decl: %CallGenericMethod.type = fn_decl @CallGenericMethod [concrete = constants.%CallGenericMethod] {
  131. // CHECK:STDOUT: %T.patt.loc29_22.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc29_22.2 (constants.%T.patt)]
  132. // CHECK:STDOUT: %U.patt.loc29_32.1: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc29_32.2 (constants.%U.patt)]
  133. // CHECK:STDOUT: } {
  134. // CHECK:STDOUT: %T.loc29_22.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc29_22.2 (constants.%T)]
  135. // CHECK:STDOUT: %.loc29: type = splice_block %Generic.type.loc29_45.1 [symbolic = %Generic.type.loc29_45.2 (constants.%Generic.type.91ccba.2)] {
  136. // CHECK:STDOUT: %Generic.ref: %Generic.type.c21 = name_ref Generic, file.%Generic.decl [concrete = constants.%Generic.generic]
  137. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc29_22.1 [symbolic = %T.loc29_22.2 (constants.%T)]
  138. // CHECK:STDOUT: %Generic.type.loc29_45.1: type = facet_type <@Generic, @Generic(constants.%T)> [symbolic = %Generic.type.loc29_45.2 (constants.%Generic.type.91ccba.2)]
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT: %U.loc29_32.1: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) = bind_symbolic_name U, 1 [symbolic = %U.loc29_32.2 (constants.%U)]
  141. // CHECK:STDOUT: }
  142. // CHECK:STDOUT: %G.decl: %G.type.9f9 = fn_decl @G.3 [concrete = constants.%G.57b] {} {}
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: generic interface @Generic(%Scalar.loc11_19.1: type) {
  146. // CHECK:STDOUT: %Scalar.loc11_19.2: type = bind_symbolic_name Scalar, 0 [symbolic = %Scalar.loc11_19.2 (constants.%Scalar)]
  147. // CHECK:STDOUT: %Scalar.patt.loc11_19.2: type = symbolic_binding_pattern Scalar, 0 [symbolic = %Scalar.patt.loc11_19.2 (constants.%Scalar.patt)]
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: !definition:
  150. // CHECK:STDOUT: %Generic.type: type = facet_type <@Generic, @Generic(%Scalar.loc11_19.2)> [symbolic = %Generic.type (constants.%Generic.type.91ccba.1)]
  151. // CHECK:STDOUT: %Self.2: %Generic.type.91ccba.1 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.dee)]
  152. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%Scalar.loc11_19.2) [symbolic = %F.type (constants.%F.type.f439a9.1)]
  153. // CHECK:STDOUT: %F: @Generic.%F.type (%F.type.f439a9.1) = struct_value () [symbolic = %F (constants.%F.8a2d67.1)]
  154. // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @Generic.%Generic.type (%Generic.type.91ccba.1) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de973d.1)]
  155. // CHECK:STDOUT: %assoc0.loc12_9.2: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc12_9.2 (constants.%assoc0.29ce53.1)]
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: interface {
  158. // CHECK:STDOUT: %Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self.dee)]
  159. // CHECK:STDOUT: %F.decl: @Generic.%F.type (%F.type.f439a9.1) = fn_decl @F.1 [symbolic = @Generic.%F (constants.%F.8a2d67.1)] {} {}
  160. // CHECK:STDOUT: %assoc0.loc12_9.1: @Generic.%Generic.assoc_type (%Generic.assoc_type.de973d.1) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc12_9.2 (constants.%assoc0.29ce53.1)]
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: !members:
  163. // CHECK:STDOUT: .Self = %Self.1
  164. // CHECK:STDOUT: .F = %assoc0.loc12_9.1
  165. // CHECK:STDOUT: witness = (%F.decl)
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: interface @Other {
  170. // CHECK:STDOUT: %Self: %Other.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.807]
  171. // CHECK:STDOUT: %G.decl: %G.type.0c6 = fn_decl @G.1 [concrete = constants.%G.17f] {} {}
  172. // CHECK:STDOUT: %assoc0: %Other.assoc_type = assoc_entity element0, %G.decl [concrete = constants.%assoc0.5ce]
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: !members:
  175. // CHECK:STDOUT: .Self = %Self
  176. // CHECK:STDOUT: .G = %assoc0
  177. // CHECK:STDOUT: witness = (%G.decl)
  178. // CHECK:STDOUT: }
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: impl @impl.046: %ImplsGeneric.ref as %Generic.type {
  181. // CHECK:STDOUT: %F.decl: %F.type.17b = fn_decl @F.2 [concrete = constants.%F.a56] {} {}
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: !members:
  184. // CHECK:STDOUT: .F = %F.decl
  185. // CHECK:STDOUT: witness = file.%impl_witness.loc18
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: impl @impl.728: %ImplsGeneric.ref as %Other.ref {
  189. // CHECK:STDOUT: %G.decl: %G.type.58d = fn_decl @G.2 [concrete = constants.%G.b67] {} {}
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: !members:
  192. // CHECK:STDOUT: .G = %G.decl
  193. // CHECK:STDOUT: witness = file.%impl_witness.loc25
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: class @GenericParam {
  197. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  198. // CHECK:STDOUT: complete_type_witness = %complete_type
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: !members:
  201. // CHECK:STDOUT: .Self = constants.%GenericParam
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: class @ImplsGeneric {
  205. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  206. // CHECK:STDOUT: complete_type_witness = %complete_type
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: !members:
  209. // CHECK:STDOUT: .Self = constants.%ImplsGeneric
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: generic fn @F.1(@Generic.%Scalar.loc11_19.1: type, @Generic.%Self.1: @Generic.%Generic.type (%Generic.type.91ccba.1)) {
  213. // CHECK:STDOUT: fn();
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: fn @F.2() {
  217. // CHECK:STDOUT: !entry:
  218. // CHECK:STDOUT: return
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: generic fn @G.1(@Other.%Self: %Other.type) {
  222. // CHECK:STDOUT: fn();
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: fn @G.2();
  226. // CHECK:STDOUT:
  227. // CHECK:STDOUT: generic fn @CallGenericMethod(%T.loc29_22.1: type, %U.loc29_32.1: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2)) {
  228. // CHECK:STDOUT: %T.loc29_22.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc29_22.2 (constants.%T)]
  229. // CHECK:STDOUT: %T.patt.loc29_22.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc29_22.2 (constants.%T.patt)]
  230. // CHECK:STDOUT: %Generic.type.loc29_45.2: type = facet_type <@Generic, @Generic(%T.loc29_22.2)> [symbolic = %Generic.type.loc29_45.2 (constants.%Generic.type.91ccba.2)]
  231. // CHECK:STDOUT: %U.loc29_32.2: %Generic.type.91ccba.2 = bind_symbolic_name U, 1 [symbolic = %U.loc29_32.2 (constants.%U)]
  232. // CHECK:STDOUT: %U.patt.loc29_32.2: %Generic.type.91ccba.2 = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc29_32.2 (constants.%U.patt)]
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: !definition:
  235. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) [symbolic = %require_complete (constants.%require_complete)]
  236. // CHECK:STDOUT: %Generic.assoc_type: type = assoc_entity_type @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) [symbolic = %Generic.assoc_type (constants.%Generic.assoc_type.de973d.2)]
  237. // CHECK:STDOUT: %assoc0: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = assoc_entity element0, @Generic.%F.decl [symbolic = %assoc0 (constants.%assoc0.29ce53.2)]
  238. // CHECK:STDOUT: %U.as_type.loc30_4.2: type = facet_access_type %U.loc29_32.2 [symbolic = %U.as_type.loc30_4.2 (constants.%U.as_type)]
  239. // CHECK:STDOUT: %U.as_wit.iface0.loc30_4.2: <witness> = facet_access_witness %U.loc29_32.2, element0 [symbolic = %U.as_wit.iface0.loc30_4.2 (constants.%U.as_wit.iface0)]
  240. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @Generic(%T.loc29_22.2) [symbolic = %F.type (constants.%F.type.f439a9.2)]
  241. // CHECK:STDOUT: %Generic.facet: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) = facet_value %U.as_type.loc30_4.2, (%U.as_wit.iface0.loc30_4.2) [symbolic = %Generic.facet (constants.%Generic.facet.0aa)]
  242. // CHECK:STDOUT: %.loc30_4.3: type = fn_type_with_self_type %F.type, %Generic.facet [symbolic = %.loc30_4.3 (constants.%.10b)]
  243. // CHECK:STDOUT: %impl.elem0.loc30_4.2: @CallGenericMethod.%.loc30_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.loc30_4.2, element0 [symbolic = %impl.elem0.loc30_4.2 (constants.%impl.elem0)]
  244. // CHECK:STDOUT: %specific_impl_fn.loc30_4.2: <specific function> = specific_impl_function %impl.elem0.loc30_4.2, @F.1(%T.loc29_22.2, %Generic.facet) [symbolic = %specific_impl_fn.loc30_4.2 (constants.%specific_impl_fn)]
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: fn(%T.patt.loc29_22.1: type, %U.patt.loc29_32.1: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2)) {
  247. // CHECK:STDOUT: !entry:
  248. // CHECK:STDOUT: %U.ref: @CallGenericMethod.%Generic.type.loc29_45.2 (%Generic.type.91ccba.2) = name_ref U, %U.loc29_32.1 [symbolic = %U.loc29_32.2 (constants.%U)]
  249. // CHECK:STDOUT: %.loc30_4.1: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = specific_constant @Generic.%assoc0.loc12_9.1, @Generic(constants.%T) [symbolic = %assoc0 (constants.%assoc0.29ce53.2)]
  250. // CHECK:STDOUT: %F.ref: @CallGenericMethod.%Generic.assoc_type (%Generic.assoc_type.de973d.2) = name_ref F, %.loc30_4.1 [symbolic = %assoc0 (constants.%assoc0.29ce53.2)]
  251. // CHECK:STDOUT: %U.as_type.loc30_4.1: type = facet_access_type %U.ref [symbolic = %U.as_type.loc30_4.2 (constants.%U.as_type)]
  252. // CHECK:STDOUT: %.loc30_4.2: type = converted %U.ref, %U.as_type.loc30_4.1 [symbolic = %U.as_type.loc30_4.2 (constants.%U.as_type)]
  253. // CHECK:STDOUT: %U.as_wit.iface0.loc30_4.1: <witness> = facet_access_witness %U.ref, element0 [symbolic = %U.as_wit.iface0.loc30_4.2 (constants.%U.as_wit.iface0)]
  254. // CHECK:STDOUT: %impl.elem0.loc30_4.1: @CallGenericMethod.%.loc30_4.3 (%.10b) = impl_witness_access %U.as_wit.iface0.loc30_4.1, element0 [symbolic = %impl.elem0.loc30_4.2 (constants.%impl.elem0)]
  255. // CHECK:STDOUT: %specific_impl_fn.loc30_4.1: <specific function> = specific_impl_function %impl.elem0.loc30_4.1, @F.1(constants.%T, constants.%Generic.facet.0aa) [symbolic = %specific_impl_fn.loc30_4.2 (constants.%specific_impl_fn)]
  256. // CHECK:STDOUT: %.loc30_7: init %empty_tuple.type = call %specific_impl_fn.loc30_4.1()
  257. // CHECK:STDOUT: return
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: fn @G.3() {
  262. // CHECK:STDOUT: !entry:
  263. // CHECK:STDOUT: %CallGenericMethod.ref: %CallGenericMethod.type = name_ref CallGenericMethod, file.%CallGenericMethod.decl [concrete = constants.%CallGenericMethod]
  264. // CHECK:STDOUT: %GenericParam.ref: type = name_ref GenericParam, file.%GenericParam.decl [concrete = constants.%GenericParam]
  265. // CHECK:STDOUT: %ImplsGeneric.ref: type = name_ref ImplsGeneric, file.%ImplsGeneric.decl [concrete = constants.%ImplsGeneric]
  266. // CHECK:STDOUT: %Generic.facet: %Generic.type.769 = facet_value constants.%ImplsGeneric, (constants.%impl_witness.b42) [concrete = constants.%Generic.facet.8bd]
  267. // CHECK:STDOUT: %.loc34: %Generic.type.769 = converted constants.%ImplsGeneric, %Generic.facet [concrete = constants.%Generic.facet.8bd]
  268. // CHECK:STDOUT: %CallGenericMethod.specific_fn: <specific function> = specific_function %CallGenericMethod.ref, @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet.8bd) [concrete = constants.%CallGenericMethod.specific_fn]
  269. // CHECK:STDOUT: %CallGenericMethod.call: init %empty_tuple.type = call %CallGenericMethod.specific_fn()
  270. // CHECK:STDOUT: return
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: specific @Generic(constants.%Scalar) {
  274. // CHECK:STDOUT: %Scalar.loc11_19.2 => constants.%Scalar
  275. // CHECK:STDOUT: %Scalar.patt.loc11_19.2 => constants.%Scalar
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: specific @F.1(constants.%Scalar, constants.%Self.dee) {}
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: specific @Generic(%Scalar.loc11_19.2) {}
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @Generic(constants.%GenericParam) {
  283. // CHECK:STDOUT: %Scalar.loc11_19.2 => constants.%GenericParam
  284. // CHECK:STDOUT: %Scalar.patt.loc11_19.2 => constants.%GenericParam
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: !definition:
  287. // CHECK:STDOUT: %Generic.type => constants.%Generic.type.769
  288. // CHECK:STDOUT: %Self.2 => constants.%Self.dee
  289. // CHECK:STDOUT: %F.type => constants.%F.type.4cf
  290. // CHECK:STDOUT: %F => constants.%F.118
  291. // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1
  292. // CHECK:STDOUT: %assoc0.loc12_9.2 => constants.%assoc0.9b7
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: specific @F.1(constants.%GenericParam, constants.%Generic.facet.8bd) {}
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: specific @G.1(constants.%Self.807) {}
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: specific @G.1(constants.%Other.facet) {}
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: specific @Generic(constants.%T) {
  302. // CHECK:STDOUT: %Scalar.loc11_19.2 => constants.%T
  303. // CHECK:STDOUT: %Scalar.patt.loc11_19.2 => constants.%T
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: !definition:
  306. // CHECK:STDOUT: %Generic.type => constants.%Generic.type.91ccba.2
  307. // CHECK:STDOUT: %Self.2 => constants.%Self.dee
  308. // CHECK:STDOUT: %F.type => constants.%F.type.f439a9.2
  309. // CHECK:STDOUT: %F => constants.%F.8a2d67.2
  310. // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.de973d.2
  311. // CHECK:STDOUT: %assoc0.loc12_9.2 => constants.%assoc0.29ce53.2
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: specific @CallGenericMethod(constants.%T, constants.%U) {
  315. // CHECK:STDOUT: %T.loc29_22.2 => constants.%T
  316. // CHECK:STDOUT: %T.patt.loc29_22.2 => constants.%T
  317. // CHECK:STDOUT: %Generic.type.loc29_45.2 => constants.%Generic.type.91ccba.2
  318. // CHECK:STDOUT: %U.loc29_32.2 => constants.%U
  319. // CHECK:STDOUT: %U.patt.loc29_32.2 => constants.%U
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: specific @Generic(@CallGenericMethod.%T.loc29_22.2) {}
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Generic.facet.0aa) {}
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: specific @F.1(@CallGenericMethod.%T.loc29_22.2, @CallGenericMethod.%Generic.facet) {}
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: specific @CallGenericMethod(constants.%GenericParam, constants.%Generic.facet.8bd) {
  329. // CHECK:STDOUT: %T.loc29_22.2 => constants.%GenericParam
  330. // CHECK:STDOUT: %T.patt.loc29_22.2 => constants.%GenericParam
  331. // CHECK:STDOUT: %Generic.type.loc29_45.2 => constants.%Generic.type.769
  332. // CHECK:STDOUT: %U.loc29_32.2 => constants.%Generic.facet.8bd
  333. // CHECK:STDOUT: %U.patt.loc29_32.2 => constants.%Generic.facet.8bd
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: !definition:
  336. // CHECK:STDOUT: %require_complete => constants.%complete_type.997
  337. // CHECK:STDOUT: %Generic.assoc_type => constants.%Generic.assoc_type.9f1
  338. // CHECK:STDOUT: %assoc0 => constants.%assoc0.9b7
  339. // CHECK:STDOUT: %U.as_type.loc30_4.2 => constants.%ImplsGeneric
  340. // CHECK:STDOUT: %U.as_wit.iface0.loc30_4.2 => constants.%impl_witness.b42
  341. // CHECK:STDOUT: %F.type => constants.%F.type.4cf
  342. // CHECK:STDOUT: %Generic.facet => constants.%Generic.facet.8bd
  343. // CHECK:STDOUT: %.loc30_4.3 => constants.%.1eb
  344. // CHECK:STDOUT: %impl.elem0.loc30_4.2 => constants.%F.a56
  345. // CHECK:STDOUT: %specific_impl_fn.loc30_4.2 => constants.%F.a56
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: