export_import.carbon 33 KB

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