export_name.carbon 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/packages/no_prelude/export_name.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/packages/no_prelude/export_name.carbon
  10. // ============================================================================
  11. // Setup files
  12. // ============================================================================
  13. // --- base.carbon
  14. library "[[@TEST_NAME]]";
  15. class C {
  16. var x: ();
  17. };
  18. namespace NS;
  19. class NS.NSC {
  20. var y: ();
  21. };
  22. // --- export.carbon
  23. library "[[@TEST_NAME]]";
  24. import library "base";
  25. export C;
  26. export NS.NSC;
  27. // --- not_reexporting.carbon
  28. library "[[@TEST_NAME]]";
  29. import library "export";
  30. // --- export_export.carbon
  31. library "[[@TEST_NAME]]";
  32. import library "export";
  33. export C;
  34. export NS.NSC;
  35. // --- export_in_impl.carbon
  36. // This is just providing an API for the implicit import.
  37. library "[[@TEST_NAME]]";
  38. // ============================================================================
  39. // Test files
  40. // ============================================================================
  41. // --- use_export.carbon
  42. library "[[@TEST_NAME]]";
  43. import library "export";
  44. var c: C = {.x = ()};
  45. var nsc: NS.NSC = {.y = ()};
  46. // --- export_export.impl.carbon
  47. impl library "[[@TEST_NAME]]";
  48. var c: C = {.x = ()};
  49. var nsc: NS.NSC = {.y = ()};
  50. // --- use_export_export.carbon
  51. library "[[@TEST_NAME]]";
  52. import library "export_export";
  53. var c: C = {.x = ()};
  54. var nsc: NS.NSC = {.y = ()};
  55. // --- fail_export_ns.carbon
  56. library "[[@TEST_NAME]]";
  57. import library "base";
  58. // CHECK:STDERR: fail_export_ns.carbon:[[@LINE+8]]:1: error: only imported entities are valid for `export` [ExportNotImportedEntity]
  59. // CHECK:STDERR: export NS;
  60. // CHECK:STDERR: ^~~~~~~~~~
  61. // CHECK:STDERR: fail_export_ns.carbon:[[@LINE-5]]:1: in import [InImport]
  62. // CHECK:STDERR: base.carbon:8:1: note: name is declared here [ExportNotImportedEntitySource]
  63. // CHECK:STDERR: namespace NS;
  64. // CHECK:STDERR: ^~~~~~~~~~~~~
  65. // CHECK:STDERR:
  66. export NS;
  67. // --- fail_export_decl.carbon
  68. library "[[@TEST_NAME]]";
  69. class Local {}
  70. // CHECK:STDERR: fail_export_decl.carbon:[[@LINE+7]]:1: error: only imported entities are valid for `export` [ExportNotImportedEntity]
  71. // CHECK:STDERR: export Local;
  72. // CHECK:STDERR: ^~~~~~~~~~~~~
  73. // CHECK:STDERR: fail_export_decl.carbon:[[@LINE-5]]:1: note: name is declared here [ExportNotImportedEntitySource]
  74. // CHECK:STDERR: class Local {}
  75. // CHECK:STDERR: ^~~~~~~~~~~~~
  76. // CHECK:STDERR:
  77. export Local;
  78. // --- fail_export_member.carbon
  79. library "[[@TEST_NAME]]";
  80. import library "base";
  81. // CHECK:STDERR: fail_export_member.carbon:[[@LINE+8]]:8: error: name qualifiers are only allowed for entities that provide a scope [QualifiedNameInNonScope]
  82. // CHECK:STDERR: export C.x;
  83. // CHECK:STDERR: ^
  84. // CHECK:STDERR: fail_export_member.carbon:[[@LINE-5]]:1: in import [InImport]
  85. // CHECK:STDERR: base.carbon:4:1: note: referenced non-scope entity declared here [QualifiedNameNonScopeEntity]
  86. // CHECK:STDERR: class C {
  87. // CHECK:STDERR: ^~~~~~~~~
  88. // CHECK:STDERR:
  89. export C.x;
  90. // --- import_both.carbon
  91. library "[[@TEST_NAME]]";
  92. import library "base";
  93. import library "export";
  94. var c: C = {.x = ()};
  95. var nsc: NS.NSC = {.y = ()};
  96. // --- import_both_reversed.carbon
  97. library "[[@TEST_NAME]]";
  98. import library "export";
  99. import library "base";
  100. var c: C = {.x = ()};
  101. var nsc: NS.NSC = {.y = ()};
  102. // --- fail_use_not_reexporting.carbon
  103. library "[[@TEST_NAME]]";
  104. import library "not_reexporting";
  105. // CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+4]]:15: error: name `C` not found [NameNotFound]
  106. // CHECK:STDERR: alias Local = C;
  107. // CHECK:STDERR: ^
  108. // CHECK:STDERR:
  109. alias Local = C;
  110. // CHECK:STDERR: fail_use_not_reexporting.carbon:[[@LINE+4]]:17: error: name `NS` not found [NameNotFound]
  111. // CHECK:STDERR: alias NSLocal = NS.NSC;
  112. // CHECK:STDERR: ^~
  113. // CHECK:STDERR:
  114. alias NSLocal = NS.NSC;
  115. // --- repeat_export.carbon
  116. library "[[@TEST_NAME]]";
  117. import library "base";
  118. export C;
  119. // CHECK:STDERR: repeat_export.carbon:[[@LINE+7]]:1: warning: `export` matches previous `export` [ExportRedundant]
  120. // CHECK:STDERR: export C;
  121. // CHECK:STDERR: ^~~~~~~~~
  122. // CHECK:STDERR: repeat_export.carbon:[[@LINE-4]]:1: note: previous `export` here [ExportPrevious]
  123. // CHECK:STDERR: export C;
  124. // CHECK:STDERR: ^~~~~~~~~
  125. // CHECK:STDERR:
  126. export C;
  127. // --- use_repeat_export.carbon
  128. library "[[@TEST_NAME]]";
  129. import library "repeat_export";
  130. var c: C = {.x = ()};
  131. // --- fail_modifiers.carbon
  132. library "[[@TEST_NAME]]";
  133. import library "base";
  134. // CHECK:STDERR: fail_modifiers.carbon:[[@LINE+4]]:1: error: `private` not allowed on `export` declaration [ModifierNotAllowedOnDeclaration]
  135. // CHECK:STDERR: private export C;
  136. // CHECK:STDERR: ^~~~~~~
  137. // CHECK:STDERR:
  138. private export C;
  139. // CHECK:STDOUT: --- base.carbon
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: constants {
  142. // CHECK:STDOUT: %C: type = class_type @C [template]
  143. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  144. // CHECK:STDOUT: %C.elem: type = unbound_element_type %C, %empty_tuple.type [template]
  145. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  146. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  147. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  148. // CHECK:STDOUT: %NSC.elem: type = unbound_element_type %NSC, %empty_tuple.type [template]
  149. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  150. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: file {
  154. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  155. // CHECK:STDOUT: .C = %C.decl
  156. // CHECK:STDOUT: .NS = %NS
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  159. // CHECK:STDOUT: %NS: <namespace> = namespace [template] {
  160. // CHECK:STDOUT: .NSC = %NSC.decl
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT: %NSC.decl: type = class_decl @NSC [template = constants.%NSC] {} {}
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT:
  165. // CHECK:STDOUT: class @C {
  166. // CHECK:STDOUT: %.loc5_8: %C.elem = field_decl x, element0 [template]
  167. // CHECK:STDOUT: name_binding_decl {
  168. // CHECK:STDOUT: %.loc5_3: %C.elem = var_pattern %.loc5_8
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: %.var: ref %C.elem = var <none>
  171. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [template = constants.%complete_type.9be]
  172. // CHECK:STDOUT: complete_type_witness = %complete_type
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: !members:
  175. // CHECK:STDOUT: .Self = constants.%C
  176. // CHECK:STDOUT: .x = %.loc5_8
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: class @NSC {
  180. // CHECK:STDOUT: %.loc10_8: %NSC.elem = field_decl y, element0 [template]
  181. // CHECK:STDOUT: name_binding_decl {
  182. // CHECK:STDOUT: %.loc10_3: %NSC.elem = var_pattern %.loc10_8
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: %.var: ref %NSC.elem = var <none>
  185. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.y [template = constants.%complete_type.9f4]
  186. // CHECK:STDOUT: complete_type_witness = %complete_type
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: !members:
  189. // CHECK:STDOUT: .Self = constants.%NSC
  190. // CHECK:STDOUT: .y = %.loc10_8
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: --- export.carbon
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: constants {
  196. // CHECK:STDOUT: %C: type = class_type @C [template]
  197. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  198. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  199. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  200. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  201. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  202. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: imports {
  206. // CHECK:STDOUT: %Main.C: type = import_ref Main//base, C, loaded [template = constants.%C]
  207. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  208. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  209. // CHECK:STDOUT: .NSC = file.%NSC
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//base, NSC, loaded [template = constants.%NSC]
  212. // CHECK:STDOUT: %Main.import_ref.56d: <witness> = import_ref Main//base, loc6_1, loaded [template = constants.%complete_type.9be]
  213. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//base, inst14 [no loc], unloaded
  214. // CHECK:STDOUT: %Main.import_ref.276 = import_ref Main//base, loc5_8, unloaded
  215. // CHECK:STDOUT: %Main.import_ref.5ab: <witness> = import_ref Main//base, loc11_1, loaded [template = constants.%complete_type.9f4]
  216. // CHECK:STDOUT: %Main.import_ref.31c = import_ref Main//base, inst28 [no loc], unloaded
  217. // CHECK:STDOUT: %Main.import_ref.be6 = import_ref Main//base, loc10_8, unloaded
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: file {
  221. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  222. // CHECK:STDOUT: .C = %C
  223. // CHECK:STDOUT: .NS = imports.%NS
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT: %default.import = import <none>
  226. // CHECK:STDOUT: %C: type = export C, imports.%Main.C [template = constants.%C]
  227. // CHECK:STDOUT: %NSC: type = export NSC, imports.%Main.NSC [template = constants.%NSC]
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: class @C [from "base.carbon"] {
  231. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.56d
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: !members:
  234. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  235. // CHECK:STDOUT: .x = imports.%Main.import_ref.276
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: class @NSC [from "base.carbon"] {
  239. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.5ab
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: !members:
  242. // CHECK:STDOUT: .Self = imports.%Main.import_ref.31c
  243. // CHECK:STDOUT: .y = imports.%Main.import_ref.be6
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: --- not_reexporting.carbon
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: imports {
  249. // CHECK:STDOUT: %Main.C = import_ref Main//export, C, unloaded
  250. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export, NS, loaded
  251. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  252. // CHECK:STDOUT: .NSC = %Main.NSC
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: file {
  257. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  258. // CHECK:STDOUT: .C = imports.%Main.C
  259. // CHECK:STDOUT: .NS = imports.%NS
  260. // CHECK:STDOUT: }
  261. // CHECK:STDOUT: %default.import = import <none>
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: --- export_export.carbon
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: constants {
  267. // CHECK:STDOUT: %C: type = class_type @C [template]
  268. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  269. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  270. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  271. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  272. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  273. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: imports {
  277. // CHECK:STDOUT: %Main.C: type = import_ref Main//export, C, loaded [template = constants.%C]
  278. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export, NS, loaded
  279. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  280. // CHECK:STDOUT: .NSC = file.%NSC
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//export, NSC, loaded [template = constants.%NSC]
  283. // CHECK:STDOUT: %Main.import_ref.ad3: <witness> = import_ref Main//export, inst23 [indirect], loaded [template = constants.%complete_type.9be]
  284. // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//export, inst24 [indirect], unloaded
  285. // CHECK:STDOUT: %Main.import_ref.f67 = import_ref Main//export, inst25 [indirect], unloaded
  286. // CHECK:STDOUT: %Main.import_ref.63c: <witness> = import_ref Main//export, inst31 [indirect], loaded [template = constants.%complete_type.9f4]
  287. // CHECK:STDOUT: %Main.import_ref.f0b = import_ref Main//export, inst32 [indirect], unloaded
  288. // CHECK:STDOUT: %Main.import_ref.ebc = import_ref Main//export, inst33 [indirect], unloaded
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: file {
  292. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  293. // CHECK:STDOUT: .C = %C
  294. // CHECK:STDOUT: .NS = imports.%NS
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT: %default.import = import <none>
  297. // CHECK:STDOUT: %C: type = export C, imports.%Main.C [template = constants.%C]
  298. // CHECK:STDOUT: %NSC: type = export NSC, imports.%Main.NSC [template = constants.%NSC]
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: class @C [from "export.carbon"] {
  302. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.ad3
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: !members:
  305. // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
  306. // CHECK:STDOUT: .x = imports.%Main.import_ref.f67
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: class @NSC [from "export.carbon"] {
  310. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.63c
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: !members:
  313. // CHECK:STDOUT: .Self = imports.%Main.import_ref.f0b
  314. // CHECK:STDOUT: .y = imports.%Main.import_ref.ebc
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: --- export_in_impl.carbon
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: file {
  320. // CHECK:STDOUT: package: <namespace> = namespace [template] {}
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: --- use_export.carbon
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: constants {
  326. // CHECK:STDOUT: %C: type = class_type @C [template]
  327. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  328. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  329. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  330. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  331. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  332. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  333. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  334. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  335. // CHECK:STDOUT: %NSC.val: %NSC = struct_value (%empty_tuple) [template]
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT:
  338. // CHECK:STDOUT: imports {
  339. // CHECK:STDOUT: %Main.C: type = import_ref Main//export, C, loaded [template = constants.%C]
  340. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export, NS, loaded
  341. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  342. // CHECK:STDOUT: .NSC = %Main.NSC
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//export, NSC, loaded [template = constants.%NSC]
  345. // CHECK:STDOUT: %Main.import_ref.ad3: <witness> = import_ref Main//export, inst23 [indirect], loaded [template = constants.%complete_type.9be]
  346. // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//export, inst24 [indirect], unloaded
  347. // CHECK:STDOUT: %Main.import_ref.f67 = import_ref Main//export, inst25 [indirect], unloaded
  348. // CHECK:STDOUT: %Main.import_ref.63c: <witness> = import_ref Main//export, inst31 [indirect], loaded [template = constants.%complete_type.9f4]
  349. // CHECK:STDOUT: %Main.import_ref.f0b = import_ref Main//export, inst32 [indirect], unloaded
  350. // CHECK:STDOUT: %Main.import_ref.ebc = import_ref Main//export, inst33 [indirect], unloaded
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: file {
  354. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  355. // CHECK:STDOUT: .C = imports.%Main.C
  356. // CHECK:STDOUT: .NS = imports.%NS
  357. // CHECK:STDOUT: .c = %c
  358. // CHECK:STDOUT: .nsc = %nsc
  359. // CHECK:STDOUT: }
  360. // CHECK:STDOUT: %default.import = import <none>
  361. // CHECK:STDOUT: name_binding_decl {
  362. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  363. // CHECK:STDOUT: %.loc6: %C = var_pattern %c.patt
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT: %c.var: ref %C = var c
  366. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  367. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  368. // CHECK:STDOUT: name_binding_decl {
  369. // CHECK:STDOUT: %nsc.patt: %NSC = binding_pattern nsc
  370. // CHECK:STDOUT: %.loc7_1: %NSC = var_pattern %nsc.patt
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT: %nsc.var: ref %NSC = var nsc
  373. // CHECK:STDOUT: %.loc7_12: type = splice_block %NSC.ref [template = constants.%NSC] {
  374. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  375. // CHECK:STDOUT: %NSC.ref: type = name_ref NSC, imports.%Main.NSC [template = constants.%NSC]
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT: %nsc: ref %NSC = bind_name nsc, %nsc.var
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: class @C [from "export.carbon"] {
  381. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.ad3
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: !members:
  384. // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
  385. // CHECK:STDOUT: .x = imports.%Main.import_ref.f67
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: class @NSC [from "export.carbon"] {
  389. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.63c
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: !members:
  392. // CHECK:STDOUT: .Self = imports.%Main.import_ref.f0b
  393. // CHECK:STDOUT: .y = imports.%Main.import_ref.ebc
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: fn @__global_init() {
  397. // CHECK:STDOUT: !entry:
  398. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  399. // CHECK:STDOUT: %.loc6_20.1: %struct_type.x = struct_literal (%.loc6_19.1)
  400. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  401. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  402. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  403. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%C.val]
  404. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%C.val]
  405. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  406. // CHECK:STDOUT: %.loc7_26.1: %empty_tuple.type = tuple_literal ()
  407. // CHECK:STDOUT: %.loc7_27.1: %struct_type.y = struct_literal (%.loc7_26.1)
  408. // CHECK:STDOUT: %.loc7_27.2: ref %empty_tuple.type = class_element_access file.%nsc.var, element0
  409. // CHECK:STDOUT: %.loc7_26.2: init %empty_tuple.type = tuple_init () to %.loc7_27.2 [template = constants.%empty_tuple]
  410. // CHECK:STDOUT: %.loc7_27.3: init %empty_tuple.type = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%empty_tuple]
  411. // CHECK:STDOUT: %.loc7_27.4: init %NSC = class_init (%.loc7_27.3), file.%nsc.var [template = constants.%NSC.val]
  412. // CHECK:STDOUT: %.loc7_1: init %NSC = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%NSC.val]
  413. // CHECK:STDOUT: assign file.%nsc.var, %.loc7_1
  414. // CHECK:STDOUT: return
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: --- export_export.impl.carbon
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: constants {
  420. // CHECK:STDOUT: %C: type = class_type @C [template]
  421. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  422. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  423. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  424. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  425. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  426. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  427. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  428. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  429. // CHECK:STDOUT: %NSC.val: %NSC = struct_value (%empty_tuple) [template]
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: imports {
  433. // CHECK:STDOUT: %Main.C: type = import_ref Main//export_export, C, loaded [template = constants.%C]
  434. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export_export, NS, loaded
  435. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  436. // CHECK:STDOUT: .NSC = %Main.NSC
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//export_export, NSC, loaded [template = constants.%NSC]
  439. // CHECK:STDOUT: %Main.import_ref.328: <witness> = import_ref Main//export_export, inst23 [indirect], loaded [template = constants.%complete_type.9be]
  440. // CHECK:STDOUT: %Main.import_ref.db8 = import_ref Main//export_export, inst24 [indirect], unloaded
  441. // CHECK:STDOUT: %Main.import_ref.3ef = import_ref Main//export_export, inst25 [indirect], unloaded
  442. // CHECK:STDOUT: %Main.import_ref.c12: <witness> = import_ref Main//export_export, inst31 [indirect], loaded [template = constants.%complete_type.9f4]
  443. // CHECK:STDOUT: %Main.import_ref.1cb = import_ref Main//export_export, inst32 [indirect], unloaded
  444. // CHECK:STDOUT: %Main.import_ref.b18 = import_ref Main//export_export, inst33 [indirect], unloaded
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: file {
  448. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  449. // CHECK:STDOUT: .C = imports.%Main.C
  450. // CHECK:STDOUT: .NS = imports.%NS
  451. // CHECK:STDOUT: .c = %c
  452. // CHECK:STDOUT: .nsc = %nsc
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT: %default.import.loc2_6.1 = import <none>
  455. // CHECK:STDOUT: %default.import.loc2_6.2 = import <none>
  456. // CHECK:STDOUT: name_binding_decl {
  457. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  458. // CHECK:STDOUT: %.loc4: %C = var_pattern %c.patt
  459. // CHECK:STDOUT: }
  460. // CHECK:STDOUT: %c.var: ref %C = var c
  461. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  462. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  463. // CHECK:STDOUT: name_binding_decl {
  464. // CHECK:STDOUT: %nsc.patt: %NSC = binding_pattern nsc
  465. // CHECK:STDOUT: %.loc5_1: %NSC = var_pattern %nsc.patt
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT: %nsc.var: ref %NSC = var nsc
  468. // CHECK:STDOUT: %.loc5_12: type = splice_block %NSC.ref [template = constants.%NSC] {
  469. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  470. // CHECK:STDOUT: %NSC.ref: type = name_ref NSC, imports.%Main.NSC [template = constants.%NSC]
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT: %nsc: ref %NSC = bind_name nsc, %nsc.var
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: class @C [from "export_export.carbon"] {
  476. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.328
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: !members:
  479. // CHECK:STDOUT: .Self = imports.%Main.import_ref.db8
  480. // CHECK:STDOUT: .x = imports.%Main.import_ref.3ef
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: class @NSC [from "export_export.carbon"] {
  484. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.c12
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: !members:
  487. // CHECK:STDOUT: .Self = imports.%Main.import_ref.1cb
  488. // CHECK:STDOUT: .y = imports.%Main.import_ref.b18
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: fn @__global_init() {
  492. // CHECK:STDOUT: !entry:
  493. // CHECK:STDOUT: %.loc4_19.1: %empty_tuple.type = tuple_literal ()
  494. // CHECK:STDOUT: %.loc4_20.1: %struct_type.x = struct_literal (%.loc4_19.1)
  495. // CHECK:STDOUT: %.loc4_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  496. // CHECK:STDOUT: %.loc4_19.2: init %empty_tuple.type = tuple_init () to %.loc4_20.2 [template = constants.%empty_tuple]
  497. // CHECK:STDOUT: %.loc4_20.3: init %empty_tuple.type = converted %.loc4_19.1, %.loc4_19.2 [template = constants.%empty_tuple]
  498. // CHECK:STDOUT: %.loc4_20.4: init %C = class_init (%.loc4_20.3), file.%c.var [template = constants.%C.val]
  499. // CHECK:STDOUT: %.loc4_1: init %C = converted %.loc4_20.1, %.loc4_20.4 [template = constants.%C.val]
  500. // CHECK:STDOUT: assign file.%c.var, %.loc4_1
  501. // CHECK:STDOUT: %.loc5_26.1: %empty_tuple.type = tuple_literal ()
  502. // CHECK:STDOUT: %.loc5_27.1: %struct_type.y = struct_literal (%.loc5_26.1)
  503. // CHECK:STDOUT: %.loc5_27.2: ref %empty_tuple.type = class_element_access file.%nsc.var, element0
  504. // CHECK:STDOUT: %.loc5_26.2: init %empty_tuple.type = tuple_init () to %.loc5_27.2 [template = constants.%empty_tuple]
  505. // CHECK:STDOUT: %.loc5_27.3: init %empty_tuple.type = converted %.loc5_26.1, %.loc5_26.2 [template = constants.%empty_tuple]
  506. // CHECK:STDOUT: %.loc5_27.4: init %NSC = class_init (%.loc5_27.3), file.%nsc.var [template = constants.%NSC.val]
  507. // CHECK:STDOUT: %.loc5_1: init %NSC = converted %.loc5_27.1, %.loc5_27.4 [template = constants.%NSC.val]
  508. // CHECK:STDOUT: assign file.%nsc.var, %.loc5_1
  509. // CHECK:STDOUT: return
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: --- use_export_export.carbon
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: constants {
  515. // CHECK:STDOUT: %C: type = class_type @C [template]
  516. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  517. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  518. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  519. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  520. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  521. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  522. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  523. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  524. // CHECK:STDOUT: %NSC.val: %NSC = struct_value (%empty_tuple) [template]
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: imports {
  528. // CHECK:STDOUT: %Main.C: type = import_ref Main//export_export, C, loaded [template = constants.%C]
  529. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export_export, NS, loaded
  530. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  531. // CHECK:STDOUT: .NSC = %Main.NSC
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//export_export, NSC, loaded [template = constants.%NSC]
  534. // CHECK:STDOUT: %Main.import_ref.328: <witness> = import_ref Main//export_export, inst23 [indirect], loaded [template = constants.%complete_type.9be]
  535. // CHECK:STDOUT: %Main.import_ref.db8 = import_ref Main//export_export, inst24 [indirect], unloaded
  536. // CHECK:STDOUT: %Main.import_ref.3ef = import_ref Main//export_export, inst25 [indirect], unloaded
  537. // CHECK:STDOUT: %Main.import_ref.c12: <witness> = import_ref Main//export_export, inst31 [indirect], loaded [template = constants.%complete_type.9f4]
  538. // CHECK:STDOUT: %Main.import_ref.1cb = import_ref Main//export_export, inst32 [indirect], unloaded
  539. // CHECK:STDOUT: %Main.import_ref.b18 = import_ref Main//export_export, inst33 [indirect], unloaded
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: file {
  543. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  544. // CHECK:STDOUT: .C = imports.%Main.C
  545. // CHECK:STDOUT: .NS = imports.%NS
  546. // CHECK:STDOUT: .c = %c
  547. // CHECK:STDOUT: .nsc = %nsc
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT: %default.import = import <none>
  550. // CHECK:STDOUT: name_binding_decl {
  551. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  552. // CHECK:STDOUT: %.loc6: %C = var_pattern %c.patt
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT: %c.var: ref %C = var c
  555. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  556. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  557. // CHECK:STDOUT: name_binding_decl {
  558. // CHECK:STDOUT: %nsc.patt: %NSC = binding_pattern nsc
  559. // CHECK:STDOUT: %.loc7_1: %NSC = var_pattern %nsc.patt
  560. // CHECK:STDOUT: }
  561. // CHECK:STDOUT: %nsc.var: ref %NSC = var nsc
  562. // CHECK:STDOUT: %.loc7_12: type = splice_block %NSC.ref [template = constants.%NSC] {
  563. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  564. // CHECK:STDOUT: %NSC.ref: type = name_ref NSC, imports.%Main.NSC [template = constants.%NSC]
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT: %nsc: ref %NSC = bind_name nsc, %nsc.var
  567. // CHECK:STDOUT: }
  568. // CHECK:STDOUT:
  569. // CHECK:STDOUT: class @C [from "export_export.carbon"] {
  570. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.328
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: !members:
  573. // CHECK:STDOUT: .Self = imports.%Main.import_ref.db8
  574. // CHECK:STDOUT: .x = imports.%Main.import_ref.3ef
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: class @NSC [from "export_export.carbon"] {
  578. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.c12
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: !members:
  581. // CHECK:STDOUT: .Self = imports.%Main.import_ref.1cb
  582. // CHECK:STDOUT: .y = imports.%Main.import_ref.b18
  583. // CHECK:STDOUT: }
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: fn @__global_init() {
  586. // CHECK:STDOUT: !entry:
  587. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  588. // CHECK:STDOUT: %.loc6_20.1: %struct_type.x = struct_literal (%.loc6_19.1)
  589. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  590. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  591. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  592. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%C.val]
  593. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%C.val]
  594. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  595. // CHECK:STDOUT: %.loc7_26.1: %empty_tuple.type = tuple_literal ()
  596. // CHECK:STDOUT: %.loc7_27.1: %struct_type.y = struct_literal (%.loc7_26.1)
  597. // CHECK:STDOUT: %.loc7_27.2: ref %empty_tuple.type = class_element_access file.%nsc.var, element0
  598. // CHECK:STDOUT: %.loc7_26.2: init %empty_tuple.type = tuple_init () to %.loc7_27.2 [template = constants.%empty_tuple]
  599. // CHECK:STDOUT: %.loc7_27.3: init %empty_tuple.type = converted %.loc7_26.1, %.loc7_26.2 [template = constants.%empty_tuple]
  600. // CHECK:STDOUT: %.loc7_27.4: init %NSC = class_init (%.loc7_27.3), file.%nsc.var [template = constants.%NSC.val]
  601. // CHECK:STDOUT: %.loc7_1: init %NSC = converted %.loc7_27.1, %.loc7_27.4 [template = constants.%NSC.val]
  602. // CHECK:STDOUT: assign file.%nsc.var, %.loc7_1
  603. // CHECK:STDOUT: return
  604. // CHECK:STDOUT: }
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: --- fail_export_ns.carbon
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: imports {
  609. // CHECK:STDOUT: %Main.C = import_ref Main//base, C, unloaded
  610. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  611. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  612. // CHECK:STDOUT: .NSC = %Main.NSC
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: file {
  617. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  618. // CHECK:STDOUT: .C = imports.%Main.C
  619. // CHECK:STDOUT: .NS = imports.%NS
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT: %default.import = import <none>
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: --- fail_export_decl.carbon
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: constants {
  627. // CHECK:STDOUT: %Local: type = class_type @Local [template]
  628. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  629. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: file {
  633. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  634. // CHECK:STDOUT: .Local = %Local.decl
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT: %Local.decl: type = class_decl @Local [template = constants.%Local] {} {}
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: class @Local {
  640. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  641. // CHECK:STDOUT: complete_type_witness = %complete_type
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: !members:
  644. // CHECK:STDOUT: .Self = constants.%Local
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: --- fail_export_member.carbon
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: constants {
  650. // CHECK:STDOUT: %C: type = class_type @C [template]
  651. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  652. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  653. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [template]
  654. // CHECK:STDOUT: }
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: imports {
  657. // CHECK:STDOUT: %Main.C: type = import_ref Main//base, C, loaded [template = constants.%C]
  658. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  659. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  660. // CHECK:STDOUT: .NSC = %Main.NSC
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT: %Main.import_ref.56d: <witness> = import_ref Main//base, loc6_1, loaded [template = constants.%complete_type]
  663. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//base, inst14 [no loc], unloaded
  664. // CHECK:STDOUT: %Main.import_ref.276 = import_ref Main//base, loc5_8, unloaded
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: file {
  668. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  669. // CHECK:STDOUT: .C = imports.%Main.C
  670. // CHECK:STDOUT: .NS = imports.%NS
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT: %default.import = import <none>
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: class @C [from "base.carbon"] {
  676. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.56d
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: !members:
  679. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  680. // CHECK:STDOUT: .x = imports.%Main.import_ref.276
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: --- import_both.carbon
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: constants {
  686. // CHECK:STDOUT: %C: type = class_type @C [template]
  687. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  688. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  689. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  690. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  691. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  692. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  693. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  694. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  695. // CHECK:STDOUT: %NSC.val: %NSC = struct_value (%empty_tuple) [template]
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: imports {
  699. // CHECK:STDOUT: %Main.C: type = import_ref Main//base, C, loaded [template = constants.%C]
  700. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  701. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  702. // CHECK:STDOUT: .NSC = %Main.NSC
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//base, NSC, loaded [template = constants.%NSC]
  705. // CHECK:STDOUT: %Main.import_ref.56d: <witness> = import_ref Main//base, loc6_1, loaded [template = constants.%complete_type.9be]
  706. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//base, inst14 [no loc], unloaded
  707. // CHECK:STDOUT: %Main.import_ref.276 = import_ref Main//base, loc5_8, unloaded
  708. // CHECK:STDOUT: %Main.import_ref.5ab: <witness> = import_ref Main//base, loc11_1, loaded [template = constants.%complete_type.9f4]
  709. // CHECK:STDOUT: %Main.import_ref.31c = import_ref Main//base, inst28 [no loc], unloaded
  710. // CHECK:STDOUT: %Main.import_ref.be6 = import_ref Main//base, loc10_8, unloaded
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT:
  713. // CHECK:STDOUT: file {
  714. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  715. // CHECK:STDOUT: .C = imports.%Main.C
  716. // CHECK:STDOUT: .NS = imports.%NS
  717. // CHECK:STDOUT: .c = %c
  718. // CHECK:STDOUT: .nsc = %nsc
  719. // CHECK:STDOUT: }
  720. // CHECK:STDOUT: %default.import = import <none>
  721. // CHECK:STDOUT: name_binding_decl {
  722. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  723. // CHECK:STDOUT: %.loc7: %C = var_pattern %c.patt
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT: %c.var: ref %C = var c
  726. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  727. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  728. // CHECK:STDOUT: name_binding_decl {
  729. // CHECK:STDOUT: %nsc.patt: %NSC = binding_pattern nsc
  730. // CHECK:STDOUT: %.loc8_1: %NSC = var_pattern %nsc.patt
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT: %nsc.var: ref %NSC = var nsc
  733. // CHECK:STDOUT: %.loc8_12: type = splice_block %NSC.ref [template = constants.%NSC] {
  734. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  735. // CHECK:STDOUT: %NSC.ref: type = name_ref NSC, imports.%Main.NSC [template = constants.%NSC]
  736. // CHECK:STDOUT: }
  737. // CHECK:STDOUT: %nsc: ref %NSC = bind_name nsc, %nsc.var
  738. // CHECK:STDOUT: }
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: class @C [from "base.carbon"] {
  741. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.56d
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: !members:
  744. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  745. // CHECK:STDOUT: .x = imports.%Main.import_ref.276
  746. // CHECK:STDOUT: }
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: class @NSC [from "base.carbon"] {
  749. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.5ab
  750. // CHECK:STDOUT:
  751. // CHECK:STDOUT: !members:
  752. // CHECK:STDOUT: .Self = imports.%Main.import_ref.31c
  753. // CHECK:STDOUT: .y = imports.%Main.import_ref.be6
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: fn @__global_init() {
  757. // CHECK:STDOUT: !entry:
  758. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  759. // CHECK:STDOUT: %.loc7_20.1: %struct_type.x = struct_literal (%.loc7_19.1)
  760. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  761. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  762. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  763. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%C.val]
  764. // CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%C.val]
  765. // CHECK:STDOUT: assign file.%c.var, %.loc7_1
  766. // CHECK:STDOUT: %.loc8_26.1: %empty_tuple.type = tuple_literal ()
  767. // CHECK:STDOUT: %.loc8_27.1: %struct_type.y = struct_literal (%.loc8_26.1)
  768. // CHECK:STDOUT: %.loc8_27.2: ref %empty_tuple.type = class_element_access file.%nsc.var, element0
  769. // CHECK:STDOUT: %.loc8_26.2: init %empty_tuple.type = tuple_init () to %.loc8_27.2 [template = constants.%empty_tuple]
  770. // CHECK:STDOUT: %.loc8_27.3: init %empty_tuple.type = converted %.loc8_26.1, %.loc8_26.2 [template = constants.%empty_tuple]
  771. // CHECK:STDOUT: %.loc8_27.4: init %NSC = class_init (%.loc8_27.3), file.%nsc.var [template = constants.%NSC.val]
  772. // CHECK:STDOUT: %.loc8_1: init %NSC = converted %.loc8_27.1, %.loc8_27.4 [template = constants.%NSC.val]
  773. // CHECK:STDOUT: assign file.%nsc.var, %.loc8_1
  774. // CHECK:STDOUT: return
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT:
  777. // CHECK:STDOUT: --- import_both_reversed.carbon
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: constants {
  780. // CHECK:STDOUT: %C: type = class_type @C [template]
  781. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  782. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  783. // CHECK:STDOUT: %complete_type.9be: <witness> = complete_type_witness %struct_type.x [template]
  784. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  785. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  786. // CHECK:STDOUT: %NSC: type = class_type @NSC [template]
  787. // CHECK:STDOUT: %struct_type.y: type = struct_type {.y: %empty_tuple.type} [template]
  788. // CHECK:STDOUT: %complete_type.9f4: <witness> = complete_type_witness %struct_type.y [template]
  789. // CHECK:STDOUT: %NSC.val: %NSC = struct_value (%empty_tuple) [template]
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: imports {
  793. // CHECK:STDOUT: %Main.C: type = import_ref Main//export, C, loaded [template = constants.%C]
  794. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//export, NS, loaded
  795. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  796. // CHECK:STDOUT: .NSC = %Main.NSC
  797. // CHECK:STDOUT: }
  798. // CHECK:STDOUT: %Main.NSC: type = import_ref Main//export, NSC, loaded [template = constants.%NSC]
  799. // CHECK:STDOUT: %Main.import_ref.ad3: <witness> = import_ref Main//export, inst23 [indirect], loaded [template = constants.%complete_type.9be]
  800. // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//export, inst24 [indirect], unloaded
  801. // CHECK:STDOUT: %Main.import_ref.f67 = import_ref Main//export, inst25 [indirect], unloaded
  802. // CHECK:STDOUT: %Main.import_ref.63c: <witness> = import_ref Main//export, inst31 [indirect], loaded [template = constants.%complete_type.9f4]
  803. // CHECK:STDOUT: %Main.import_ref.f0b = import_ref Main//export, inst32 [indirect], unloaded
  804. // CHECK:STDOUT: %Main.import_ref.ebc = import_ref Main//export, inst33 [indirect], unloaded
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: file {
  808. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  809. // CHECK:STDOUT: .C = imports.%Main.C
  810. // CHECK:STDOUT: .NS = imports.%NS
  811. // CHECK:STDOUT: .c = %c
  812. // CHECK:STDOUT: .nsc = %nsc
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: %default.import = import <none>
  815. // CHECK:STDOUT: name_binding_decl {
  816. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  817. // CHECK:STDOUT: %.loc7: %C = var_pattern %c.patt
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT: %c.var: ref %C = var c
  820. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  821. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  822. // CHECK:STDOUT: name_binding_decl {
  823. // CHECK:STDOUT: %nsc.patt: %NSC = binding_pattern nsc
  824. // CHECK:STDOUT: %.loc8_1: %NSC = var_pattern %nsc.patt
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT: %nsc.var: ref %NSC = var nsc
  827. // CHECK:STDOUT: %.loc8_12: type = splice_block %NSC.ref [template = constants.%NSC] {
  828. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  829. // CHECK:STDOUT: %NSC.ref: type = name_ref NSC, imports.%Main.NSC [template = constants.%NSC]
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT: %nsc: ref %NSC = bind_name nsc, %nsc.var
  832. // CHECK:STDOUT: }
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: class @C [from "export.carbon"] {
  835. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.ad3
  836. // CHECK:STDOUT:
  837. // CHECK:STDOUT: !members:
  838. // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
  839. // CHECK:STDOUT: .x = imports.%Main.import_ref.f67
  840. // CHECK:STDOUT: }
  841. // CHECK:STDOUT:
  842. // CHECK:STDOUT: class @NSC [from "export.carbon"] {
  843. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.63c
  844. // CHECK:STDOUT:
  845. // CHECK:STDOUT: !members:
  846. // CHECK:STDOUT: .Self = imports.%Main.import_ref.f0b
  847. // CHECK:STDOUT: .y = imports.%Main.import_ref.ebc
  848. // CHECK:STDOUT: }
  849. // CHECK:STDOUT:
  850. // CHECK:STDOUT: fn @__global_init() {
  851. // CHECK:STDOUT: !entry:
  852. // CHECK:STDOUT: %.loc7_19.1: %empty_tuple.type = tuple_literal ()
  853. // CHECK:STDOUT: %.loc7_20.1: %struct_type.x = struct_literal (%.loc7_19.1)
  854. // CHECK:STDOUT: %.loc7_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  855. // CHECK:STDOUT: %.loc7_19.2: init %empty_tuple.type = tuple_init () to %.loc7_20.2 [template = constants.%empty_tuple]
  856. // CHECK:STDOUT: %.loc7_20.3: init %empty_tuple.type = converted %.loc7_19.1, %.loc7_19.2 [template = constants.%empty_tuple]
  857. // CHECK:STDOUT: %.loc7_20.4: init %C = class_init (%.loc7_20.3), file.%c.var [template = constants.%C.val]
  858. // CHECK:STDOUT: %.loc7_1: init %C = converted %.loc7_20.1, %.loc7_20.4 [template = constants.%C.val]
  859. // CHECK:STDOUT: assign file.%c.var, %.loc7_1
  860. // CHECK:STDOUT: %.loc8_26.1: %empty_tuple.type = tuple_literal ()
  861. // CHECK:STDOUT: %.loc8_27.1: %struct_type.y = struct_literal (%.loc8_26.1)
  862. // CHECK:STDOUT: %.loc8_27.2: ref %empty_tuple.type = class_element_access file.%nsc.var, element0
  863. // CHECK:STDOUT: %.loc8_26.2: init %empty_tuple.type = tuple_init () to %.loc8_27.2 [template = constants.%empty_tuple]
  864. // CHECK:STDOUT: %.loc8_27.3: init %empty_tuple.type = converted %.loc8_26.1, %.loc8_26.2 [template = constants.%empty_tuple]
  865. // CHECK:STDOUT: %.loc8_27.4: init %NSC = class_init (%.loc8_27.3), file.%nsc.var [template = constants.%NSC.val]
  866. // CHECK:STDOUT: %.loc8_1: init %NSC = converted %.loc8_27.1, %.loc8_27.4 [template = constants.%NSC.val]
  867. // CHECK:STDOUT: assign file.%nsc.var, %.loc8_1
  868. // CHECK:STDOUT: return
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: --- fail_use_not_reexporting.carbon
  872. // CHECK:STDOUT:
  873. // CHECK:STDOUT: file {
  874. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  875. // CHECK:STDOUT: .Local = %Local
  876. // CHECK:STDOUT: .NSLocal = %NSLocal
  877. // CHECK:STDOUT: }
  878. // CHECK:STDOUT: %default.import = import <none>
  879. // CHECK:STDOUT: %C.ref: <error> = name_ref C, <error> [template = <error>]
  880. // CHECK:STDOUT: %Local: <error> = bind_alias Local, <error> [template = <error>]
  881. // CHECK:STDOUT: %NS.ref: <error> = name_ref NS, <error> [template = <error>]
  882. // CHECK:STDOUT: %NSC.ref: <error> = name_ref NSC, <error> [template = <error>]
  883. // CHECK:STDOUT: %NSLocal: <error> = bind_alias NSLocal, <error> [template = <error>]
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT:
  886. // CHECK:STDOUT: --- repeat_export.carbon
  887. // CHECK:STDOUT:
  888. // CHECK:STDOUT: constants {
  889. // CHECK:STDOUT: %C: type = class_type @C [template]
  890. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  891. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  892. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [template]
  893. // CHECK:STDOUT: }
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: imports {
  896. // CHECK:STDOUT: %Main.C: type = import_ref Main//base, C, loaded [template = constants.%C]
  897. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  898. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  899. // CHECK:STDOUT: .NSC = %Main.NSC
  900. // CHECK:STDOUT: }
  901. // CHECK:STDOUT: %Main.import_ref.56d: <witness> = import_ref Main//base, loc6_1, loaded [template = constants.%complete_type]
  902. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//base, inst14 [no loc], unloaded
  903. // CHECK:STDOUT: %Main.import_ref.276 = import_ref Main//base, loc5_8, unloaded
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: file {
  907. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  908. // CHECK:STDOUT: .C = %C
  909. // CHECK:STDOUT: .NS = imports.%NS
  910. // CHECK:STDOUT: }
  911. // CHECK:STDOUT: %default.import = import <none>
  912. // CHECK:STDOUT: %C: type = export C, imports.%Main.C [template = constants.%C]
  913. // CHECK:STDOUT: }
  914. // CHECK:STDOUT:
  915. // CHECK:STDOUT: class @C [from "base.carbon"] {
  916. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.56d
  917. // CHECK:STDOUT:
  918. // CHECK:STDOUT: !members:
  919. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  920. // CHECK:STDOUT: .x = imports.%Main.import_ref.276
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: --- use_repeat_export.carbon
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: constants {
  926. // CHECK:STDOUT: %C: type = class_type @C [template]
  927. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  928. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  929. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [template]
  930. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [template]
  931. // CHECK:STDOUT: %C.val: %C = struct_value (%empty_tuple) [template]
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT:
  934. // CHECK:STDOUT: imports {
  935. // CHECK:STDOUT: %Main.C: type = import_ref Main//repeat_export, C, loaded [template = constants.%C]
  936. // CHECK:STDOUT: %Main.import_ref.ad3: <witness> = import_ref Main//repeat_export, inst23 [indirect], loaded [template = constants.%complete_type]
  937. // CHECK:STDOUT: %Main.import_ref.6a9 = import_ref Main//repeat_export, inst24 [indirect], unloaded
  938. // CHECK:STDOUT: %Main.import_ref.f67 = import_ref Main//repeat_export, inst25 [indirect], unloaded
  939. // CHECK:STDOUT: }
  940. // CHECK:STDOUT:
  941. // CHECK:STDOUT: file {
  942. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  943. // CHECK:STDOUT: .C = imports.%Main.C
  944. // CHECK:STDOUT: .c = %c
  945. // CHECK:STDOUT: }
  946. // CHECK:STDOUT: %default.import = import <none>
  947. // CHECK:STDOUT: name_binding_decl {
  948. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  949. // CHECK:STDOUT: %.loc6: %C = var_pattern %c.patt
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT: %c.var: ref %C = var c
  952. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Main.C [template = constants.%C]
  953. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  954. // CHECK:STDOUT: }
  955. // CHECK:STDOUT:
  956. // CHECK:STDOUT: class @C [from "repeat_export.carbon"] {
  957. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.ad3
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: !members:
  960. // CHECK:STDOUT: .Self = imports.%Main.import_ref.6a9
  961. // CHECK:STDOUT: .x = imports.%Main.import_ref.f67
  962. // CHECK:STDOUT: }
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: fn @__global_init() {
  965. // CHECK:STDOUT: !entry:
  966. // CHECK:STDOUT: %.loc6_19.1: %empty_tuple.type = tuple_literal ()
  967. // CHECK:STDOUT: %.loc6_20.1: %struct_type.x = struct_literal (%.loc6_19.1)
  968. // CHECK:STDOUT: %.loc6_20.2: ref %empty_tuple.type = class_element_access file.%c.var, element0
  969. // CHECK:STDOUT: %.loc6_19.2: init %empty_tuple.type = tuple_init () to %.loc6_20.2 [template = constants.%empty_tuple]
  970. // CHECK:STDOUT: %.loc6_20.3: init %empty_tuple.type = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%empty_tuple]
  971. // CHECK:STDOUT: %.loc6_20.4: init %C = class_init (%.loc6_20.3), file.%c.var [template = constants.%C.val]
  972. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_20.1, %.loc6_20.4 [template = constants.%C.val]
  973. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  974. // CHECK:STDOUT: return
  975. // CHECK:STDOUT: }
  976. // CHECK:STDOUT:
  977. // CHECK:STDOUT: --- fail_modifiers.carbon
  978. // CHECK:STDOUT:
  979. // CHECK:STDOUT: constants {
  980. // CHECK:STDOUT: %C: type = class_type @C [template]
  981. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  982. // CHECK:STDOUT: %struct_type.x: type = struct_type {.x: %empty_tuple.type} [template]
  983. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %struct_type.x [template]
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT:
  986. // CHECK:STDOUT: imports {
  987. // CHECK:STDOUT: %Main.C: type = import_ref Main//base, C, loaded [template = constants.%C]
  988. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//base, NS, loaded
  989. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [template] {
  990. // CHECK:STDOUT: .NSC = %Main.NSC
  991. // CHECK:STDOUT: }
  992. // CHECK:STDOUT: %Main.import_ref.56d: <witness> = import_ref Main//base, loc6_1, loaded [template = constants.%complete_type]
  993. // CHECK:STDOUT: %Main.import_ref.2c4 = import_ref Main//base, inst14 [no loc], unloaded
  994. // CHECK:STDOUT: %Main.import_ref.276 = import_ref Main//base, loc5_8, unloaded
  995. // CHECK:STDOUT: }
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: file {
  998. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  999. // CHECK:STDOUT: .C = %C
  1000. // CHECK:STDOUT: .NS = imports.%NS
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT: %default.import = import <none>
  1003. // CHECK:STDOUT: %C: type = export C, imports.%Main.C [template = constants.%C]
  1004. // CHECK:STDOUT: }
  1005. // CHECK:STDOUT:
  1006. // CHECK:STDOUT: class @C [from "base.carbon"] {
  1007. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.56d
  1008. // CHECK:STDOUT:
  1009. // CHECK:STDOUT: !members:
  1010. // CHECK:STDOUT: .Self = imports.%Main.import_ref.2c4
  1011. // CHECK:STDOUT: .x = imports.%Main.import_ref.276
  1012. // CHECK:STDOUT: }
  1013. // CHECK:STDOUT: