transitive.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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 = bind_symbolic_name Self, 0 [symbolic]
  39. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  40. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic]
  41. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  42. // CHECK:STDOUT: %F: %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.%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 = bind_symbolic_name Self, 0 [symbolic = constants.%Self]
  65. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  66. // CHECK:STDOUT: %self.patt: @F.%pattern_type (%pattern_type) = binding_pattern self [concrete]
  67. // CHECK:STDOUT: %self.param_patt: @F.%pattern_type (%pattern_type) = value_param_pattern %self.patt, call_param0 [concrete]
  68. // CHECK:STDOUT: } {
  69. // CHECK:STDOUT: %self.param: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = value_param call_param0
  70. // CHECK:STDOUT: %.loc4_26.1: type = splice_block %.loc4_26.2 [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)] {
  71. // CHECK:STDOUT: %Self.ref: %I.type = name_ref Self, @I.%Self [symbolic = %Self (constants.%Self)]
  72. // CHECK:STDOUT: %Self.as_type.loc4_26.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)]
  73. // CHECK:STDOUT: %.loc4_26.2: type = converted %Self.ref, %Self.as_type.loc4_26.2 [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)]
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT: %self: @F.%Self.as_type.loc4_26.1 (%Self.as_type) = bind_name self, %self.param
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, %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 = (%F.decl)
  83. // CHECK:STDOUT: }
  84. // CHECK:STDOUT:
  85. // CHECK:STDOUT: generic fn @F(@I.%Self: %I.type) {
  86. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  87. // CHECK:STDOUT: %Self.as_type.loc4_26.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_26.1 (constants.%Self.as_type)]
  88. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc4_26.1 [symbolic = %pattern_type (constants.%pattern_type)]
  89. // CHECK:STDOUT:
  90. // CHECK:STDOUT: fn(%self.param: @F.%Self.as_type.loc4_26.1 (%Self.as_type));
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: specific @F(constants.%Self) {
  94. // CHECK:STDOUT: %Self => constants.%Self
  95. // CHECK:STDOUT: %Self.as_type.loc4_26.1 => constants.%Self.as_type
  96. // CHECK:STDOUT: %pattern_type => constants.%pattern_type
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: --- c.carbon
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: constants {
  102. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  103. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  104. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  105. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  106. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic]
  107. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  108. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  109. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  110. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type [symbolic]
  111. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  112. // CHECK:STDOUT: %pattern_type.c48: type = pattern_type %C [concrete]
  113. // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.loc7 [concrete]
  114. // CHECK:STDOUT: %F.a2e: %F.type.5d6 = struct_value () [concrete]
  115. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: imports {
  119. // CHECK:STDOUT: %Main.I: type = import_ref Main//i, I, loaded [concrete = constants.%I.type]
  120. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  121. // CHECK:STDOUT: import Core//prelude
  122. // CHECK:STDOUT: import Core//prelude/...
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst19 [no loc], unloaded
  125. // CHECK:STDOUT: %Main.import_ref.507 = import_ref Main//i, loc4_33, unloaded
  126. // CHECK:STDOUT: %Main.F: %F.type.cf0 = import_ref Main//i, F, loaded [concrete = constants.%F.bc6]
  127. // CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst19 [no loc], loaded [symbolic = constants.%Self]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: file {
  131. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  132. // CHECK:STDOUT: .I = imports.%Main.I
  133. // CHECK:STDOUT: .Core = imports.%Core
  134. // CHECK:STDOUT: .C = %C.decl
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT: %Core.import = import Core
  137. // CHECK:STDOUT: %default.import = import <none>
  138. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  139. // CHECK:STDOUT: impl_decl @I.impl [concrete] {} {
  140. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  141. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@I.impl.%F.decl), @I.impl [concrete]
  144. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  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.e5d
  150. // CHECK:STDOUT: .F = imports.%Main.import_ref.507
  151. // CHECK:STDOUT: witness = (imports.%Main.F)
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: impl @I.impl: %C.ref as %I.ref {
  155. // CHECK:STDOUT: %F.decl: %F.type.5d6 = fn_decl @F.loc7 [concrete = constants.%F.a2e] {
  156. // CHECK:STDOUT: %self.patt: %pattern_type.c48 = binding_pattern self [concrete]
  157. // CHECK:STDOUT: %self.param_patt: %pattern_type.c48 = value_param_pattern %self.patt, call_param0 [concrete]
  158. // CHECK:STDOUT: } {
  159. // CHECK:STDOUT: %self.param: %C = value_param call_param0
  160. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @I.impl.%C.ref [concrete = constants.%C]
  161. // CHECK:STDOUT: %self: %C = bind_name self, %self.param
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: !members:
  165. // CHECK:STDOUT: .F = %F.decl
  166. // CHECK:STDOUT: witness = file.%I.impl_witness
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: class @C {
  170. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  171. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  172. // CHECK:STDOUT: complete_type_witness = %complete_type
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: !members:
  175. // CHECK:STDOUT: .Self = constants.%C
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "i.carbon"] {
  179. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self)]
  180. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  181. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.6de)]
  182. // CHECK:STDOUT:
  183. // CHECK:STDOUT: fn;
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT:
  186. // CHECK:STDOUT: fn @F.loc7(%self.param: %C) {
  187. // CHECK:STDOUT: !entry:
  188. // CHECK:STDOUT: return
  189. // CHECK:STDOUT: }
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: specific @F.1(constants.%Self) {
  192. // CHECK:STDOUT: %Self => constants.%Self
  193. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  194. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: specific @F.1(constants.%I.facet) {
  198. // CHECK:STDOUT: %Self => constants.%I.facet
  199. // CHECK:STDOUT: %Self.as_type => constants.%C
  200. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.c48
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: --- get.carbon
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: constants {
  206. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  207. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  208. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  209. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  210. // CHECK:STDOUT: %Get.type: type = fn_type @Get [concrete]
  211. // CHECK:STDOUT: %Get: %Get.type = struct_value () [concrete]
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: imports {
  215. // CHECK:STDOUT: %Main.C: type = import_ref Main//c, C, loaded [concrete = constants.%C]
  216. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  217. // CHECK:STDOUT: import Core//prelude
  218. // CHECK:STDOUT: import Core//prelude/...
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//c, loc6_10, loaded [concrete = constants.%complete_type]
  221. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//c, inst20 [no loc], unloaded
  222. // CHECK:STDOUT: }
  223. // CHECK:STDOUT:
  224. // CHECK:STDOUT: file {
  225. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  226. // CHECK:STDOUT: .C = imports.%Main.C
  227. // CHECK:STDOUT: .Core = imports.%Core
  228. // CHECK:STDOUT: .Get = %Get.decl
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: %Core.import = import Core
  231. // CHECK:STDOUT: %default.import = import <none>
  232. // CHECK:STDOUT: %Get.decl: %Get.type = fn_decl @Get [concrete = constants.%Get] {
  233. // CHECK:STDOUT: %return.patt: %pattern_type = return_slot_pattern [concrete]
  234. // CHECK:STDOUT: %return.param_patt: %pattern_type = out_param_pattern %return.patt, call_param0 [concrete]
  235. // CHECK:STDOUT: } {
  236. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [concrete = constants.%C]
  237. // CHECK:STDOUT: %return.param: ref %C = out_param call_param0
  238. // CHECK:STDOUT: %return: ref %C = return_slot %return.param
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: class @C [from "c.carbon"] {
  243. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: !members:
  246. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: fn @Get() -> %C;
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: --- call.carbon
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: constants {
  254. // CHECK:STDOUT: %Call.type: type = fn_type @Call [concrete]
  255. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  256. // CHECK:STDOUT: %Call: %Call.type = struct_value () [concrete]
  257. // CHECK:STDOUT: %Get.type: type = fn_type @Get [concrete]
  258. // CHECK:STDOUT: %Get: %Get.type = struct_value () [concrete]
  259. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  260. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  261. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  262. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  263. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  264. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  265. // CHECK:STDOUT: %assoc0.3f3: %I.assoc_type = assoc_entity element0, imports.%Main.import_ref.e03 [concrete]
  266. // CHECK:STDOUT: %F.type.cf0: type = fn_type @F.1 [concrete]
  267. // CHECK:STDOUT: %F.bc6: %F.type.cf0 = struct_value () [concrete]
  268. // CHECK:STDOUT: %Self.as_type.b70: type = facet_access_type %Self.826 [symbolic]
  269. // CHECK:STDOUT: %pattern_type.6de: type = pattern_type %Self.as_type.b70 [symbolic]
  270. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table [concrete]
  271. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  272. // CHECK:STDOUT: %.1b3: type = fn_type_with_self_type %F.type.cf0, %I.facet [concrete]
  273. // CHECK:STDOUT: %F.type.5d6: type = fn_type @F.2 [concrete]
  274. // CHECK:STDOUT: %F.a2e: %F.type.5d6 = struct_value () [concrete]
  275. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  276. // CHECK:STDOUT: %Op.type.153: type = fn_type @Op.2, @Destroy.impl(%C) [concrete]
  277. // CHECK:STDOUT: %Op.5d7: %Op.type.153 = struct_value () [concrete]
  278. // CHECK:STDOUT: %ptr.019: type = ptr_type %C [concrete]
  279. // CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function %Op.5d7, @Op.2(%C) [concrete]
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: imports {
  283. // CHECK:STDOUT: %Main.Get: %Get.type = import_ref Main//get, Get, loaded [concrete = constants.%Get]
  284. // CHECK:STDOUT: %Main.I: type = import_ref Main//i, I, loaded [concrete = constants.%I.type]
  285. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  286. // CHECK:STDOUT: .Destroy = %Core.Destroy
  287. // CHECK:STDOUT: import Core//prelude
  288. // CHECK:STDOUT: import Core//prelude/...
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT: %Main.import_ref.8db: <witness> = import_ref Main//get, inst23 [indirect], loaded [concrete = constants.%complete_type.357]
  291. // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//get, inst24 [indirect], unloaded
  292. // CHECK:STDOUT: %Main.import_ref.e5d = import_ref Main//i, inst19 [no loc], unloaded
  293. // CHECK:STDOUT: %Main.import_ref.c44: %I.assoc_type = import_ref Main//i, loc4_33, loaded [concrete = constants.%assoc0.3f3]
  294. // CHECK:STDOUT: %Main.F = import_ref Main//i, F, unloaded
  295. // CHECK:STDOUT: %Main.import_ref.e03: %F.type.cf0 = import_ref Main//i, loc4_33, loaded [concrete = constants.%F.bc6]
  296. // CHECK:STDOUT: %Main.import_ref.5dd: %I.type = import_ref Main//i, inst19 [no loc], loaded [symbolic = constants.%Self.826]
  297. // CHECK:STDOUT: %Main.import_ref.f0d: <witness> = import_ref Main//c, loc7_13, loaded [concrete = constants.%I.impl_witness]
  298. // CHECK:STDOUT: %Main.import_ref.29a: type = import_ref Main//c, loc7_6, loaded [concrete = constants.%C]
  299. // CHECK:STDOUT: %Main.import_ref.f50: type = import_ref Main//c, loc7_11, loaded [concrete = constants.%I.type]
  300. // CHECK:STDOUT: %Main.import_ref.742: %F.type.5d6 = import_ref Main//c, loc7_34, loaded [concrete = constants.%F.a2e]
  301. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.742), @I.impl [concrete]
  302. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: file {
  306. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  307. // CHECK:STDOUT: .Get = imports.%Main.Get
  308. // CHECK:STDOUT: .I = imports.%Main.I
  309. // CHECK:STDOUT: .Core = imports.%Core
  310. // CHECK:STDOUT: .Call = %Call.decl
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %Core.import = import Core
  313. // CHECK:STDOUT: %default.import = import <none>
  314. // CHECK:STDOUT: %Call.decl: %Call.type = fn_decl @Call [concrete = constants.%Call] {} {}
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: interface @I [from "i.carbon"] {
  318. // CHECK:STDOUT: !members:
  319. // CHECK:STDOUT: .Self = imports.%Main.import_ref.e5d
  320. // CHECK:STDOUT: .F = imports.%Main.import_ref.c44
  321. // CHECK:STDOUT: witness = (imports.%Main.F)
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: impl @I.impl: imports.%Main.import_ref.29a as imports.%Main.import_ref.f50 [from "c.carbon"] {
  325. // CHECK:STDOUT: !members:
  326. // CHECK:STDOUT: witness = imports.%Main.import_ref.f0d
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT:
  329. // CHECK:STDOUT: class @C [from "get.carbon"] {
  330. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8db
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: !members:
  333. // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: fn @Call() {
  337. // CHECK:STDOUT: !entry:
  338. // CHECK:STDOUT: %Get.ref: %Get.type = name_ref Get, imports.%Main.Get [concrete = constants.%Get]
  339. // CHECK:STDOUT: %.loc9_7.1: ref %C = temporary_storage
  340. // CHECK:STDOUT: %Get.call: init %C = call %Get.ref() to %.loc9_7.1
  341. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%Main.I [concrete = constants.%I.type]
  342. // CHECK:STDOUT: %F.ref: %I.assoc_type = name_ref F, imports.%Main.import_ref.c44 [concrete = constants.%assoc0.3f3]
  343. // CHECK:STDOUT: %impl.elem0: %.1b3 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%F.a2e]
  344. // CHECK:STDOUT: %bound_method.loc9_8: <bound method> = bound_method %Get.call, %impl.elem0
  345. // CHECK:STDOUT: %.loc9_7.2: ref %C = temporary %.loc9_7.1, %Get.call
  346. // CHECK:STDOUT: %.loc9_7.3: %C = bind_value %.loc9_7.2
  347. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %bound_method.loc9_8(%.loc9_7.3)
  348. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %.loc9_7.1, constants.%Op.5d7
  349. // CHECK:STDOUT: %Op.specific_fn: <specific function> = specific_function constants.%Op.5d7, @Op.2(constants.%C) [concrete = constants.%Op.specific_fn]
  350. // CHECK:STDOUT: %bound_method.loc9_7: <bound method> = bound_method %.loc9_7.1, %Op.specific_fn
  351. // CHECK:STDOUT: %addr: %ptr.019 = addr_of %.loc9_7.1
  352. // CHECK:STDOUT: %no_op: init %empty_tuple.type = call %bound_method.loc9_7(%addr)
  353. // CHECK:STDOUT: return
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: fn @Get [from "get.carbon"];
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: generic fn @F.1(imports.%Main.import_ref.5dd: %I.type) [from "i.carbon"] {
  359. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = %Self (constants.%Self.826)]
  360. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type.b70)]
  361. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.6de)]
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: fn;
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: fn @F.2 [from "c.carbon"];
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: specific @F.1(constants.%Self.826) {
  369. // CHECK:STDOUT: %Self => constants.%Self.826
  370. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type.b70
  371. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.6de
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: