export_import.carbon 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  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/packages/no_prelude/export_import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/export_import.carbon
  10. // ============================================================================
  11. // Setup files
  12. // ============================================================================
  13. // --- base.carbon
  14. library "[[@TEST_NAME]]";
  15. class C {
  16. var x: ();
  17. };
  18. // --- export.carbon
  19. library "[[@TEST_NAME]]";
  20. export import library "base";
  21. // --- export_copy.carbon
  22. library "[[@TEST_NAME]]";
  23. export import library "base";
  24. // --- non_export.carbon
  25. library "[[@TEST_NAME]]";
  26. import library "export";
  27. // --- export_export.carbon
  28. library "[[@TEST_NAME]]";
  29. export import library "export";
  30. // --- import_then_export.carbon
  31. library "[[@TEST_NAME]]";
  32. import library "base";
  33. export import library "export";
  34. // --- export_in_impl.carbon
  35. // This is just providing an API for the implicit import.
  36. library "[[@TEST_NAME]]";
  37. // ============================================================================
  38. // Test files
  39. // ============================================================================
  40. // --- use_export.carbon
  41. library "[[@TEST_NAME]]";
  42. import library "export";
  43. var c: C = {.x = ()};
  44. // --- fail_export_in_impl.impl.carbon
  45. impl library "[[@TEST_NAME]]";
  46. // CHECK:STDERR: fail_export_in_impl.impl.carbon:[[@LINE+4]]:1: error: `export` is only allowed in API files [ExportFromImpl]
  47. // CHECK:STDERR: export import library "base";
  48. // CHECK:STDERR: ^~~~~~
  49. // CHECK:STDERR:
  50. export import library "base";
  51. // Note the import still occurs.
  52. var c: C = {.x = ()};
  53. // --- export_export.impl.carbon
  54. impl library "[[@TEST_NAME]]";
  55. var c: C = {.x = ()};
  56. // --- use_export_export.carbon
  57. library "[[@TEST_NAME]]";
  58. import library "export_export";
  59. var c: C = {.x = ()};
  60. // --- use_import_then_export.carbon
  61. library "[[@TEST_NAME]]";
  62. import library "import_then_export";
  63. var c: C = {.x = ()};
  64. // --- use_import_when_export.carbon
  65. library "[[@TEST_NAME]]";
  66. export import library "base";
  67. var c: C = {.x = ()};
  68. // --- use_base_and_export.carbon
  69. library "[[@TEST_NAME]]";
  70. import library "base";
  71. import library "export";
  72. var c: C = {.x = ()};
  73. // --- use_export_and_base.carbon
  74. library "[[@TEST_NAME]]";
  75. import library "export";
  76. import library "base";
  77. var c: C = {.x = ()};
  78. // --- use_export_copy.carbon
  79. library "[[@TEST_NAME]]";
  80. import library "export";
  81. import library "export_copy";
  82. var c: C = {.x = ()};
  83. // --- fail_use_non_export.carbon
  84. library "[[@TEST_NAME]]";
  85. import library "non_export";
  86. // CHECK:STDERR: fail_use_non_export.carbon:[[@LINE+3]]:15: error: name `C` not found [NameNotFound]
  87. // CHECK:STDERR: alias Local = C;
  88. // CHECK:STDERR: ^
  89. alias Local = C;
  90. // --- use_non_export_then_base.carbon
  91. library "[[@TEST_NAME]]";
  92. import library "non_export";
  93. export import library "base";
  94. var c: C = {.x = ()};
  95. // --- indirect_use_non_export_then_base.carbon
  96. library "[[@TEST_NAME]]";
  97. import library "use_non_export_then_base";
  98. var indirect_c: C = {.x = ()};
  99. // CHECK:STDOUT: --- base.carbon
  100. // CHECK:STDOUT:
  101. // CHECK:STDOUT: constants {
  102. // CHECK:STDOUT: %C: type = class_type @C [template]
  103. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  104. // CHECK:STDOUT: %.1: type = unbound_element_type %C, %empty_tuple.type [template]
  105. // CHECK:STDOUT: %.2: type = struct_type {.x: %empty_tuple.type} [template]
  106. // CHECK:STDOUT: %.3: <witness> = complete_type_witness %.2 [template]
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: file {
  110. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  111. // CHECK:STDOUT: .C = %C.decl
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  114. // CHECK:STDOUT: }
  115. // CHECK:STDOUT:
  116. // CHECK:STDOUT: class @C {
  117. // CHECK:STDOUT: %.loc5_11.1: %empty_tuple.type = tuple_literal ()
  118. // CHECK:STDOUT: %.loc5_11.2: type = converted %.loc5_11.1, constants.%empty_tuple.type [template = constants.%empty_tuple.type]
  119. // CHECK:STDOUT: %.loc5_8: %.1 = field_decl x, element0 [template]
  120. // CHECK:STDOUT: %.loc6: <witness> = complete_type_witness %.2 [template = constants.%.3]
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: !members:
  123. // CHECK:STDOUT: .Self = constants.%C
  124. // CHECK:STDOUT: .x = %.loc5_8
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: --- export.carbon
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: imports {
  130. // CHECK:STDOUT: %import_ref = import_ref Main//base, inst+1, unloaded
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: file {
  134. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  135. // CHECK:STDOUT: .C = imports.%import_ref
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: %default.import = import <invalid>
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: --- export_copy.carbon
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: imports {
  143. // CHECK:STDOUT: %import_ref = import_ref Main//base, inst+1, unloaded
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: file {
  147. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  148. // CHECK:STDOUT: .C = imports.%import_ref
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %default.import = import <invalid>
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: --- non_export.carbon
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: imports {
  156. // CHECK:STDOUT: %import_ref = import_ref Main//base, inst+1, unloaded
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: file {
  160. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  161. // CHECK:STDOUT: .C = imports.%import_ref
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %default.import = import <invalid>
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: --- export_export.carbon
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: imports {
  169. // CHECK:STDOUT: %import_ref = import_ref Main//base, inst+1, unloaded
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: file {
  173. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  174. // CHECK:STDOUT: .C = imports.%import_ref
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %default.import = import <invalid>
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: --- import_then_export.carbon
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: imports {
  182. // CHECK:STDOUT: %import_ref = import_ref Main//base, inst+1, unloaded
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: file {
  186. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  187. // CHECK:STDOUT: .C = imports.%import_ref
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: %default.import = import <invalid>
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: --- export_in_impl.carbon
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: file {
  195. // CHECK:STDOUT: package: <namespace> = namespace [template] {}
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: --- use_export.carbon
  199. // CHECK:STDOUT:
  200. // CHECK:STDOUT: constants {
  201. // CHECK:STDOUT: %C: type = class_type @C [template]
  202. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  203. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  204. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  205. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: imports {
  209. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  210. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  211. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: file {
  215. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  216. // CHECK:STDOUT: .C = imports.%import_ref.1
  217. // CHECK:STDOUT: .c = %c
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: %default.import = import <invalid>
  220. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  221. // CHECK:STDOUT: %c.var: ref %C = var c
  222. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: class @C {
  226. // CHECK:STDOUT: !members:
  227. // CHECK:STDOUT: .Self = imports.%import_ref.2
  228. // CHECK:STDOUT: .x = imports.%import_ref.3
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: fn @__global_init() {
  232. // CHECK:STDOUT: !entry:
  233. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  234. // CHECK:STDOUT: %.loc6_20.1: %.1 = struct_literal (%.loc6_19.1)
  235. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  236. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  237. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  238. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%struct]
  239. // CHECK:STDOUT: %.loc6_21: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%struct]
  240. // CHECK:STDOUT: assign file.%c.var, %.loc6_21
  241. // CHECK:STDOUT: return
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: --- fail_export_in_impl.impl.carbon
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: constants {
  247. // CHECK:STDOUT: %C: type = class_type @C [template]
  248. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  249. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  250. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  251. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: imports {
  255. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  256. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  257. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: file {
  261. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  262. // CHECK:STDOUT: .C = imports.%import_ref.1
  263. // CHECK:STDOUT: .c = %c
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  266. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  267. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  268. // CHECK:STDOUT: %c.var: ref %C = var c
  269. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  270. // CHECK:STDOUT: }
  271. // CHECK:STDOUT:
  272. // CHECK:STDOUT: class @C {
  273. // CHECK:STDOUT: !members:
  274. // CHECK:STDOUT: .Self = imports.%import_ref.2
  275. // CHECK:STDOUT: .x = imports.%import_ref.3
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: fn @__global_init() {
  279. // CHECK:STDOUT: !entry:
  280. // CHECK:STDOUT: %.loc11_19.1: %empty_tuple.type = tuple_literal ()
  281. // CHECK:STDOUT: %.loc11_20.1: %.1 = struct_literal (%.loc11_19.1)
  282. // CHECK:STDOUT: %.loc11_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  283. // CHECK:STDOUT: %.loc11_19.2: init %empty_tuple.type = tuple_init () to %.loc11_20.2 [template = constants.%empty_tuple]
  284. // CHECK:STDOUT: %.loc11_20.3: init %empty_tuple.type = converted %.loc11_19.1, %.loc11_19.2 [template = constants.%empty_tuple]
  285. // CHECK:STDOUT: %.loc11_20.4: init %C = class_init (%.loc11_20.3), file.%c.var [template = constants.%struct]
  286. // CHECK:STDOUT: %.loc11_21: init %C = converted %.loc11_20.1, %.loc11_20.4 [template = constants.%struct]
  287. // CHECK:STDOUT: assign file.%c.var, %.loc11_21
  288. // CHECK:STDOUT: return
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: --- export_export.impl.carbon
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: constants {
  294. // CHECK:STDOUT: %C: type = class_type @C [template]
  295. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  296. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  297. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  298. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: imports {
  302. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//export_export, inst+2, loaded [template = constants.%C]
  303. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  304. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  305. // CHECK:STDOUT: }
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: file {
  308. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  309. // CHECK:STDOUT: .C = imports.%import_ref.1
  310. // CHECK:STDOUT: .c = %c
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  313. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  314. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  315. // CHECK:STDOUT: %c.var: ref %C = var c
  316. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: class @C {
  320. // CHECK:STDOUT: !members:
  321. // CHECK:STDOUT: .Self = imports.%import_ref.2
  322. // CHECK:STDOUT: .x = imports.%import_ref.3
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: fn @__global_init() {
  326. // CHECK:STDOUT: !entry:
  327. // CHECK:STDOUT: %.loc4_19.1: %empty_tuple.type = tuple_literal ()
  328. // CHECK:STDOUT: %.loc4_20.1: %.1 = struct_literal (%.loc4_19.1)
  329. // CHECK:STDOUT: %.loc4_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  330. // CHECK:STDOUT: %.loc4_19.2: init %empty_tuple.type = tuple_init () to %.loc4_20.2 [template = constants.%empty_tuple]
  331. // CHECK:STDOUT: %.loc4_20.3: init %empty_tuple.type = converted %.loc4_19.1, %.loc4_19.2 [template = constants.%empty_tuple]
  332. // CHECK:STDOUT: %.loc4_20.4: init %C = class_init (%.loc4_20.3), file.%c.var [template = constants.%struct]
  333. // CHECK:STDOUT: %.loc4_21: init %C = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%struct]
  334. // CHECK:STDOUT: assign file.%c.var, %.loc4_21
  335. // CHECK:STDOUT: return
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: --- use_export_export.carbon
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: constants {
  341. // CHECK:STDOUT: %C: type = class_type @C [template]
  342. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  343. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  344. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  345. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: imports {
  349. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  350. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  351. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: file {
  355. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  356. // CHECK:STDOUT: .C = imports.%import_ref.1
  357. // CHECK:STDOUT: .c = %c
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT: %default.import = import <invalid>
  360. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  361. // CHECK:STDOUT: %c.var: ref %C = var c
  362. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: class @C {
  366. // CHECK:STDOUT: !members:
  367. // CHECK:STDOUT: .Self = imports.%import_ref.2
  368. // CHECK:STDOUT: .x = imports.%import_ref.3
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: fn @__global_init() {
  372. // CHECK:STDOUT: !entry:
  373. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  374. // CHECK:STDOUT: %.loc6_20.1: %.1 = struct_literal (%.loc6_19.1)
  375. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  376. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  377. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  378. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%struct]
  379. // CHECK:STDOUT: %.loc6_21: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%struct]
  380. // CHECK:STDOUT: assign file.%c.var, %.loc6_21
  381. // CHECK:STDOUT: return
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: --- use_import_then_export.carbon
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: constants {
  387. // CHECK:STDOUT: %C: type = class_type @C [template]
  388. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  389. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  390. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  391. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT:
  394. // CHECK:STDOUT: imports {
  395. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  396. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  397. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  398. // CHECK:STDOUT: }
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: file {
  401. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  402. // CHECK:STDOUT: .C = imports.%import_ref.1
  403. // CHECK:STDOUT: .c = %c
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT: %default.import = import <invalid>
  406. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  407. // CHECK:STDOUT: %c.var: ref %C = var c
  408. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: class @C {
  412. // CHECK:STDOUT: !members:
  413. // CHECK:STDOUT: .Self = imports.%import_ref.2
  414. // CHECK:STDOUT: .x = imports.%import_ref.3
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: fn @__global_init() {
  418. // CHECK:STDOUT: !entry:
  419. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  420. // CHECK:STDOUT: %.loc6_20.1: %.1 = struct_literal (%.loc6_19.1)
  421. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  422. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  423. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  424. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%struct]
  425. // CHECK:STDOUT: %.loc6_21: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%struct]
  426. // CHECK:STDOUT: assign file.%c.var, %.loc6_21
  427. // CHECK:STDOUT: return
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: --- use_import_when_export.carbon
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: constants {
  433. // CHECK:STDOUT: %C: type = class_type @C [template]
  434. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  435. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  436. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  437. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: imports {
  441. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  442. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  443. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: file {
  447. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  448. // CHECK:STDOUT: .C = imports.%import_ref.1
  449. // CHECK:STDOUT: .c = %c
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT: %default.import = import <invalid>
  452. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  453. // CHECK:STDOUT: %c.var: ref %C = var c
  454. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: class @C {
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: .Self = imports.%import_ref.2
  460. // CHECK:STDOUT: .x = imports.%import_ref.3
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: fn @__global_init() {
  464. // CHECK:STDOUT: !entry:
  465. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  466. // CHECK:STDOUT: %.loc6_20.1: %.1 = struct_literal (%.loc6_19.1)
  467. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  468. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  469. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  470. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%struct]
  471. // CHECK:STDOUT: %.loc6_21: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%struct]
  472. // CHECK:STDOUT: assign file.%c.var, %.loc6_21
  473. // CHECK:STDOUT: return
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: --- use_base_and_export.carbon
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: constants {
  479. // CHECK:STDOUT: %C: type = class_type @C [template]
  480. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  481. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  482. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  483. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  484. // CHECK:STDOUT: }
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: imports {
  487. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  488. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  489. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: file {
  493. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  494. // CHECK:STDOUT: .C = imports.%import_ref.1
  495. // CHECK:STDOUT: .c = %c
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT: %default.import = import <invalid>
  498. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  499. // CHECK:STDOUT: %c.var: ref %C = var c
  500. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  501. // CHECK:STDOUT: }
  502. // CHECK:STDOUT:
  503. // CHECK:STDOUT: class @C {
  504. // CHECK:STDOUT: !members:
  505. // CHECK:STDOUT: .Self = imports.%import_ref.2
  506. // CHECK:STDOUT: .x = imports.%import_ref.3
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: fn @__global_init() {
  510. // CHECK:STDOUT: !entry:
  511. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  512. // CHECK:STDOUT: %.loc7_20.1: %.1 = struct_literal (%.loc7_19.1)
  513. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  514. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  515. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  516. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%struct]
  517. // CHECK:STDOUT: %.loc7_21: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%struct]
  518. // CHECK:STDOUT: assign file.%c.var, %.loc7_21
  519. // CHECK:STDOUT: return
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: --- use_export_and_base.carbon
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: constants {
  525. // CHECK:STDOUT: %C: type = class_type @C [template]
  526. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  527. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  528. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  529. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: imports {
  533. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  534. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  535. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: file {
  539. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  540. // CHECK:STDOUT: .C = imports.%import_ref.1
  541. // CHECK:STDOUT: .c = %c
  542. // CHECK:STDOUT: }
  543. // CHECK:STDOUT: %default.import = import <invalid>
  544. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  545. // CHECK:STDOUT: %c.var: ref %C = var c
  546. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: class @C {
  550. // CHECK:STDOUT: !members:
  551. // CHECK:STDOUT: .Self = imports.%import_ref.2
  552. // CHECK:STDOUT: .x = imports.%import_ref.3
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: fn @__global_init() {
  556. // CHECK:STDOUT: !entry:
  557. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  558. // CHECK:STDOUT: %.loc7_20.1: %.1 = struct_literal (%.loc7_19.1)
  559. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  560. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  561. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  562. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%struct]
  563. // CHECK:STDOUT: %.loc7_21: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%struct]
  564. // CHECK:STDOUT: assign file.%c.var, %.loc7_21
  565. // CHECK:STDOUT: return
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: --- use_export_copy.carbon
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: constants {
  571. // CHECK:STDOUT: %C: type = class_type @C [template]
  572. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  573. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  574. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  575. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: imports {
  579. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  580. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  581. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: file {
  585. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  586. // CHECK:STDOUT: .C = imports.%import_ref.1
  587. // CHECK:STDOUT: .c = %c
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT: %default.import = import <invalid>
  590. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  591. // CHECK:STDOUT: %c.var: ref %C = var c
  592. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: class @C {
  596. // CHECK:STDOUT: !members:
  597. // CHECK:STDOUT: .Self = imports.%import_ref.2
  598. // CHECK:STDOUT: .x = imports.%import_ref.3
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: fn @__global_init() {
  602. // CHECK:STDOUT: !entry:
  603. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  604. // CHECK:STDOUT: %.loc7_20.1: %.1 = struct_literal (%.loc7_19.1)
  605. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  606. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  607. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  608. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%struct]
  609. // CHECK:STDOUT: %.loc7_21: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%struct]
  610. // CHECK:STDOUT: assign file.%c.var, %.loc7_21
  611. // CHECK:STDOUT: return
  612. // CHECK:STDOUT: }
  613. // CHECK:STDOUT:
  614. // CHECK:STDOUT: --- fail_use_non_export.carbon
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: file {
  617. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  618. // CHECK:STDOUT: .Local = %Local
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT: %default.import = import <invalid>
  621. // CHECK:STDOUT: %C.ref: <error> = name_ref C, <error> [template = <error>]
  622. // CHECK:STDOUT: %Local: <error> = bind_alias Local, <error> [template = <error>]
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: --- use_non_export_then_base.carbon
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: constants {
  628. // CHECK:STDOUT: %C: type = class_type @C [template]
  629. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  630. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  631. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  632. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: imports {
  636. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  637. // CHECK:STDOUT: %import_ref.2 = import_ref Main//base, inst+2, unloaded
  638. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+7, unloaded
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: file {
  642. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  643. // CHECK:STDOUT: .C = imports.%import_ref.1
  644. // CHECK:STDOUT: .c = %c
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT: %default.import = import <invalid>
  647. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  648. // CHECK:STDOUT: %c.var: ref %C = var c
  649. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: class @C {
  653. // CHECK:STDOUT: !members:
  654. // CHECK:STDOUT: .Self = imports.%import_ref.2
  655. // CHECK:STDOUT: .x = imports.%import_ref.3
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: fn @__global_init() {
  659. // CHECK:STDOUT: !entry:
  660. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  661. // CHECK:STDOUT: %.loc7_20.1: %.1 = struct_literal (%.loc7_19.1)
  662. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  663. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  664. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  665. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%struct]
  666. // CHECK:STDOUT: %.loc7_21: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%struct]
  667. // CHECK:STDOUT: assign file.%c.var, %.loc7_21
  668. // CHECK:STDOUT: return
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: --- indirect_use_non_export_then_base.carbon
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: constants {
  674. // CHECK:STDOUT: %C: type = class_type @C [template]
  675. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  676. // CHECK:STDOUT: %.1: type = struct_type {.x: %empty_tuple.type} [template]
  677. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  678. // CHECK:STDOUT: %struct: %C = struct_value (%empty_tuple) [template]
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: imports {
  682. // CHECK:STDOUT: %import_ref.1 = import_ref Main//use_non_export_then_base, inst+13, unloaded
  683. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//base, inst+1, loaded [template = constants.%C]
  684. // CHECK:STDOUT: %import_ref.3 = import_ref Main//base, inst+2, unloaded
  685. // CHECK:STDOUT: %import_ref.4 = import_ref Main//base, inst+7, unloaded
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: file {
  689. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  690. // CHECK:STDOUT: .c = imports.%import_ref.1
  691. // CHECK:STDOUT: .C = imports.%import_ref.2
  692. // CHECK:STDOUT: .indirect_c = %indirect_c
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT: %default.import = import <invalid>
  695. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.2 [template = constants.%C]
  696. // CHECK:STDOUT: %indirect_c.var: ref %C = var indirect_c
  697. // CHECK:STDOUT: %indirect_c: ref %C = bind_name indirect_c, %indirect_c.var
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: class @C {
  701. // CHECK:STDOUT: !members:
  702. // CHECK:STDOUT: .Self = imports.%import_ref.3
  703. // CHECK:STDOUT: .x = imports.%import_ref.4
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: fn @__global_init() {
  707. // CHECK:STDOUT: !entry:
  708. // CHECK:STDOUT: %.loc6_28.1: %empty_tuple.type = tuple_literal ()
  709. // CHECK:STDOUT: %.loc6_29.1: %.1 = struct_literal (%.loc6_28.1)
  710. // CHECK:STDOUT: %.loc6_29.2: ref %empty_tuple.type = class_element_access file.%indirect_c.var, element0
  711. // CHECK:STDOUT: %.loc6_28.2: init %empty_tuple.type = tuple_init () to %.loc6_29.2 [template = constants.%empty_tuple]
  712. // CHECK:STDOUT: %.loc6_29.3: init %empty_tuple.type = converted %.loc6_28.1, %.loc6_28.2 [template = constants.%empty_tuple]
  713. // CHECK:STDOUT: %.loc6_29.4: init %C = class_init (%.loc6_29.3), file.%indirect_c.var [template = constants.%struct]
  714. // CHECK:STDOUT: %.loc6_30: init %C = converted %.loc6_29.1, %.loc6_29.4 [template = constants.%struct]
  715. // CHECK:STDOUT: assign file.%indirect_c.var, %.loc6_30
  716. // CHECK:STDOUT: return
  717. // CHECK:STDOUT: }
  718. // CHECK:STDOUT: