cross_package_import.carbon 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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/class/cross_package_import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/cross_package_import.carbon
  10. // ============================================================================
  11. // Setup files
  12. // ============================================================================
  13. // --- other_define.carbon
  14. package Other library "[[@TEST_NAME]]";
  15. class C {}
  16. // --- other_extern.carbon
  17. package Other library "[[@TEST_NAME]]";
  18. extern class C;
  19. // --- other_conflict.carbon
  20. package Other library "[[@TEST_NAME]]";
  21. fn C() {}
  22. // ============================================================================
  23. // Test files
  24. // ============================================================================
  25. // --- define.carbon
  26. library "[[@TEST_NAME]]";
  27. import Other library "other_define";
  28. var c: Other.C = {};
  29. // --- fail_extern.carbon
  30. library "[[@TEST_NAME]]";
  31. import Other library "other_extern";
  32. // CHECK:STDERR: fail_extern.carbon:[[@LINE+8]]:8: error: binding pattern has incomplete type `C` in name binding declaration [IncompleteTypeInBindingDecl]
  33. // CHECK:STDERR: var c: Other.C = {};
  34. // CHECK:STDERR: ^~~~~~~
  35. // CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: in import [InImport]
  36. // CHECK:STDERR: other_extern.carbon:4:1: note: class was forward declared here [ClassForwardDeclaredHere]
  37. // CHECK:STDERR: extern class C;
  38. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. var c: Other.C = {};
  41. // --- fail_todo_merge_define_extern.carbon
  42. library "[[@TEST_NAME]]";
  43. // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+8]]:1: in import [InImport]
  44. // CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  45. // CHECK:STDERR: extern class C;
  46. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  47. // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1: in import [InImport]
  48. // CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  49. // CHECK:STDERR: class C {}
  50. // CHECK:STDERR: ^~~~~~~~~
  51. import Other library "other_define";
  52. import Other library "other_extern";
  53. // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:8: note: in name lookup for `C` [InNameLookup]
  54. // CHECK:STDERR: var c: Other.C = {};
  55. // CHECK:STDERR: ^~~~~~~
  56. // CHECK:STDERR:
  57. var c: Other.C = {};
  58. // --- fail_conflict.carbon
  59. library "[[@TEST_NAME]]";
  60. // CHECK:STDERR: fail_conflict.carbon:[[@LINE+8]]:1: in import [InImport]
  61. // CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  62. // CHECK:STDERR: fn C() {}
  63. // CHECK:STDERR: ^~~~~~~~
  64. // CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: in import [InImport]
  65. // CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  66. // CHECK:STDERR: class C {}
  67. // CHECK:STDERR: ^~~~~~~~~
  68. import Other library "other_define";
  69. import Other library "other_conflict";
  70. // CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:8: note: in name lookup for `C` [InNameLookup]
  71. // CHECK:STDERR: var c: Other.C = {};
  72. // CHECK:STDERR: ^~~~~~~
  73. // CHECK:STDERR:
  74. var c: Other.C = {};
  75. // CHECK:STDOUT: --- other_define.carbon
  76. // CHECK:STDOUT:
  77. // CHECK:STDOUT: constants {
  78. // CHECK:STDOUT: %C: type = class_type @C [template]
  79. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  80. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  81. // CHECK:STDOUT: }
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: imports {
  84. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  85. // CHECK:STDOUT: import Core//prelude
  86. // CHECK:STDOUT: import Core//prelude/...
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT: }
  89. // CHECK:STDOUT:
  90. // CHECK:STDOUT: file {
  91. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  92. // CHECK:STDOUT: .Core = imports.%Core
  93. // CHECK:STDOUT: .C = %C.decl
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT: %Core.import = import Core
  96. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT:
  99. // CHECK:STDOUT: class @C {
  100. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  101. // CHECK:STDOUT: complete_type_witness = %complete_type
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: !members:
  104. // CHECK:STDOUT: .Self = constants.%C
  105. // CHECK:STDOUT: }
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: --- other_extern.carbon
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: constants {
  110. // CHECK:STDOUT: %C: type = class_type @C [template]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: imports {
  114. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  115. // CHECK:STDOUT: import Core//prelude
  116. // CHECK:STDOUT: import Core//prelude/...
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: file {
  121. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  122. // CHECK:STDOUT: .Core = imports.%Core
  123. // CHECK:STDOUT: .C = %C.decl
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT: %Core.import = import Core
  126. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: class @C;
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: --- other_conflict.carbon
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: constants {
  134. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  135. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: imports {
  139. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  140. // CHECK:STDOUT: import Core//prelude
  141. // CHECK:STDOUT: import Core//prelude/...
  142. // CHECK:STDOUT: }
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: file {
  146. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  147. // CHECK:STDOUT: .Core = imports.%Core
  148. // CHECK:STDOUT: .C = %C.decl
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT: %Core.import = import Core
  151. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {}
  152. // CHECK:STDOUT: }
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: fn @C() {
  155. // CHECK:STDOUT: !entry:
  156. // CHECK:STDOUT: return
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: --- define.carbon
  160. // CHECK:STDOUT:
  161. // CHECK:STDOUT: constants {
  162. // CHECK:STDOUT: %C: type = class_type @C [template]
  163. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  164. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  165. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT:
  168. // CHECK:STDOUT: imports {
  169. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  170. // CHECK:STDOUT: import Core//prelude
  171. // CHECK:STDOUT: import Core//prelude/...
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  174. // CHECK:STDOUT: .C = %Other.C
  175. // CHECK:STDOUT: import Other//other_define
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT: %Other.C: type = import_ref Other//other_define, C, loaded [template = constants.%C]
  178. // CHECK:STDOUT: %Other.import_ref.8f2: <witness> = import_ref Other//other_define, loc4_10, loaded [template = constants.%complete_type]
  179. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//other_define, inst16 [no loc], unloaded
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: file {
  183. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  184. // CHECK:STDOUT: .Core = imports.%Core
  185. // CHECK:STDOUT: .Other = imports.%Other
  186. // CHECK:STDOUT: .c = %c
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: %Core.import = import Core
  189. // CHECK:STDOUT: %Other.import = import Other
  190. // CHECK:STDOUT: name_binding_decl {
  191. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  192. // CHECK:STDOUT: %.loc6_1: %C = var_pattern %c.patt
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: %c.var: ref %C = var c
  195. // CHECK:STDOUT: %.loc6_13: type = splice_block %C.ref [template = constants.%C] {
  196. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  197. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [template = constants.%C]
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: class @C [from "other_define.carbon"] {
  203. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.8f2
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: !members:
  206. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: fn @__global_init() {
  210. // CHECK:STDOUT: !entry:
  211. // CHECK:STDOUT: %.loc6_19.1: %empty_struct_type = struct_literal ()
  212. // CHECK:STDOUT: %.loc6_19.2: init %C = class_init (), file.%c.var [template = constants.%C.val]
  213. // CHECK:STDOUT: %.loc6_1: init %C = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%C.val]
  214. // CHECK:STDOUT: assign file.%c.var, %.loc6_1
  215. // CHECK:STDOUT: return
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT:
  218. // CHECK:STDOUT: --- fail_extern.carbon
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: constants {
  221. // CHECK:STDOUT: %C: type = class_type @C [template]
  222. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: imports {
  226. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  227. // CHECK:STDOUT: import Core//prelude
  228. // CHECK:STDOUT: import Core//prelude/...
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  231. // CHECK:STDOUT: .C = %Other.C
  232. // CHECK:STDOUT: import Other//other_extern
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT: %Other.C: type = import_ref Other//other_extern, C, loaded [template = constants.%C]
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: file {
  238. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  239. // CHECK:STDOUT: .Core = imports.%Core
  240. // CHECK:STDOUT: .Other = imports.%Other
  241. // CHECK:STDOUT: .c = %c
  242. // CHECK:STDOUT: }
  243. // CHECK:STDOUT: %Core.import = import Core
  244. // CHECK:STDOUT: %Other.import = import Other
  245. // CHECK:STDOUT: name_binding_decl {
  246. // CHECK:STDOUT: %c.patt: <error> = binding_pattern c
  247. // CHECK:STDOUT: %.loc14_1: <error> = var_pattern %c.patt
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: %c.var: ref <error> = var c
  250. // CHECK:STDOUT: %.loc14_13: type = splice_block %C.ref [template = constants.%C] {
  251. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  252. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [template = constants.%C]
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT: %c: <error> = bind_name c, <error>
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: class @C [from "other_extern.carbon"];
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: fn @__global_init() {
  260. // CHECK:STDOUT: !entry:
  261. // CHECK:STDOUT: %.loc14: %empty_struct_type = struct_literal ()
  262. // CHECK:STDOUT: assign file.%c.var, <error>
  263. // CHECK:STDOUT: return
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: --- fail_todo_merge_define_extern.carbon
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: constants {
  269. // CHECK:STDOUT: %C: type = class_type @C [template]
  270. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  271. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  272. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: imports {
  276. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  277. // CHECK:STDOUT: import Core//prelude
  278. // CHECK:STDOUT: import Core//prelude/...
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  281. // CHECK:STDOUT: .C = %Other.C
  282. // CHECK:STDOUT: import Other//other_define
  283. // CHECK:STDOUT: import Other//other_extern
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT: %Other.C: type = import_ref Other//other_define, C, loaded [template = constants.%C]
  286. // CHECK:STDOUT: %Other.import_ref.8f2: <witness> = import_ref Other//other_define, loc4_10, loaded [template = constants.%complete_type]
  287. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//other_define, inst16 [no loc], unloaded
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: file {
  291. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  292. // CHECK:STDOUT: .Core = imports.%Core
  293. // CHECK:STDOUT: .Other = imports.%Other
  294. // CHECK:STDOUT: .c = %c
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT: %Core.import = import Core
  297. // CHECK:STDOUT: %Other.import = import Other
  298. // CHECK:STDOUT: name_binding_decl {
  299. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  300. // CHECK:STDOUT: %.loc19_1: %C = var_pattern %c.patt
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: %c.var: ref %C = var c
  303. // CHECK:STDOUT: %.loc19_13: type = splice_block %C.ref [template = constants.%C] {
  304. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  305. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [template = constants.%C]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: class @C [from "other_define.carbon"] {
  311. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.8f2
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: !members:
  314. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: fn @__global_init() {
  318. // CHECK:STDOUT: !entry:
  319. // CHECK:STDOUT: %.loc19_19.1: %empty_struct_type = struct_literal ()
  320. // CHECK:STDOUT: %.loc19_19.2: init %C = class_init (), file.%c.var [template = constants.%C.val]
  321. // CHECK:STDOUT: %.loc19_1: init %C = converted %.loc19_19.1, %.loc19_19.2 [template = constants.%C.val]
  322. // CHECK:STDOUT: assign file.%c.var, %.loc19_1
  323. // CHECK:STDOUT: return
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: --- fail_conflict.carbon
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: constants {
  329. // CHECK:STDOUT: %C: type = class_type @C [template]
  330. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  331. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  332. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  333. // CHECK:STDOUT: }
  334. // CHECK:STDOUT:
  335. // CHECK:STDOUT: imports {
  336. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  337. // CHECK:STDOUT: import Core//prelude
  338. // CHECK:STDOUT: import Core//prelude/...
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  341. // CHECK:STDOUT: .C = %Other.C
  342. // CHECK:STDOUT: import Other//other_define
  343. // CHECK:STDOUT: import Other//other_conflict
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: %Other.C: type = import_ref Other//other_define, C, loaded [template = constants.%C]
  346. // CHECK:STDOUT: %Other.import_ref.8f2: <witness> = import_ref Other//other_define, loc4_10, loaded [template = constants.%complete_type]
  347. // CHECK:STDOUT: %Other.import_ref.2c4 = import_ref Other//other_define, inst16 [no loc], unloaded
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: file {
  351. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  352. // CHECK:STDOUT: .Core = imports.%Core
  353. // CHECK:STDOUT: .Other = imports.%Other
  354. // CHECK:STDOUT: .c = %c
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: %Core.import = import Core
  357. // CHECK:STDOUT: %Other.import = import Other
  358. // CHECK:STDOUT: name_binding_decl {
  359. // CHECK:STDOUT: %c.patt: %C = binding_pattern c
  360. // CHECK:STDOUT: %.loc19_1: %C = var_pattern %c.patt
  361. // CHECK:STDOUT: }
  362. // CHECK:STDOUT: %c.var: ref %C = var c
  363. // CHECK:STDOUT: %.loc19_13: type = splice_block %C.ref [template = constants.%C] {
  364. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  365. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%Other.C [template = constants.%C]
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: class @C [from "other_define.carbon"] {
  371. // CHECK:STDOUT: complete_type_witness = imports.%Other.import_ref.8f2
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: !members:
  374. // CHECK:STDOUT: .Self = imports.%Other.import_ref.2c4
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: fn @__global_init() {
  378. // CHECK:STDOUT: !entry:
  379. // CHECK:STDOUT: %.loc19_19.1: %empty_struct_type = struct_literal ()
  380. // CHECK:STDOUT: %.loc19_19.2: init %C = class_init (), file.%c.var [template = constants.%C.val]
  381. // CHECK:STDOUT: %.loc19_1: init %C = converted %.loc19_19.1, %.loc19_19.2 [template = constants.%C.val]
  382. // CHECK:STDOUT: assign file.%c.var, %.loc19_1
  383. // CHECK:STDOUT: return
  384. // CHECK:STDOUT: }
  385. // CHECK:STDOUT: