transitive.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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/convert.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/lookup/transitive.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/transitive.carbon
  14. // --- i.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I { fn F[self: Self](); }
  17. // --- c.carbon
  18. library "[[@TEST_NAME]]";
  19. import library "i";
  20. class C {}
  21. impl C as I { fn F[self: Self]() {} }
  22. // --- get.carbon
  23. library "[[@TEST_NAME]]";
  24. import library "c";
  25. fn Get() -> C;
  26. // --- call.carbon
  27. library "[[@TEST_NAME]]";
  28. import library "get";
  29. import library "i";
  30. fn Call() {
  31. // We find C in "get", but should look in "c" instead.
  32. Get().(I.F)();
  33. }
  34. // CHECK:STDOUT: --- i.carbon
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: constants {
  37. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  38. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  39. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  40. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic]
  41. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  42. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  43. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  44. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%I.F.decl [concrete]
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: imports {
  48. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  49. // CHECK:STDOUT: import Core//prelude
  50. // CHECK:STDOUT: import Core//prelude/...
  51. // CHECK:STDOUT: }
  52. // CHECK:STDOUT: }
  53. // CHECK:STDOUT:
  54. // CHECK:STDOUT: file {
  55. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  56. // CHECK:STDOUT: .Core = imports.%Core
  57. // CHECK:STDOUT: .I = %I.decl
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: %Core.import = import Core
  60. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: interface @I {
  64. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  65. // CHECK:STDOUT: %I.F.decl: %I.F.type = fn_decl @I.F [concrete = constants.%I.F] {
  66. // CHECK:STDOUT: %self.patt: @I.F.%pattern_type (%pattern_type) = value_binding_pattern self [concrete]
  67. // CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type (%pattern_type) = value_param_pattern %self.patt, call_param0 [concrete]
  68. // CHECK:STDOUT: } {
  69. // CHECK:STDOUT: %self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type) = value_param call_param0
  70. // CHECK:STDOUT: %.loc4_26.1: type = splice_block %.loc4_26.2 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)] {
  71. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  72. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  73. // CHECK:STDOUT: %.loc4_26.2: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT: %self: @I.F.%Self.binding.as_type (%Self.binding.as_type) = value_binding self, %self.param
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %I.F.decl [concrete = constants.%assoc0]
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: !members:
  80. // CHECK:STDOUT: .Self = %Self
  81. // CHECK:STDOUT: .F = %assoc0
  82. // CHECK:STDOUT: witness = (%I.F.decl)
  83. // CHECK:STDOUT:
  84. // CHECK:STDOUT: !requires:
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: generic fn @I.F(@I.%Self: %I.type) {
  88. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  89. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  90. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type)]
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: fn(%self.param: @I.F.%Self.binding.as_type (%Self.binding.as_type));
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: specific @I.F(constants.%Self) {
  96. // CHECK:STDOUT: %Self => constants.%Self
  97. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  98. // CHECK:STDOUT: %pattern_type => constants.%pattern_type
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: --- c.carbon
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: constants {
  104. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  105. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  106. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  107. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  108. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  109. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete]
  110. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  111. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  112. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic]
  113. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %Self.binding.as_type [symbolic]
  114. // CHECK:STDOUT: %pattern_type.7c7: type = pattern_type %C [concrete]
  115. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  116. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  117. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: imports {
  121. // CHECK:STDOUT: %Main.I: type = import_ref Main//i, I, loaded [concrete = constants.%I.type]
  122. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  123. // CHECK:STDOUT: import Core//prelude
  124. // CHECK:STDOUT: import Core//prelude/...
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT: %Main.import_ref.c82 = import_ref Main//i, loc4_13, unloaded
  127. // CHECK:STDOUT: %Main.import_ref.ef2 = import_ref Main//i, loc4_33, unloaded
  128. // CHECK:STDOUT: %Main.F: %I.F.type = import_ref Main//i, F, loaded [concrete = constants.%I.F]
  129. // CHECK:STDOUT: %Main.import_ref.236: %I.type = import_ref Main//i, loc4_13, loaded [symbolic = constants.%Self]
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: file {
  133. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  134. // CHECK:STDOUT: .I = imports.%Main.I
  135. // CHECK:STDOUT: .Core = imports.%Core
  136. // CHECK:STDOUT: .C = %C.decl
  137. // CHECK:STDOUT: }
  138. // CHECK:STDOUT: %Core.import = import Core
  139. // CHECK:STDOUT: %default.import = import <none>
  140. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  141. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  142. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  143. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: }
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: interface @I [from "i.carbon"] {
  148. // CHECK:STDOUT: !members:
  149. // CHECK:STDOUT: .Self = imports.%Main.import_ref.c82
  150. // CHECK:STDOUT: .F = imports.%Main.import_ref.ef2
  151. // CHECK:STDOUT: witness = (imports.%Main.F)
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: !requires:
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %I.ref {
  157. // CHECK:STDOUT: %C.as.I.impl.F.decl: %C.as.I.impl.F.type = fn_decl @C.as.I.impl.F [concrete = constants.%C.as.I.impl.F] {
  158. // CHECK:STDOUT: %self.patt: %pattern_type.7c7 = value_binding_pattern self [concrete]
  159. // CHECK:STDOUT: %self.param_patt: %pattern_type.7c7 = value_param_pattern %self.patt, call_param0 [concrete]
  160. // CHECK:STDOUT: } {
  161. // CHECK:STDOUT: %self.param: %C = value_param call_param0
  162. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.I.impl.%C.ref [concrete = constants.%C]
  163. // CHECK:STDOUT: %self: %C = value_binding self, %self.param
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%C.as.I.impl.F.decl), @C.as.I.impl [concrete]
  166. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: !members:
  169. // CHECK:STDOUT: .F = %C.as.I.impl.F.decl
  170. // CHECK:STDOUT: witness = %I.impl_witness
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: class @C {
  174. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  175. // CHECK:STDOUT: complete_type_witness = %complete_type
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: !members:
  178. // CHECK:STDOUT: .Self = constants.%C
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.236: %I.type) [from "i.carbon"] {
  182. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self)]
  183. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  184. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.422)]
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: fn;
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: fn @C.as.I.impl.F(%self.param: %C) {
  190. // CHECK:STDOUT: !entry:
  191. // CHECK:STDOUT: return
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: specific @I.F(constants.%Self) {
  195. // CHECK:STDOUT: %Self => constants.%Self
  196. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  197. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: specific @I.F(constants.%I.facet) {
  201. // CHECK:STDOUT: %Self => constants.%I.facet
  202. // CHECK:STDOUT: %Self.binding.as_type => constants.%C
  203. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7c7
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: --- get.carbon
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: constants {
  209. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  210. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  211. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  212. // CHECK:STDOUT: %.64f: form = init_form %C, call_param0 [concrete]
  213. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  214. // CHECK:STDOUT: %Get.type: type = fn_type @Get [concrete]
  215. // CHECK:STDOUT: %Get: %Get.type = struct_value () [concrete]
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: imports {
  219. // CHECK:STDOUT: %Main.C: type = import_ref Main//c, C, loaded [concrete = constants.%C]
  220. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  221. // CHECK:STDOUT: import Core//prelude
  222. // CHECK:STDOUT: import Core//prelude/...
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//c, loc6_10, loaded [concrete = constants.%complete_type]
  225. // CHECK:STDOUT: %Main.import_ref.743 = import_ref Main//c, inst{{[0-9A-F]+}} [no loc], unloaded
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: file {
  229. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  230. // CHECK:STDOUT: .C = imports.%Main.C
  231. // CHECK:STDOUT: .Core = imports.%Core
  232. // CHECK:STDOUT: .Get = %Get.decl
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %Core.import = import Core
  235. // CHECK:STDOUT: %default.import = import <none>
  236. // CHECK:STDOUT: %Get.decl: %Get.type = fn_decl @Get [concrete = constants.%Get] {
  237. // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
  238. // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param0 [concrete]
  239. // CHECK:STDOUT: } {
  240. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  241. // CHECK:STDOUT: %.loc6: form = init_form %C.ref, call_param0 [concrete = constants.%.64f]
  242. // CHECK:STDOUT: %return.param: ref %C = out_param call_param0
  243. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: class @C [from "c.carbon"] {
  248. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: !members:
  251. // CHECK:STDOUT: .Self = imports.%Main.import_ref.743
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: fn @Get() -> %C;
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: --- call.carbon
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: constants {
  259. // CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete]
  260. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  261. // CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete]
  262. // CHECK:STDOUT: %Get.type: type = fn_type @Get [concrete]
  263. // CHECK:STDOUT: %Get: %Get.type = struct_value () [concrete]
  264. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  265. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  266. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  267. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  268. // CHECK:STDOUT: %Self.651: %I.type = symbolic_binding Self, 0 [symbolic]
  269. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  270. // CHECK:STDOUT: %assoc0.a72: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.b58 [concrete]
  271. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F [concrete]
  272. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [concrete]
  273. // CHECK:STDOUT: %Self.binding.as_type.3af: type = symbolic_binding_type Self, 0, %Self.651 [symbolic]
  274. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %Self.binding.as_type.3af [symbolic]
  275. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table [concrete]
  276. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  277. // CHECK:STDOUT: %.d13: type = fn_type_with_self_type %I.F.type, %I.facet [concrete]
  278. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  279. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  280. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  281. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  282. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: imports {
  286. // CHECK:STDOUT: %Main.Get: %Get.type = import_ref Main//get, Get, loaded [concrete = constants.%Get]
  287. // CHECK:STDOUT: %Main.I: type = import_ref Main//i, I, loaded [concrete = constants.%I.type]
  288. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  289. // CHECK:STDOUT: .Destroy = %Core.Destroy
  290. // CHECK:STDOUT: import Core//prelude
  291. // CHECK:STDOUT: import Core//prelude/...
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT: %Main.import_ref.8db: <witness> = import_ref Main//get, inst{{[0-9A-F]+}} [indirect], loaded [concrete = constants.%complete_type]
  294. // CHECK:STDOUT: %Main.import_ref.a60 = import_ref Main//get, inst{{[0-9A-F]+}} [indirect], unloaded
  295. // CHECK:STDOUT: %Main.import_ref.c82 = import_ref Main//i, loc4_13, unloaded
  296. // CHECK:STDOUT: %Main.import_ref.ce7: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0.a72]
  297. // CHECK:STDOUT: %Main.F = import_ref Main//i, F, unloaded
  298. // CHECK:STDOUT: %Main.import_ref.b58: %I.F.type = import_ref Main//i, loc4_33, loaded [concrete = constants.%I.F]
  299. // CHECK:STDOUT: %Main.import_ref.236: %I.type = import_ref Main//i, loc4_13, loaded [symbolic = constants.%Self.651]
  300. // CHECK:STDOUT: %Main.import_ref.31c: <witness> = import_ref Main//c, loc7_13, loaded [concrete = constants.%I.impl_witness]
  301. // CHECK:STDOUT: %Main.import_ref.61c: type = import_ref Main//c, loc7_6, loaded [concrete = constants.%C]
  302. // CHECK:STDOUT: %Main.import_ref.91f: type = import_ref Main//c, loc7_11, loaded [concrete = constants.%I.type]
  303. // CHECK:STDOUT: %Main.import_ref.706: %C.as.I.impl.F.type = import_ref Main//c, loc7_34, loaded [concrete = constants.%C.as.I.impl.F]
  304. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.706), @C.as.I.impl [concrete]
  305. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: file {
  309. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  310. // CHECK:STDOUT: .Get = imports.%Main.Get
  311. // CHECK:STDOUT: .I = imports.%Main.I
  312. // CHECK:STDOUT: .Core = imports.%Core
  313. // CHECK:STDOUT: .Call = %Call.decl
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT: %Core.import = import Core
  316. // CHECK:STDOUT: %default.import = import <none>
  317. // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {}
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: interface @I [from "i.carbon"] {
  321. // CHECK:STDOUT: !members:
  322. // CHECK:STDOUT: .Self = imports.%Main.import_ref.c82
  323. // CHECK:STDOUT: .F = imports.%Main.import_ref.ce7
  324. // CHECK:STDOUT: witness = (imports.%Main.F)
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: !requires:
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: impl @C.as.I.impl: imports.%Main.import_ref.61c as imports.%Main.import_ref.91f [from "c.carbon"] {
  330. // CHECK:STDOUT: !members:
  331. // CHECK:STDOUT: witness = imports.%Main.import_ref.31c
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: class @C [from "get.carbon"] {
  335. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8db
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: .Self = imports.%Main.import_ref.a60
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: fn @Call() {
  342. // CHECK:STDOUT: !entry:
  343. // CHECK:STDOUT: %Get.ref: %Get.type = name_ref Get, imports.%Main.Get [concrete = constants.%Get]
  344. // CHECK:STDOUT: %.loc9_7.1: ref %C = temporary_storage
  345. // CHECK:STDOUT: %Get.call: init %C = call %Get.ref() to %.loc9_7.1
  346. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  347. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.ce7 [concrete = constants.%assoc0.a72]
  348. // CHECK:STDOUT: %impl.elem0: %.d13 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%C.as.I.impl.F]
  349. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %Get.call, %impl.elem0
  350. // CHECK:STDOUT: %.loc9_7.2: ref %C = temporary %.loc9_7.1, %Get.call
  351. // CHECK:STDOUT: %.loc9_7.3: %C = acquire_value %.loc9_7.2
  352. // CHECK:STDOUT: %C.as.I.impl.F.call: init %empty_tuple.type = call %bound_method(%.loc9_7.3)
  353. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc9_7.2, constants.%DestroyOp
  354. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc9_7.2)
  355. // CHECK:STDOUT: return
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: fn @Get [from "get.carbon"];
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.236: %I.type) [from "i.carbon"] {
  361. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.651)]
  362. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type.3af)]
  363. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.422)]
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: fn;
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: fn @C.as.I.impl.F [from "c.carbon"];
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: fn @DestroyOp(%self.param: %C) = "no_op";
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: specific @I.F(constants.%Self.651) {
  373. // CHECK:STDOUT: %Self => constants.%Self.651
  374. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type.3af
  375. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: