indirect_import_member.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/indirect_import_member.carbon
  10. // ============================================================================
  11. // Setup files
  12. // ============================================================================
  13. // --- a.carbon
  14. library "[[@TEST_NAME]]";
  15. class C {
  16. fn F() {}
  17. }
  18. // --- b.carbon
  19. library "[[@TEST_NAME]]";
  20. export import library "a";
  21. // --- c.carbon
  22. library "[[@TEST_NAME]]";
  23. import library "b";
  24. export C;
  25. // --- d.carbon
  26. library "[[@TEST_NAME]]";
  27. export import library "c";
  28. // --- e.carbon
  29. library "[[@TEST_NAME]]";
  30. import library "c";
  31. class D {
  32. alias C = package.C;
  33. }
  34. // --- f.carbon
  35. library "[[@TEST_NAME]]";
  36. export import library "e";
  37. // ============================================================================
  38. // Test files
  39. // ============================================================================
  40. // --- use_b.carbon
  41. library "[[@TEST_NAME]]";
  42. import library "b";
  43. var x: () = C.F();
  44. // --- use_c.carbon
  45. library "[[@TEST_NAME]]";
  46. import library "c";
  47. var x: () = C.F();
  48. // --- use_d.carbon
  49. library "[[@TEST_NAME]]";
  50. import library "d";
  51. var x: () = C.F();
  52. // --- use_e.carbon
  53. library "[[@TEST_NAME]]";
  54. import library "e";
  55. var x: () = D.C.F();
  56. // --- use_f.carbon
  57. library "[[@TEST_NAME]]";
  58. import library "f";
  59. var x: () = D.C.F();
  60. // CHECK:STDOUT: --- a.carbon
  61. // CHECK:STDOUT:
  62. // CHECK:STDOUT: constants {
  63. // CHECK:STDOUT: %C: type = class_type @C [template]
  64. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  65. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  66. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  67. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: file {
  71. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  72. // CHECK:STDOUT: .C = %C.decl
  73. // CHECK:STDOUT: }
  74. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: class @C {
  78. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {} {}
  79. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  80. // CHECK:STDOUT:
  81. // CHECK:STDOUT: !members:
  82. // CHECK:STDOUT: .Self = constants.%C
  83. // CHECK:STDOUT: .F = %F.decl
  84. // CHECK:STDOUT: complete_type_witness = %complete_type
  85. // CHECK:STDOUT: }
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: fn @F() {
  88. // CHECK:STDOUT: !entry:
  89. // CHECK:STDOUT: return
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT:
  92. // CHECK:STDOUT: --- b.carbon
  93. // CHECK:STDOUT:
  94. // CHECK:STDOUT: imports {
  95. // CHECK:STDOUT: %import_ref = import_ref Main//a, C, unloaded
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT:
  98. // CHECK:STDOUT: file {
  99. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  100. // CHECK:STDOUT: .C = imports.%import_ref
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT: %default.import = import <invalid>
  103. // CHECK:STDOUT: }
  104. // CHECK:STDOUT:
  105. // CHECK:STDOUT: --- c.carbon
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: constants {
  108. // CHECK:STDOUT: %C: type = class_type @C [template]
  109. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  110. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: imports {
  114. // CHECK:STDOUT: %import_ref.0ac: type = import_ref Main//a, C, loaded [template = constants.%C]
  115. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//a, loc6_1, loaded [template = constants.%complete_type]
  116. // CHECK:STDOUT: %import_ref.2c4 = import_ref Main//a, inst14 [no loc], unloaded
  117. // CHECK:STDOUT: %import_ref.d18 = import_ref Main//a, loc5_10, unloaded
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: file {
  121. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  122. // CHECK:STDOUT: .C = %C
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT: %default.import = import <invalid>
  125. // CHECK:STDOUT: %C: type = export C, imports.%import_ref.0ac [template = constants.%C]
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: class @C [from "a.carbon"] {
  129. // CHECK:STDOUT: !members:
  130. // CHECK:STDOUT: .Self = imports.%import_ref.2c4
  131. // CHECK:STDOUT: .F = imports.%import_ref.d18
  132. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  133. // CHECK:STDOUT: }
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: --- d.carbon
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: imports {
  138. // CHECK:STDOUT: %import_ref = import_ref Main//c, C, unloaded
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: file {
  142. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  143. // CHECK:STDOUT: .C = imports.%import_ref
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT: %default.import = import <invalid>
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: --- e.carbon
  149. // CHECK:STDOUT:
  150. // CHECK:STDOUT: constants {
  151. // CHECK:STDOUT: %D: type = class_type @D [template]
  152. // CHECK:STDOUT: %C: type = class_type @C [template]
  153. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  154. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT:
  157. // CHECK:STDOUT: imports {
  158. // CHECK:STDOUT: %import_ref.4a7: type = import_ref Main//c, C, loaded [template = constants.%C]
  159. // CHECK:STDOUT: %import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
  160. // CHECK:STDOUT: %import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
  161. // CHECK:STDOUT: %import_ref.3b6 = import_ref Main//c, inst21 [indirect], unloaded
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: file {
  165. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  166. // CHECK:STDOUT: .C = imports.%import_ref.4a7
  167. // CHECK:STDOUT: .D = %D.decl
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT: %default.import = import <invalid>
  170. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: class @D {
  174. // CHECK:STDOUT: %package.ref: <namespace> = name_ref package, package [template = package]
  175. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.4a7 [template = constants.%C]
  176. // CHECK:STDOUT: %C: type = bind_alias C, imports.%import_ref.4a7 [template = constants.%C]
  177. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: !members:
  180. // CHECK:STDOUT: .Self = constants.%D
  181. // CHECK:STDOUT: .C = %C
  182. // CHECK:STDOUT: complete_type_witness = %complete_type
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: class @C [from "c.carbon"] {
  186. // CHECK:STDOUT: !members:
  187. // CHECK:STDOUT: .Self = imports.%import_ref.6a9
  188. // CHECK:STDOUT: .F = imports.%import_ref.3b6
  189. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8db
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: --- f.carbon
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: imports {
  195. // CHECK:STDOUT: %import_ref = import_ref Main//e, D, unloaded
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: file {
  199. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  200. // CHECK:STDOUT: .D = imports.%import_ref
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: %default.import = import <invalid>
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: --- use_b.carbon
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: constants {
  208. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  209. // CHECK:STDOUT: %C: type = class_type @C [template]
  210. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  211. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  212. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  213. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: imports {
  217. // CHECK:STDOUT: %import_ref.0ac: type = import_ref Main//a, C, loaded [template = constants.%C]
  218. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//a, loc6_1, loaded [template = constants.%complete_type]
  219. // CHECK:STDOUT: %import_ref.2c4 = import_ref Main//a, inst14 [no loc], unloaded
  220. // CHECK:STDOUT: %import_ref.a6e: %F.type = import_ref Main//a, loc5_10, loaded [template = constants.%F]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: file {
  224. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  225. // CHECK:STDOUT: .C = imports.%import_ref.0ac
  226. // CHECK:STDOUT: .x = %x
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: %default.import = import <invalid>
  229. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  230. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: class @C [from "a.carbon"] {
  234. // CHECK:STDOUT: !members:
  235. // CHECK:STDOUT: .Self = imports.%import_ref.2c4
  236. // CHECK:STDOUT: .F = imports.%import_ref.a6e
  237. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: fn @F() [from "a.carbon"];
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: fn @__global_init() {
  243. // CHECK:STDOUT: !entry:
  244. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.0ac [template = constants.%C]
  245. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.a6e [template = constants.%F]
  246. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  247. // CHECK:STDOUT: assign file.%x.var, %F.call
  248. // CHECK:STDOUT: return
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: --- use_c.carbon
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: constants {
  254. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  255. // CHECK:STDOUT: %C: type = class_type @C [template]
  256. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  257. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  258. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  259. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: imports {
  263. // CHECK:STDOUT: %import_ref.4a7: type = import_ref Main//c, C, loaded [template = constants.%C]
  264. // CHECK:STDOUT: %import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
  265. // CHECK:STDOUT: %import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
  266. // CHECK:STDOUT: %import_ref.861: %F.type = import_ref Main//c, inst21 [indirect], loaded [template = constants.%F]
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: file {
  270. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  271. // CHECK:STDOUT: .C = imports.%import_ref.4a7
  272. // CHECK:STDOUT: .x = %x
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT: %default.import = import <invalid>
  275. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  276. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: class @C [from "c.carbon"] {
  280. // CHECK:STDOUT: !members:
  281. // CHECK:STDOUT: .Self = imports.%import_ref.6a9
  282. // CHECK:STDOUT: .F = imports.%import_ref.861
  283. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8db
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: fn @F() [from "a.carbon"];
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: fn @__global_init() {
  289. // CHECK:STDOUT: !entry:
  290. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.4a7 [template = constants.%C]
  291. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.861 [template = constants.%F]
  292. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  293. // CHECK:STDOUT: assign file.%x.var, %F.call
  294. // CHECK:STDOUT: return
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: --- use_d.carbon
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: constants {
  300. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  301. // CHECK:STDOUT: %C: type = class_type @C [template]
  302. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  303. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  304. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  305. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: imports {
  309. // CHECK:STDOUT: %import_ref.4a7: type = import_ref Main//c, C, loaded [template = constants.%C]
  310. // CHECK:STDOUT: %import_ref.8db: <witness> = import_ref Main//c, inst19 [indirect], loaded [template = constants.%complete_type]
  311. // CHECK:STDOUT: %import_ref.6a9 = import_ref Main//c, inst20 [indirect], unloaded
  312. // CHECK:STDOUT: %import_ref.861: %F.type = import_ref Main//c, inst21 [indirect], loaded [template = constants.%F]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: file {
  316. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  317. // CHECK:STDOUT: .C = imports.%import_ref.4a7
  318. // CHECK:STDOUT: .x = %x
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: %default.import = import <invalid>
  321. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  322. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: class @C [from "c.carbon"] {
  326. // CHECK:STDOUT: !members:
  327. // CHECK:STDOUT: .Self = imports.%import_ref.6a9
  328. // CHECK:STDOUT: .F = imports.%import_ref.861
  329. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8db
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: fn @F() [from "a.carbon"];
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: fn @__global_init() {
  335. // CHECK:STDOUT: !entry:
  336. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.4a7 [template = constants.%C]
  337. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.861 [template = constants.%F]
  338. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  339. // CHECK:STDOUT: assign file.%x.var, %F.call
  340. // CHECK:STDOUT: return
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: --- use_e.carbon
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: constants {
  346. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  347. // CHECK:STDOUT: %D: type = class_type @D [template]
  348. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  349. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  350. // CHECK:STDOUT: %C: type = class_type @C [template]
  351. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  352. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  353. // CHECK:STDOUT: }
  354. // CHECK:STDOUT:
  355. // CHECK:STDOUT: imports {
  356. // CHECK:STDOUT: %import_ref.275: type = import_ref Main//e, D, loaded [template = constants.%D]
  357. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//e, loc8_1, loaded [template = constants.%complete_type]
  358. // CHECK:STDOUT: %import_ref.cab = import_ref Main//e, inst16 [no loc], unloaded
  359. // CHECK:STDOUT: %import_ref.08c: type = import_ref Main//e, loc7_9, loaded [template = constants.%C]
  360. // CHECK:STDOUT: %import_ref.8f3: <witness> = import_ref Main//e, inst22 [indirect], loaded [template = constants.%complete_type]
  361. // CHECK:STDOUT: %import_ref.db8 = import_ref Main//e, inst23 [indirect], unloaded
  362. // CHECK:STDOUT: %import_ref.e47: %F.type = import_ref Main//e, inst24 [indirect], loaded [template = constants.%F]
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: file {
  366. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  367. // CHECK:STDOUT: .D = imports.%import_ref.275
  368. // CHECK:STDOUT: .x = %x
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT: %default.import = import <invalid>
  371. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  372. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: class @D [from "e.carbon"] {
  376. // CHECK:STDOUT: !members:
  377. // CHECK:STDOUT: .Self = imports.%import_ref.cab
  378. // CHECK:STDOUT: .C = imports.%import_ref.08c
  379. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: class @C [from "e.carbon"] {
  383. // CHECK:STDOUT: !members:
  384. // CHECK:STDOUT: .Self = imports.%import_ref.db8
  385. // CHECK:STDOUT: .F = imports.%import_ref.e47
  386. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f3
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: fn @F() [from "a.carbon"];
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: fn @__global_init() {
  392. // CHECK:STDOUT: !entry:
  393. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.275 [template = constants.%D]
  394. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.08c [template = constants.%C]
  395. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.e47 [template = constants.%F]
  396. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  397. // CHECK:STDOUT: assign file.%x.var, %F.call
  398. // CHECK:STDOUT: return
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: --- use_f.carbon
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: constants {
  404. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  405. // CHECK:STDOUT: %D: type = class_type @D [template]
  406. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  407. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  408. // CHECK:STDOUT: %C: type = class_type @C [template]
  409. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  410. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: imports {
  414. // CHECK:STDOUT: %import_ref.275: type = import_ref Main//e, D, loaded [template = constants.%D]
  415. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//e, loc8_1, loaded [template = constants.%complete_type]
  416. // CHECK:STDOUT: %import_ref.cab = import_ref Main//e, inst16 [no loc], unloaded
  417. // CHECK:STDOUT: %import_ref.08c: type = import_ref Main//e, loc7_9, loaded [template = constants.%C]
  418. // CHECK:STDOUT: %import_ref.8f3: <witness> = import_ref Main//e, inst22 [indirect], loaded [template = constants.%complete_type]
  419. // CHECK:STDOUT: %import_ref.db8 = import_ref Main//e, inst23 [indirect], unloaded
  420. // CHECK:STDOUT: %import_ref.e47: %F.type = import_ref Main//e, inst24 [indirect], loaded [template = constants.%F]
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: file {
  424. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  425. // CHECK:STDOUT: .D = imports.%import_ref.275
  426. // CHECK:STDOUT: .x = %x
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: %default.import = import <invalid>
  429. // CHECK:STDOUT: %x.var: ref %empty_tuple.type = var x
  430. // CHECK:STDOUT: %x: ref %empty_tuple.type = bind_name x, %x.var
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: class @D [from "e.carbon"] {
  434. // CHECK:STDOUT: !members:
  435. // CHECK:STDOUT: .Self = imports.%import_ref.cab
  436. // CHECK:STDOUT: .C = imports.%import_ref.08c
  437. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: class @C [from "e.carbon"] {
  441. // CHECK:STDOUT: !members:
  442. // CHECK:STDOUT: .Self = imports.%import_ref.db8
  443. // CHECK:STDOUT: .F = imports.%import_ref.e47
  444. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f3
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: fn @F() [from "a.carbon"];
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: fn @__global_init() {
  450. // CHECK:STDOUT: !entry:
  451. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.275 [template = constants.%D]
  452. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.08c [template = constants.%C]
  453. // CHECK:STDOUT: %F.ref: %F.type = name_ref F, imports.%import_ref.e47 [template = constants.%F]
  454. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %F.ref()
  455. // CHECK:STDOUT: assign file.%x.var, %F.call
  456. // CHECK:STDOUT: return
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT: