call_method_on_generic_facet.carbon 23 KB

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