cross_package_export.carbon 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/cross_package_export.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/cross_package_export.carbon
  14. // ============================================================================
  15. // Setup files
  16. // ============================================================================
  17. // --- base.carbon
  18. package Other library "[[@TEST_NAME]]";
  19. class C {
  20. var x: ();
  21. };
  22. // --- conflict.carbon
  23. package Other library "[[@TEST_NAME]]";
  24. fn C() {}
  25. // --- export_import.carbon
  26. package Other library "[[@TEST_NAME]]";
  27. export import library "base";
  28. // --- export_import_copy.carbon
  29. package Other library "[[@TEST_NAME]]";
  30. export import library "base";
  31. // --- export_import_indirect.carbon
  32. package Other library "[[@TEST_NAME]]";
  33. export import library "export_import";
  34. // --- export_name.carbon
  35. package Other library "[[@TEST_NAME]]";
  36. import library "base";
  37. export C;
  38. // --- export_name_copy.carbon
  39. package Other library "[[@TEST_NAME]]";
  40. import library "base";
  41. export C;
  42. // --- export_name_indirect.carbon
  43. package Other library "[[@TEST_NAME]]";
  44. import library "export_name";
  45. export C;
  46. // ============================================================================
  47. // Test files
  48. // ============================================================================
  49. // --- use_export_import.carbon
  50. library "[[@TEST_NAME]]";
  51. import Other library "export_import";
  52. var c: Other.C = {.x = ()};
  53. // --- use_export_import_with_copy.carbon
  54. library "[[@TEST_NAME]]";
  55. import Other library "export_import";
  56. import Other library "export_import_copy";
  57. var c: Other.C = {.x = ()};
  58. // --- use_export_import_indirect.carbon
  59. library "[[@TEST_NAME]]";
  60. import Other library "export_import_indirect";
  61. var c: Other.C = {.x = ()};
  62. // --- use_export_name.carbon
  63. library "[[@TEST_NAME]]";
  64. import Other library "export_name";
  65. var c: Other.C = {.x = ()};
  66. // --- use_export_name_with_copy.carbon
  67. library "[[@TEST_NAME]]";
  68. import Other library "export_name";
  69. import Other library "export_name_copy";
  70. var c: Other.C = {.x = ()};
  71. // --- use_export_name_indirect.carbon
  72. library "[[@TEST_NAME]]";
  73. import Other library "export_name_indirect";
  74. var c: Other.C = {.x = ()};
  75. // --- use_export_all.carbon
  76. library "[[@TEST_NAME]]";
  77. import Other library "export_import";
  78. import Other library "export_name";
  79. import Other library "export_import_copy";
  80. import Other library "export_name_copy";
  81. import Other library "export_import_indirect";
  82. import Other library "export_name_indirect";
  83. var c: Other.C = {.x = ()};
  84. // --- unused_conflict_on_export_import.carbon
  85. library "[[@TEST_NAME]]";
  86. import Other library "export_import";
  87. import Other library "conflict";
  88. // --- unused_conflict_on_export_name.carbon
  89. library "[[@TEST_NAME]]";
  90. import Other library "export_name";
  91. import Other library "conflict";
  92. // --- fail_conflict_on_export_import.carbon
  93. library "[[@TEST_NAME]]";
  94. // CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+8]]:1: in import [InImport]
  95. // CHECK:STDERR: base.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
  96. // CHECK:STDERR: class C {
  97. // CHECK:STDERR: ^~~~~~~~~
  98. // CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+4]]:1: in import [InImport]
  99. // CHECK:STDERR: conflict.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  100. // CHECK:STDERR: fn C() {}
  101. // CHECK:STDERR: ^~~~~~~~
  102. import Other library "export_import";
  103. import Other library "conflict";
  104. // CHECK:STDERR: fail_conflict_on_export_import.carbon:[[@LINE+4]]:11: note: in name lookup for `C` [InNameLookup]
  105. // CHECK:STDERR: alias C = Other.C;
  106. // CHECK:STDERR: ^~~~~~~
  107. // CHECK:STDERR:
  108. alias C = Other.C;
  109. // --- fail_conflict_on_export_name.carbon
  110. library "[[@TEST_NAME]]";
  111. // CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+9]]:1: in import [InImport]
  112. // CHECK:STDERR: conflict.carbon:4:1: error: duplicate name `C` being declared in the same scope [NameDeclDuplicate]
  113. // CHECK:STDERR: fn C() {}
  114. // CHECK:STDERR: ^~~~~~~~
  115. // CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+5]]:1: in import [InImport]
  116. // CHECK:STDERR: export_name.carbon:4:1: in import [InImport]
  117. // CHECK:STDERR: base.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  118. // CHECK:STDERR: class C {
  119. // CHECK:STDERR: ^~~~~~~~~
  120. import Other library "export_name";
  121. import Other library "conflict";
  122. // CHECK:STDERR: fail_conflict_on_export_name.carbon:[[@LINE+4]]:11: note: in name lookup for `C` [InNameLookup]
  123. // CHECK:STDERR: alias C = Other.C;
  124. // CHECK:STDERR: ^~~~~~~
  125. // CHECK:STDERR:
  126. alias C = Other.C;
  127. // CHECK:STDOUT: --- base.carbon
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: constants {
  130. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  131. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  132. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %empty_tuple.type [concrete]
  133. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  134. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  135. // CHECK:STDOUT: }
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: file {
  138. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  139. // CHECK:STDOUT: .C = %C.decl
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT:
  144. // CHECK:STDOUT: class @C {
  145. // CHECK:STDOUT: %.loc5_11.1: %empty_tuple.type = tuple_literal ()
  146. // CHECK:STDOUT: %.loc5_11.2: type = converted %.loc5_11.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  147. // CHECK:STDOUT: %.loc5_8: %C.elem = field_decl x, element0 [concrete]
  148. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%struct_type.x [concrete = constants.%complete_type]
  149. // CHECK:STDOUT: complete_type_witness = %complete_type
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: !members:
  152. // CHECK:STDOUT: .Self = constants.%C
  153. // CHECK:STDOUT: .x = %.loc5_8
  154. // CHECK:STDOUT: }
  155. // CHECK:STDOUT:
  156. // CHECK:STDOUT: --- conflict.carbon
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: constants {
  159. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  160. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: file {
  164. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  165. // CHECK:STDOUT: .C = %C.decl
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {} {}
  168. // CHECK:STDOUT: }
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: fn @C() {
  171. // CHECK:STDOUT: !entry:
  172. // CHECK:STDOUT: return
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: --- export_import.carbon
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: imports {
  178. // CHECK:STDOUT: %Other.C = import_ref Other//base, C, unloaded
  179. // CHECK:STDOUT: }
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: file {
  182. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  183. // CHECK:STDOUT: .C = imports.%Other.C
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: %default.import = import <none>
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: --- export_import_copy.carbon
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: imports {
  191. // CHECK:STDOUT: %Other.C = import_ref Other//base, C, unloaded
  192. // CHECK:STDOUT: }
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: file {
  195. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  196. // CHECK:STDOUT: .C = imports.%Other.C
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT: %default.import = import <none>
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: --- export_import_indirect.carbon
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: imports {
  204. // CHECK:STDOUT: %Other.C = import_ref Other//base, C, unloaded
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: file {
  208. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  209. // CHECK:STDOUT: .C = imports.%Other.C
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %default.import = import <none>
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: --- export_name.carbon
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: constants {
  217. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  218. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  219. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  220. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: imports {
  224. // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C]
  225. // CHECK:STDOUT: %Other.import_ref.56d: <witness> = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type]
  226. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//base, inst16 [no loc], unloaded
  227. // CHECK:STDOUT: %Other.import_ref.276 = import_ref Other//base, loc5_8, unloaded
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: file {
  231. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  232. // CHECK:STDOUT: .C = %C
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %default.import = import <none>
  235. // CHECK:STDOUT: %C: type = export C, imports.%Other.C [concrete = constants.%C]
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: class @C [from "base.carbon"] {
  239. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.56d
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: !members:
  242. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  243. // CHECK:STDOUT: .x = imports.%Other.import_ref.276
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: --- export_name_copy.carbon
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: constants {
  249. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  250. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  251. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  252. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: imports {
  256. // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C]
  257. // CHECK:STDOUT: %Other.import_ref.56d: <witness> = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type]
  258. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//base, inst16 [no loc], unloaded
  259. // CHECK:STDOUT: %Other.import_ref.276 = import_ref Other//base, loc5_8, unloaded
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: file {
  263. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  264. // CHECK:STDOUT: .C = %C
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %default.import = import <none>
  267. // CHECK:STDOUT: %C: type = export C, imports.%Other.C [concrete = constants.%C]
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: class @C [from "base.carbon"] {
  271. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.56d
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: !members:
  274. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  275. // CHECK:STDOUT: .x = imports.%Other.import_ref.276
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: --- export_name_indirect.carbon
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: constants {
  281. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  282. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  283. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  284. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: imports {
  288. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name, C, loaded [concrete = constants.%C]
  289. // CHECK:STDOUT: %Other.import_ref.ad3: <witness> = import_ref Other//export_name, inst22 [indirect], loaded [concrete = constants.%complete_type]
  290. // CHECK:STDOUT: %Other.import_ref.6a9 = import_ref Other//export_name, inst23 [indirect], unloaded
  291. // CHECK:STDOUT: %Other.import_ref.f67 = import_ref Other//export_name, inst24 [indirect], unloaded
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: file {
  295. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  296. // CHECK:STDOUT: .C = %C
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT: %default.import = import <none>
  299. // CHECK:STDOUT: %C: type = export C, imports.%Other.C [concrete = constants.%C]
  300. // CHECK:STDOUT: }
  301. // CHECK:STDOUT:
  302. // CHECK:STDOUT: class @C [from "export_name.carbon"] {
  303. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.ad3
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: !members:
  306. // CHECK:STDOUT: .Self = imports.%Other.import_ref.6a9
  307. // CHECK:STDOUT: .x = imports.%Other.import_ref.f67
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: --- use_export_import.carbon
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: constants {
  313. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  314. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  315. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  316. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  317. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  318. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  319. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  320. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: imports {
  324. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  325. // CHECK:STDOUT: .C = %Other.C
  326. // CHECK:STDOUT: import Other//export_import
  327. // CHECK:STDOUT: import Other//base
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C]
  330. // CHECK:STDOUT: %Other.import_ref.56d: <witness> = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type]
  331. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//base, inst16 [no loc], unloaded
  332. // CHECK:STDOUT: %Other.import_ref.276 = import_ref Other//base, loc5_8, unloaded
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: file {
  336. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  337. // CHECK:STDOUT: .Other = imports.%Other
  338. // CHECK:STDOUT: .c = %c
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: %Other.import = import Other
  341. // CHECK:STDOUT: name_binding_decl {
  342. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  343. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  346. // CHECK:STDOUT: %.loc6: type = splice_block %C.ref [concrete = constants.%C] {
  347. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  348. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: class @C [from "base.carbon"] {
  354. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.56d
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: !members:
  357. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  358. // CHECK:STDOUT: .x = imports.%Other.import_ref.276
  359. // CHECK:STDOUT: }
  360. // CHECK:STDOUT:
  361. // CHECK:STDOUT: fn @__global_init() {
  362. // CHECK:STDOUT: !entry:
  363. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal ()
  364. // CHECK:STDOUT: %.loc6_26.1: %struct_type.x = struct_literal (%.loc6_25.1)
  365. // CHECK:STDOUT: %.loc6_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  366. // CHECK:STDOUT: %.loc6_25.2: init %empty_tuple.type = tuple_init () to %.loc6_26.2 [concrete = constants.%empty_tuple]
  367. // CHECK:STDOUT: %.loc6_26.3: init %empty_tuple.type = converted %.loc6_25.1, %.loc6_25.2 [concrete = constants.%empty_tuple]
  368. // CHECK:STDOUT: %.loc6_26.4: init %C = class_init (%.loc6_26.3), file.%c.var [concrete = constants.%C.val]
  369. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_26.1, %.loc6_26.4 [concrete = constants.%C.val]
  370. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  371. // CHECK:STDOUT: return
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: --- use_export_import_with_copy.carbon
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: constants {
  377. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  378. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  379. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  380. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  381. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  382. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  383. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  384. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: imports {
  388. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  389. // CHECK:STDOUT: .C = %Other.C
  390. // CHECK:STDOUT: import Other//export_import
  391. // CHECK:STDOUT: import Other//export_import_copy
  392. // CHECK:STDOUT: import Other//base
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C]
  395. // CHECK:STDOUT: %Other.import_ref.56d: <witness> = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type]
  396. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//base, inst16 [no loc], unloaded
  397. // CHECK:STDOUT: %Other.import_ref.276 = import_ref Other//base, loc5_8, unloaded
  398. // CHECK:STDOUT: }
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: file {
  401. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  402. // CHECK:STDOUT: .Other = imports.%Other
  403. // CHECK:STDOUT: .c = %c
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT: %Other.import = import Other
  406. // CHECK:STDOUT: name_binding_decl {
  407. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  408. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  411. // CHECK:STDOUT: %.loc7: type = splice_block %C.ref [concrete = constants.%C] {
  412. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  413. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: class @C [from "base.carbon"] {
  419. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.56d
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: !members:
  422. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  423. // CHECK:STDOUT: .x = imports.%Other.import_ref.276
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: fn @__global_init() {
  427. // CHECK:STDOUT: !entry:
  428. // CHECK:STDOUT: %.loc7_25.1: %empty_tuple.type = tuple_literal ()
  429. // CHECK:STDOUT: %.loc7_26.1: %struct_type.x = struct_literal (%.loc7_25.1)
  430. // CHECK:STDOUT: %.loc7_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  431. // CHECK:STDOUT: %.loc7_25.2: init %empty_tuple.type = tuple_init () to %.loc7_26.2 [concrete = constants.%empty_tuple]
  432. // CHECK:STDOUT: %.loc7_26.3: init %empty_tuple.type = converted %.loc7_25.1, %.loc7_25.2 [concrete = constants.%empty_tuple]
  433. // CHECK:STDOUT: %.loc7_26.4: init %C = class_init (%.loc7_26.3), file.%c.var [concrete = constants.%C.val]
  434. // CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_26.1, %.loc7_26.4 [concrete = constants.%C.val]
  435. // CHECK:STDOUT: assign file.%c.var, %.loc7_1
  436. // CHECK:STDOUT: return
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: --- use_export_import_indirect.carbon
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: constants {
  442. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  443. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  444. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  445. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  446. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  447. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  448. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  449. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: imports {
  453. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  454. // CHECK:STDOUT: .C = %Other.C
  455. // CHECK:STDOUT: import Other//export_import_indirect
  456. // CHECK:STDOUT: import Other//export_import
  457. // CHECK:STDOUT: import Other//base
  458. // CHECK:STDOUT: }
  459. // CHECK:STDOUT: %Other.C: type = import_ref Other//base, C, loaded [concrete = constants.%C]
  460. // CHECK:STDOUT: %Other.import_ref.56d: <witness> = import_ref Other//base, loc6_1, loaded [concrete = constants.%complete_type]
  461. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//base, inst16 [no loc], unloaded
  462. // CHECK:STDOUT: %Other.import_ref.276 = import_ref Other//base, loc5_8, unloaded
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: file {
  466. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  467. // CHECK:STDOUT: .Other = imports.%Other
  468. // CHECK:STDOUT: .c = %c
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: %Other.import = import Other
  471. // CHECK:STDOUT: name_binding_decl {
  472. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  473. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  474. // CHECK:STDOUT: }
  475. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  476. // CHECK:STDOUT: %.loc6: type = splice_block %C.ref [concrete = constants.%C] {
  477. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  478. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: class @C [from "base.carbon"] {
  484. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.56d
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: !members:
  487. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  488. // CHECK:STDOUT: .x = imports.%Other.import_ref.276
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: fn @__global_init() {
  492. // CHECK:STDOUT: !entry:
  493. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal ()
  494. // CHECK:STDOUT: %.loc6_26.1: %struct_type.x = struct_literal (%.loc6_25.1)
  495. // CHECK:STDOUT: %.loc6_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  496. // CHECK:STDOUT: %.loc6_25.2: init %empty_tuple.type = tuple_init () to %.loc6_26.2 [concrete = constants.%empty_tuple]
  497. // CHECK:STDOUT: %.loc6_26.3: init %empty_tuple.type = converted %.loc6_25.1, %.loc6_25.2 [concrete = constants.%empty_tuple]
  498. // CHECK:STDOUT: %.loc6_26.4: init %C = class_init (%.loc6_26.3), file.%c.var [concrete = constants.%C.val]
  499. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_26.1, %.loc6_26.4 [concrete = constants.%C.val]
  500. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  501. // CHECK:STDOUT: return
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: --- use_export_name.carbon
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: constants {
  507. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  508. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  509. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  510. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  511. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  512. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  513. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  514. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: imports {
  518. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  519. // CHECK:STDOUT: .C = %Other.C
  520. // CHECK:STDOUT: import Other//export_name
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name, C, loaded [concrete = constants.%C]
  523. // CHECK:STDOUT: %Other.import_ref.ad3: <witness> = import_ref Other//export_name, inst22 [indirect], loaded [concrete = constants.%complete_type]
  524. // CHECK:STDOUT: %Other.import_ref.6a9 = import_ref Other//export_name, inst23 [indirect], unloaded
  525. // CHECK:STDOUT: %Other.import_ref.f67 = import_ref Other//export_name, inst24 [indirect], unloaded
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: file {
  529. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  530. // CHECK:STDOUT: .Other = imports.%Other
  531. // CHECK:STDOUT: .c = %c
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: %Other.import = import Other
  534. // CHECK:STDOUT: name_binding_decl {
  535. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  536. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  539. // CHECK:STDOUT: %.loc6: type = splice_block %C.ref [concrete = constants.%C] {
  540. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  541. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  542. // CHECK:STDOUT: }
  543. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: class @C [from "export_name.carbon"] {
  547. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.ad3
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: !members:
  550. // CHECK:STDOUT: .Self = imports.%Other.import_ref.6a9
  551. // CHECK:STDOUT: .x = imports.%Other.import_ref.f67
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: fn @__global_init() {
  555. // CHECK:STDOUT: !entry:
  556. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal ()
  557. // CHECK:STDOUT: %.loc6_26.1: %struct_type.x = struct_literal (%.loc6_25.1)
  558. // CHECK:STDOUT: %.loc6_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  559. // CHECK:STDOUT: %.loc6_25.2: init %empty_tuple.type = tuple_init () to %.loc6_26.2 [concrete = constants.%empty_tuple]
  560. // CHECK:STDOUT: %.loc6_26.3: init %empty_tuple.type = converted %.loc6_25.1, %.loc6_25.2 [concrete = constants.%empty_tuple]
  561. // CHECK:STDOUT: %.loc6_26.4: init %C = class_init (%.loc6_26.3), file.%c.var [concrete = constants.%C.val]
  562. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_26.1, %.loc6_26.4 [concrete = constants.%C.val]
  563. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  564. // CHECK:STDOUT: return
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: --- use_export_name_with_copy.carbon
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: constants {
  570. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  571. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  572. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  573. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  574. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  575. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  576. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  577. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: imports {
  581. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  582. // CHECK:STDOUT: .C = %Other.C
  583. // CHECK:STDOUT: import Other//export_name
  584. // CHECK:STDOUT: import Other//export_name_copy
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name, C, loaded [concrete = constants.%C]
  587. // CHECK:STDOUT: %Other.import_ref.ad3: <witness> = import_ref Other//export_name, inst22 [indirect], loaded [concrete = constants.%complete_type]
  588. // CHECK:STDOUT: %Other.import_ref.6a9 = import_ref Other//export_name, inst23 [indirect], unloaded
  589. // CHECK:STDOUT: %Other.import_ref.f67 = import_ref Other//export_name, inst24 [indirect], unloaded
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: file {
  593. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  594. // CHECK:STDOUT: .Other = imports.%Other
  595. // CHECK:STDOUT: .c = %c
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT: %Other.import = import Other
  598. // CHECK:STDOUT: name_binding_decl {
  599. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  600. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  603. // CHECK:STDOUT: %.loc7: type = splice_block %C.ref [concrete = constants.%C] {
  604. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  605. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: class @C [from "export_name.carbon"] {
  611. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.ad3
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: !members:
  614. // CHECK:STDOUT: .Self = imports.%Other.import_ref.6a9
  615. // CHECK:STDOUT: .x = imports.%Other.import_ref.f67
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: fn @__global_init() {
  619. // CHECK:STDOUT: !entry:
  620. // CHECK:STDOUT: %.loc7_25.1: %empty_tuple.type = tuple_literal ()
  621. // CHECK:STDOUT: %.loc7_26.1: %struct_type.x = struct_literal (%.loc7_25.1)
  622. // CHECK:STDOUT: %.loc7_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  623. // CHECK:STDOUT: %.loc7_25.2: init %empty_tuple.type = tuple_init () to %.loc7_26.2 [concrete = constants.%empty_tuple]
  624. // CHECK:STDOUT: %.loc7_26.3: init %empty_tuple.type = converted %.loc7_25.1, %.loc7_25.2 [concrete = constants.%empty_tuple]
  625. // CHECK:STDOUT: %.loc7_26.4: init %C = class_init (%.loc7_26.3), file.%c.var [concrete = constants.%C.val]
  626. // CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_26.1, %.loc7_26.4 [concrete = constants.%C.val]
  627. // CHECK:STDOUT: assign file.%c.var, %.loc7_1
  628. // CHECK:STDOUT: return
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT:
  631. // CHECK:STDOUT: --- use_export_name_indirect.carbon
  632. // CHECK:STDOUT:
  633. // CHECK:STDOUT: constants {
  634. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  635. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  636. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  637. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  638. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  639. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  640. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  641. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: imports {
  645. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  646. // CHECK:STDOUT: .C = %Other.C
  647. // CHECK:STDOUT: import Other//export_name_indirect
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name_indirect, C, loaded [concrete = constants.%C]
  650. // CHECK:STDOUT: %Other.import_ref.328: <witness> = import_ref Other//export_name_indirect, inst22 [indirect], loaded [concrete = constants.%complete_type]
  651. // CHECK:STDOUT: %Other.import_ref.db8 = import_ref Other//export_name_indirect, inst23 [indirect], unloaded
  652. // CHECK:STDOUT: %Other.import_ref.3ef = import_ref Other//export_name_indirect, inst24 [indirect], unloaded
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: file {
  656. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  657. // CHECK:STDOUT: .Other = imports.%Other
  658. // CHECK:STDOUT: .c = %c
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT: %Other.import = import Other
  661. // CHECK:STDOUT: name_binding_decl {
  662. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  663. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  666. // CHECK:STDOUT: %.loc6: type = splice_block %C.ref [concrete = constants.%C] {
  667. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  668. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: class @C [from "export_name_indirect.carbon"] {
  674. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.328
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: !members:
  677. // CHECK:STDOUT: .Self = imports.%Other.import_ref.db8
  678. // CHECK:STDOUT: .x = imports.%Other.import_ref.3ef
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: fn @__global_init() {
  682. // CHECK:STDOUT: !entry:
  683. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal ()
  684. // CHECK:STDOUT: %.loc6_26.1: %struct_type.x = struct_literal (%.loc6_25.1)
  685. // CHECK:STDOUT: %.loc6_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  686. // CHECK:STDOUT: %.loc6_25.2: init %empty_tuple.type = tuple_init () to %.loc6_26.2 [concrete = constants.%empty_tuple]
  687. // CHECK:STDOUT: %.loc6_26.3: init %empty_tuple.type = converted %.loc6_25.1, %.loc6_25.2 [concrete = constants.%empty_tuple]
  688. // CHECK:STDOUT: %.loc6_26.4: init %C = class_init (%.loc6_26.3), file.%c.var [concrete = constants.%C.val]
  689. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_26.1, %.loc6_26.4 [concrete = constants.%C.val]
  690. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  691. // CHECK:STDOUT: return
  692. // CHECK:STDOUT: }
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: --- use_export_all.carbon
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: constants {
  697. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  698. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  699. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  700. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  701. // CHECK:STDOUT: %pattern_type: type = pattern_type %C [concrete]
  702. // CHECK:STDOUT: %.172: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete]
  703. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  704. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [concrete]
  705. // CHECK:STDOUT: }
  706. // CHECK:STDOUT:
  707. // CHECK:STDOUT: imports {
  708. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  709. // CHECK:STDOUT: .C = %Other.C
  710. // CHECK:STDOUT: import Other//export_import
  711. // CHECK:STDOUT: import Other//export_name
  712. // CHECK:STDOUT: import Other//export_import_copy
  713. // CHECK:STDOUT: import Other//export_name_copy
  714. // CHECK:STDOUT: import Other//export_import_indirect
  715. // CHECK:STDOUT: import Other//export_name_indirect
  716. // CHECK:STDOUT: import Other//base
  717. // CHECK:STDOUT: }
  718. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name, C, loaded [concrete = constants.%C]
  719. // CHECK:STDOUT: %Other.import_ref.ad3: <witness> = import_ref Other//export_name, inst22 [indirect], loaded [concrete = constants.%complete_type]
  720. // CHECK:STDOUT: %Other.import_ref.6a9 = import_ref Other//export_name, inst23 [indirect], unloaded
  721. // CHECK:STDOUT: %Other.import_ref.f67 = import_ref Other//export_name, inst24 [indirect], unloaded
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: file {
  725. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  726. // CHECK:STDOUT: .Other = imports.%Other
  727. // CHECK:STDOUT: .c = %c
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT: %Other.import = import Other
  730. // CHECK:STDOUT: name_binding_decl {
  731. // CHECK:STDOUT: %c.patt: %pattern_type = binding_pattern c [concrete]
  732. // CHECK:STDOUT: %c.var_patt: %pattern_type = var_pattern %c.patt [concrete]
  733. // CHECK:STDOUT: }
  734. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt [concrete]
  735. // CHECK:STDOUT: %.loc11: type = splice_block %C.ref [concrete = constants.%C] {
  736. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  737. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  738. // CHECK:STDOUT: }
  739. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var [concrete = %c.var]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: class @C [from "export_name.carbon"] {
  743. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.ad3
  744. // CHECK:STDOUT:
  745. // CHECK:STDOUT: !members:
  746. // CHECK:STDOUT: .Self = imports.%Other.import_ref.6a9
  747. // CHECK:STDOUT: .x = imports.%Other.import_ref.f67
  748. // CHECK:STDOUT: }
  749. // CHECK:STDOUT:
  750. // CHECK:STDOUT: fn @__global_init() {
  751. // CHECK:STDOUT: !entry:
  752. // CHECK:STDOUT: %.loc11_25.1: %empty_tuple.type = tuple_literal ()
  753. // CHECK:STDOUT: %.loc11_26.1: %struct_type.x = struct_literal (%.loc11_25.1)
  754. // CHECK:STDOUT: %.loc11_26.2: ref %empty_tuple.type = class_element_access file.%c.var, element0 [concrete = constants.%.172]
  755. // CHECK:STDOUT: %.loc11_25.2: init %empty_tuple.type = tuple_init () to %.loc11_26.2 [concrete = constants.%empty_tuple]
  756. // CHECK:STDOUT: %.loc11_26.3: init %empty_tuple.type = converted %.loc11_25.1, %.loc11_25.2 [concrete = constants.%empty_tuple]
  757. // CHECK:STDOUT: %.loc11_26.4: init %C = class_init (%.loc11_26.3), file.%c.var [concrete = constants.%C.val]
  758. // CHECK:STDOUT: %.loc11_1: init %C = converted %.loc11_26.1, %.loc11_26.4 [concrete = constants.%C.val]
  759. // CHECK:STDOUT: assign file.%c.var, %.loc11_1
  760. // CHECK:STDOUT: return
  761. // CHECK:STDOUT: }
  762. // CHECK:STDOUT:
  763. // CHECK:STDOUT: --- unused_conflict_on_export_import.carbon
  764. // CHECK:STDOUT:
  765. // CHECK:STDOUT: imports {
  766. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  767. // CHECK:STDOUT: import Other//export_import
  768. // CHECK:STDOUT: import Other//conflict
  769. // CHECK:STDOUT: import Other//base
  770. // CHECK:STDOUT: }
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT:
  773. // CHECK:STDOUT: file {
  774. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  775. // CHECK:STDOUT: .Other = imports.%Other
  776. // CHECK:STDOUT: }
  777. // CHECK:STDOUT: %Other.import = import Other
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: --- unused_conflict_on_export_name.carbon
  781. // CHECK:STDOUT:
  782. // CHECK:STDOUT: imports {
  783. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  784. // CHECK:STDOUT: import Other//export_name
  785. // CHECK:STDOUT: import Other//conflict
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT:
  789. // CHECK:STDOUT: file {
  790. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  791. // CHECK:STDOUT: .Other = imports.%Other
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT: %Other.import = import Other
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: --- fail_conflict_on_export_import.carbon
  797. // CHECK:STDOUT:
  798. // CHECK:STDOUT: constants {
  799. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  800. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: imports {
  804. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  805. // CHECK:STDOUT: .C = %Other.C
  806. // CHECK:STDOUT: import Other//export_import
  807. // CHECK:STDOUT: import Other//conflict
  808. // CHECK:STDOUT: import Other//base
  809. // CHECK:STDOUT: }
  810. // CHECK:STDOUT: %Other.C: %C.type = import_ref Other//conflict, C, loaded [concrete = constants.%C]
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: file {
  814. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  815. // CHECK:STDOUT: .Other = imports.%Other
  816. // CHECK:STDOUT: .C = %C
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT: %Other.import = import Other
  819. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  820. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Other.C [concrete = constants.%C]
  821. // CHECK:STDOUT: %C: %C.type = bind_alias C, imports.%Other.C [concrete = constants.%C]
  822. // CHECK:STDOUT: }
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: fn @C [from "conflict.carbon"];
  825. // CHECK:STDOUT:
  826. // CHECK:STDOUT: --- fail_conflict_on_export_name.carbon
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: constants {
  829. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  830. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  831. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [concrete]
  832. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [concrete]
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: imports {
  836. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [concrete] {
  837. // CHECK:STDOUT: .C = %Other.C
  838. // CHECK:STDOUT: import Other//export_name
  839. // CHECK:STDOUT: import Other//conflict
  840. // CHECK:STDOUT: }
  841. // CHECK:STDOUT: %Other.C: type = import_ref Other//export_name, C, loaded [concrete = constants.%C]
  842. // CHECK:STDOUT: %Other.import_ref.ad3: <witness> = import_ref Other//export_name, inst22 [indirect], loaded [concrete = constants.%complete_type]
  843. // CHECK:STDOUT: %Other.import_ref.6a9 = import_ref Other//export_name, inst23 [indirect], unloaded
  844. // CHECK:STDOUT: %Other.import_ref.f67 = import_ref Other//export_name, inst24 [indirect], unloaded
  845. // CHECK:STDOUT: }
  846. // CHECK:STDOUT:
  847. // CHECK:STDOUT: file {
  848. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  849. // CHECK:STDOUT: .Other = imports.%Other
  850. // CHECK:STDOUT: .C = %C
  851. // CHECK:STDOUT: }
  852. // CHECK:STDOUT: %Other.import = import Other
  853. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [concrete = imports.%Other]
  854. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [concrete = constants.%C]
  855. // CHECK:STDOUT: %C: type = bind_alias C, imports.%Other.C [concrete = constants.%C]
  856. // CHECK:STDOUT: }
  857. // CHECK:STDOUT:
  858. // CHECK:STDOUT: class @C [from "export_name.carbon"] {
  859. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.ad3
  860. // CHECK:STDOUT:
  861. // CHECK:STDOUT: !members:
  862. // CHECK:STDOUT: .Self = imports.%Other.import_ref.6a9
  863. // CHECK:STDOUT: .x = imports.%Other.import_ref.f67
  864. // CHECK:STDOUT: }
  865. // CHECK:STDOUT: