call_method_on_generic_facet.carbon 24 KB

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