import_self.carbon 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/destroy.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/import_self.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/import_self.carbon
  14. // --- a.carbon
  15. library "[[@TEST_NAME]]";
  16. interface Add {
  17. fn Op[self: Self](other: Self) -> Self;
  18. }
  19. // --- b.carbon
  20. library "[[@TEST_NAME]]";
  21. import library "a";
  22. class C { adapt (); }
  23. impl C as Add {
  24. fn Op[self: Self](other: Self) -> Self { return () as C; }
  25. }
  26. fn F(x: C, y: C) -> C {
  27. return x.(Add.Op)(y);
  28. }
  29. // CHECK:STDOUT: --- a.carbon
  30. // CHECK:STDOUT:
  31. // CHECK:STDOUT: constants {
  32. // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [concrete]
  33. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic]
  34. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  35. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic]
  36. // CHECK:STDOUT: %.b66: form = init_form %Self.binding.as_type, call_param2 [symbolic]
  37. // CHECK:STDOUT: %Add.Op.type: type = fn_type @Add.Op [concrete]
  38. // CHECK:STDOUT: %Add.Op: %Add.Op.type = struct_value () [concrete]
  39. // CHECK:STDOUT: %Add.assoc_type: type = assoc_entity_type @Add [concrete]
  40. // CHECK:STDOUT: %assoc0: %Add.assoc_type = assoc_entity element0, @Add.%Add.Op.decl [concrete]
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: imports {
  44. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  45. // CHECK:STDOUT: import Core//prelude
  46. // CHECK:STDOUT: import Core//prelude/...
  47. // CHECK:STDOUT: }
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT:
  50. // CHECK:STDOUT: file {
  51. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  52. // CHECK:STDOUT: .Core = imports.%Core
  53. // CHECK:STDOUT: .Add = %Add.decl
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT: %Core.import = import Core
  56. // CHECK:STDOUT: %Add.decl: type = interface_decl @Add [concrete = constants.%Add.type] {} {}
  57. // CHECK:STDOUT: }
  58. // CHECK:STDOUT:
  59. // CHECK:STDOUT: interface @Add {
  60. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  61. // CHECK:STDOUT: %Add.Op.decl: %Add.Op.type = fn_decl @Add.Op [concrete = constants.%Add.Op] {
  62. // CHECK:STDOUT: %self.patt: @Add.Op.%pattern_type (%pattern_type) = value_binding_pattern self [concrete]
  63. // CHECK:STDOUT: %self.param_patt: @Add.Op.%pattern_type (%pattern_type) = value_param_pattern %self.patt, call_param0 [concrete]
  64. // CHECK:STDOUT: %other.patt: @Add.Op.%pattern_type (%pattern_type) = value_binding_pattern other [concrete]
  65. // CHECK:STDOUT: %other.param_patt: @Add.Op.%pattern_type (%pattern_type) = value_param_pattern %other.patt, call_param1 [concrete]
  66. // CHECK:STDOUT: %return.patt: @Add.Op.%pattern_type (%pattern_type) = return_slot_pattern [concrete]
  67. // CHECK:STDOUT: %return.param_patt: @Add.Op.%pattern_type (%pattern_type) = out_param_pattern %return.patt, call_param2 [concrete]
  68. // CHECK:STDOUT: } {
  69. // CHECK:STDOUT: %Self.ref.loc5_37: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  70. // CHECK:STDOUT: %Self.as_type.loc5_37: type = facet_access_type %Self.ref.loc5_37 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  71. // CHECK:STDOUT: %.loc5_37.2: type = converted %Self.ref.loc5_37, %Self.as_type.loc5_37 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  72. // CHECK:STDOUT: %.loc5_37.3: form = init_form %.loc5_37.2, call_param2 [symbolic = %.loc5_37.1 (constants.%.b66)]
  73. // CHECK:STDOUT: %self.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  74. // CHECK:STDOUT: %.loc5_15.1: type = splice_block %.loc5_15.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  75. // CHECK:STDOUT: %Self.ref.loc5_15: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  76. // CHECK:STDOUT: %Self.as_type.loc5_15: type = facet_access_type %Self.ref.loc5_15 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  77. // CHECK:STDOUT: %.loc5_15.2: type = converted %Self.ref.loc5_15, %Self.as_type.loc5_15 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT: %self: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  80. // CHECK:STDOUT: %other.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param1
  81. // CHECK:STDOUT: %.loc5_28.1: type = splice_block %.loc5_28.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  82. // CHECK:STDOUT: %Self.ref.loc5_28: %Add.type = name_ref Self, @Add.%Self [symbolic = %Self (constants.%Self)]
  83. // CHECK:STDOUT: %Self.as_type.loc5_28: type = facet_access_type %Self.ref.loc5_28 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  84. // CHECK:STDOUT: %.loc5_28.2: type = converted %Self.ref.loc5_28, %Self.as_type.loc5_28 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT: %other: @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = value_binding other, %other.param
  87. // CHECK:STDOUT: %return.param: ref @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = out_param call_param2
  88. // CHECK:STDOUT: %return: ref @Add.Op.%Self.binding.as_type (%Self.binding.as_type) = return_slot %return.param
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT: %assoc0: %Add.assoc_type = assoc_entity element0, %Add.Op.decl [concrete = constants.%assoc0]
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: !members:
  93. // CHECK:STDOUT: .Self = %Self
  94. // CHECK:STDOUT: .Op = %assoc0
  95. // CHECK:STDOUT: witness = (%Add.Op.decl)
  96. // CHECK:STDOUT:
  97. // CHECK:STDOUT: !requires:
  98. // CHECK:STDOUT: }
  99. // CHECK:STDOUT:
  100. // CHECK:STDOUT: generic fn @Add.Op(@Add.%Self: %Add.type) {
  101. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  102. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  103. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type)]
  104. // CHECK:STDOUT: %.loc5_37.1: form = init_form %Self.binding.as_type, call_param2 [symbolic = %.loc5_37.1 (constants.%.b66)]
  105. // CHECK:STDOUT:
  106. // CHECK:STDOUT: fn(%self.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type), %other.param: @Add.Op.%Self.binding.as_type (%Self.binding.as_type)) -> @Add.Op.%Self.binding.as_type (%Self.binding.as_type);
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: specific @Add.Op(constants.%Self) {
  110. // CHECK:STDOUT: %Self => constants.%Self
  111. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  112. // CHECK:STDOUT: %pattern_type => constants.%pattern_type
  113. // CHECK:STDOUT: %.loc5_37.1 => constants.%.b66
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: --- b.carbon
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: constants {
  119. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  120. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  121. // CHECK:STDOUT: %empty_tuple.af4: %empty_tuple.type = tuple_value () [concrete]
  122. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_tuple.type [concrete]
  123. // CHECK:STDOUT: %Add.type: type = facet_type <@Add> [concrete]
  124. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic]
  125. // CHECK:STDOUT: %Add.impl_witness: <witness> = impl_witness @C.as.Add.impl.%Add.impl_witness_table [concrete]
  126. // CHECK:STDOUT: %Add.Op.type: type = fn_type @Add.Op [concrete]
  127. // CHECK:STDOUT: %Add.Op: %Add.Op.type = struct_value () [concrete]
  128. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  129. // CHECK:STDOUT: %pattern_type.5af: type = pattern_type %Self.binding.as_type [symbolic]
  130. // CHECK:STDOUT: %.789: form = init_form %Self.binding.as_type, call_param2 [symbolic]
  131. // CHECK:STDOUT: %pattern_type.7c7: type = pattern_type %C [concrete]
  132. // CHECK:STDOUT: %.355: form = init_form %C, call_param2 [concrete]
  133. // CHECK:STDOUT: %C.as.Add.impl.Op.type: type = fn_type @C.as.Add.impl.Op [concrete]
  134. // CHECK:STDOUT: %C.as.Add.impl.Op: %C.as.Add.impl.Op.type = struct_value () [concrete]
  135. // CHECK:STDOUT: %Add.facet: %Add.type = facet_value %C, (%Add.impl_witness) [concrete]
  136. // CHECK:STDOUT: %empty_tuple.bfb: %C = tuple_value () [concrete]
  137. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  138. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  139. // CHECK:STDOUT: %Add.assoc_type: type = assoc_entity_type @Add [concrete]
  140. // CHECK:STDOUT: %assoc0: %Add.assoc_type = assoc_entity element0, imports.%Main.import_ref.4b6 [concrete]
  141. // CHECK:STDOUT: %.b2f: type = fn_type_with_self_type %Add.Op.type, %Add.facet [concrete]
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: imports {
  145. // CHECK:STDOUT: %Main.Add: type = import_ref Main//a, Add, loaded [concrete = constants.%Add.type]
  146. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  147. // CHECK:STDOUT: import Core//prelude
  148. // CHECK:STDOUT: import Core//prelude/...
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %Main.import_ref.17c = import_ref Main//a, loc4_15, unloaded
  151. // CHECK:STDOUT: %Main.import_ref.f0e: %Add.assoc_type = import_ref Main//a, loc5_41, loaded [concrete = constants.%assoc0]
  152. // CHECK:STDOUT: %Main.Op: %Add.Op.type = import_ref Main//a, Op, loaded [concrete = constants.%Add.Op]
  153. // CHECK:STDOUT: %Main.import_ref.bb0: %Add.type = import_ref Main//a, loc4_15, loaded [symbolic = constants.%Self]
  154. // CHECK:STDOUT: %Main.import_ref.4b6: %Add.Op.type = import_ref Main//a, loc5_41, loaded [concrete = constants.%Add.Op]
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: file {
  158. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  159. // CHECK:STDOUT: .Add = imports.%Main.Add
  160. // CHECK:STDOUT: .Core = imports.%Core
  161. // CHECK:STDOUT: .C = %C.decl
  162. // CHECK:STDOUT: .F = %F.decl
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Core.import = import Core
  165. // CHECK:STDOUT: %default.import = import <none>
  166. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  167. // CHECK:STDOUT: impl_decl @C.as.Add.impl [concrete] {} {
  168. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  169. // CHECK:STDOUT: %Add.ref: type = name_ref Add, imports.%Main.Add [concrete = constants.%Add.type]
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  172. // CHECK:STDOUT: %x.patt: %pattern_type.7c7 = value_binding_pattern x [concrete]
  173. // CHECK:STDOUT: %x.param_patt: %pattern_type.7c7 = value_param_pattern %x.patt, call_param0 [concrete]
  174. // CHECK:STDOUT: %y.patt: %pattern_type.7c7 = value_binding_pattern y [concrete]
  175. // CHECK:STDOUT: %y.param_patt: %pattern_type.7c7 = value_param_pattern %y.patt, call_param1 [concrete]
  176. // CHECK:STDOUT: %return.patt: %pattern_type.7c7 = return_slot_pattern [concrete]
  177. // CHECK:STDOUT: %return.param_patt: %pattern_type.7c7 = out_param_pattern %return.patt, call_param2 [concrete]
  178. // CHECK:STDOUT: } {
  179. // CHECK:STDOUT: %C.ref.loc12_21: type = name_ref C, file.%C.decl [concrete = constants.%C]
  180. // CHECK:STDOUT: %.loc12: form = init_form %C.ref.loc12_21, call_param2 [concrete = constants.%.355]
  181. // CHECK:STDOUT: %x.param: %C = value_param call_param0
  182. // CHECK:STDOUT: %C.ref.loc12_9: type = name_ref C, file.%C.decl [concrete = constants.%C]
  183. // CHECK:STDOUT: %x: %C = value_binding x, %x.param
  184. // CHECK:STDOUT: %y.param: %C = value_param call_param1
  185. // CHECK:STDOUT: %C.ref.loc12_15: type = name_ref C, file.%C.decl [concrete = constants.%C]
  186. // CHECK:STDOUT: %y: %C = value_binding y, %y.param
  187. // CHECK:STDOUT: %return.param: ref %C = out_param call_param2
  188. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: interface @Add [from "a.carbon"] {
  193. // CHECK:STDOUT: !members:
  194. // CHECK:STDOUT: .Self = imports.%Main.import_ref.17c
  195. // CHECK:STDOUT: .Op = imports.%Main.import_ref.f0e
  196. // CHECK:STDOUT: witness = (imports.%Main.Op)
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: !requires:
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: impl @C.as.Add.impl: %C.ref as %Add.ref {
  202. // CHECK:STDOUT: %C.as.Add.impl.Op.decl: %C.as.Add.impl.Op.type = fn_decl @C.as.Add.impl.Op [concrete = constants.%C.as.Add.impl.Op] {
  203. // CHECK:STDOUT: %self.patt: %pattern_type.7c7 = value_binding_pattern self [concrete]
  204. // CHECK:STDOUT: %self.param_patt: %pattern_type.7c7 = value_param_pattern %self.patt, call_param0 [concrete]
  205. // CHECK:STDOUT: %other.patt: %pattern_type.7c7 = value_binding_pattern other [concrete]
  206. // CHECK:STDOUT: %other.param_patt: %pattern_type.7c7 = value_param_pattern %other.patt, call_param1 [concrete]
  207. // CHECK:STDOUT: %return.patt: %pattern_type.7c7 = return_slot_pattern [concrete]
  208. // CHECK:STDOUT: %return.param_patt: %pattern_type.7c7 = out_param_pattern %return.patt, call_param2 [concrete]
  209. // CHECK:STDOUT: } {
  210. // CHECK:STDOUT: %Self.ref.loc9_37: type = name_ref Self, @C.as.Add.impl.%C.ref [concrete = constants.%C]
  211. // CHECK:STDOUT: %.loc9_37: form = init_form %Self.ref.loc9_37, call_param2 [concrete = constants.%.355]
  212. // CHECK:STDOUT: %self.param: %C = value_param call_param0
  213. // CHECK:STDOUT: %Self.ref.loc9_15: type = name_ref Self, @C.as.Add.impl.%C.ref [concrete = constants.%C]
  214. // CHECK:STDOUT: %self: %C = value_binding self, %self.param
  215. // CHECK:STDOUT: %other.param: %C = value_param call_param1
  216. // CHECK:STDOUT: %Self.ref.loc9_28: type = name_ref Self, @C.as.Add.impl.%C.ref [concrete = constants.%C]
  217. // CHECK:STDOUT: %other: %C = value_binding other, %other.param
  218. // CHECK:STDOUT: %return.param: ref %C = out_param call_param2
  219. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: %Add.impl_witness_table = impl_witness_table (%C.as.Add.impl.Op.decl), @C.as.Add.impl [concrete]
  222. // CHECK:STDOUT: %Add.impl_witness: <witness> = impl_witness %Add.impl_witness_table [concrete = constants.%Add.impl_witness]
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: !members:
  225. // CHECK:STDOUT: .Op = %C.as.Add.impl.Op.decl
  226. // CHECK:STDOUT: .C = <poisoned>
  227. // CHECK:STDOUT: witness = %Add.impl_witness
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: class @C {
  231. // CHECK:STDOUT: %.loc6_18: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple.af4]
  232. // CHECK:STDOUT: %.loc6_19: type = converted %.loc6_18, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  233. // CHECK:STDOUT: adapt_decl %.loc6_19 [concrete]
  234. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_tuple.type [concrete = constants.%complete_type]
  235. // CHECK:STDOUT: complete_type_witness = %complete_type
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: !members:
  238. // CHECK:STDOUT: .Self = constants.%C
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: generic fn @Add.Op(imports.%Main.import_ref.bb0: %Add.type) [from "a.carbon"] {
  242. // CHECK:STDOUT: %Self: %Add.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  243. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  244. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.5af)]
  245. // CHECK:STDOUT: %.1: form = init_form %Self.binding.as_type, call_param2 [symbolic = %.1 (constants.%.789)]
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: fn;
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: fn @C.as.Add.impl.Op(%self.param: %C, %other.param: %C) -> %C {
  251. // CHECK:STDOUT: !entry:
  252. // CHECK:STDOUT: %.loc9_52: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple.af4]
  253. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  254. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete = constants.%empty_tuple.af4]
  255. // CHECK:STDOUT: %.loc9_54.1: %C = as_compatible %empty_tuple [concrete = constants.%empty_tuple.bfb]
  256. // CHECK:STDOUT: %.loc9_54.2: %C = converted %.loc9_52, %.loc9_54.1 [concrete = constants.%empty_tuple.bfb]
  257. // CHECK:STDOUT: %.loc9_58.1: %empty_tuple.type = as_compatible %.loc9_54.2 [concrete = constants.%empty_tuple.af4]
  258. // CHECK:STDOUT: %.loc9_58.2: ref %empty_tuple.type = as_compatible %return.param
  259. // CHECK:STDOUT: %.loc9_58.3: init %empty_tuple.type = tuple_init () to %.loc9_58.2 [concrete = constants.%empty_tuple.af4]
  260. // CHECK:STDOUT: %.loc9_58.4: init %C = as_compatible %.loc9_58.3 [concrete = constants.%empty_tuple.bfb]
  261. // CHECK:STDOUT: %.loc9_58.5: init %C = converted %.loc9_54.2, %.loc9_58.4 [concrete = constants.%empty_tuple.bfb]
  262. // CHECK:STDOUT: return %.loc9_58.5 to %return.param
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: fn @F(%x.param: %C, %y.param: %C) -> %C {
  266. // CHECK:STDOUT: !entry:
  267. // CHECK:STDOUT: %x.ref: %C = name_ref x, %x
  268. // CHECK:STDOUT: %Add.ref: type = name_ref Add, imports.%Main.Add [concrete = constants.%Add.type]
  269. // CHECK:STDOUT: %Op.ref: %Add.assoc_type = name_ref Op, imports.%Main.import_ref.f0e [concrete = constants.%assoc0]
  270. // CHECK:STDOUT: %impl.elem0: %.b2f = impl_witness_access constants.%Add.impl_witness, element0 [concrete = constants.%C.as.Add.impl.Op]
  271. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %x.ref, %impl.elem0
  272. // CHECK:STDOUT: %y.ref: %C = name_ref y, %y
  273. // CHECK:STDOUT: %C.as.Add.impl.Op.call: init %C = call %bound_method(%x.ref, %y.ref)
  274. // CHECK:STDOUT: return %C.as.Add.impl.Op.call to %return.param
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: specific @Add.Op(constants.%Self) {
  278. // CHECK:STDOUT: %Self => constants.%Self
  279. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  280. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.5af
  281. // CHECK:STDOUT: %.1 => constants.%.789
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: specific @Add.Op(constants.%Add.facet) {
  285. // CHECK:STDOUT: %Self => constants.%Add.facet
  286. // CHECK:STDOUT: %Self.binding.as_type => constants.%C
  287. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c7
  288. // CHECK:STDOUT: %.1 => constants.%.355
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: