cross_package_export.carbon 35 KB

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