cross_package_import.carbon 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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: Variable has incomplete type `C`
  33. // CHECK:STDERR: var c: Other.C = {};
  34. // CHECK:STDERR: ^~~~~~~
  35. // CHECK:STDERR: fail_extern.carbon:[[@LINE-5]]:1: in import
  36. // CHECK:STDERR: other_extern.carbon:4:1: note: class was forward declared here
  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
  44. // CHECK:STDERR: other_extern.carbon:4:1: error: duplicate name being declared in the same scope
  45. // CHECK:STDERR: extern class C;
  46. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  47. // CHECK:STDERR: fail_todo_merge_define_extern.carbon:[[@LINE+4]]:1: in import
  48. // CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here
  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`
  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
  61. // CHECK:STDERR: other_conflict.carbon:4:1: error: duplicate name being declared in the same scope
  62. // CHECK:STDERR: fn C() {}
  63. // CHECK:STDERR: ^~~~~~~~
  64. // CHECK:STDERR: fail_conflict.carbon:[[@LINE+4]]:1: in import
  65. // CHECK:STDERR: other_define.carbon:4:1: note: name is previously declared here
  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+3]]:8: note: in name lookup for `C`
  71. // CHECK:STDERR: var c: Other.C = {};
  72. // CHECK:STDERR: ^~~~~~~
  73. var c: Other.C = {};
  74. // CHECK:STDOUT: --- other_define.carbon
  75. // CHECK:STDOUT:
  76. // CHECK:STDOUT: constants {
  77. // CHECK:STDOUT: %C: type = class_type @C [template]
  78. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  79. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT:
  82. // CHECK:STDOUT: imports {
  83. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  84. // CHECK:STDOUT: import Core//prelude
  85. // CHECK:STDOUT: import Core//prelude/operators
  86. // CHECK:STDOUT: import Core//prelude/types
  87. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  88. // CHECK:STDOUT: import Core//prelude/operators/as
  89. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  90. // CHECK:STDOUT: import Core//prelude/operators/comparison
  91. // CHECK:STDOUT: import Core//prelude/types/bool
  92. // CHECK:STDOUT: }
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: file {
  96. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  97. // CHECK:STDOUT: .Core = imports.%Core
  98. // CHECK:STDOUT: .C = %C.decl
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT: %Core.import = import Core
  101. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT:
  104. // CHECK:STDOUT: class @C {
  105. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: !members:
  108. // CHECK:STDOUT: .Self = constants.%C
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT:
  111. // CHECK:STDOUT: --- other_extern.carbon
  112. // CHECK:STDOUT:
  113. // CHECK:STDOUT: constants {
  114. // CHECK:STDOUT: %C: type = class_type @C [template]
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: imports {
  118. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  119. // CHECK:STDOUT: import Core//prelude
  120. // CHECK:STDOUT: import Core//prelude/operators
  121. // CHECK:STDOUT: import Core//prelude/types
  122. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  123. // CHECK:STDOUT: import Core//prelude/operators/as
  124. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  125. // CHECK:STDOUT: import Core//prelude/operators/comparison
  126. // CHECK:STDOUT: import Core//prelude/types/bool
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: file {
  131. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  132. // CHECK:STDOUT: .Core = imports.%Core
  133. // CHECK:STDOUT: .C = %C.decl
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT: %Core.import = import Core
  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:
  141. // CHECK:STDOUT: --- other_conflict.carbon
  142. // CHECK:STDOUT:
  143. // CHECK:STDOUT: constants {
  144. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  145. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  146. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: imports {
  150. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  151. // CHECK:STDOUT: import Core//prelude
  152. // CHECK:STDOUT: import Core//prelude/operators
  153. // CHECK:STDOUT: import Core//prelude/types
  154. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  155. // CHECK:STDOUT: import Core//prelude/operators/as
  156. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  157. // CHECK:STDOUT: import Core//prelude/operators/comparison
  158. // CHECK:STDOUT: import Core//prelude/types/bool
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: file {
  163. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  164. // CHECK:STDOUT: .Core = imports.%Core
  165. // CHECK:STDOUT: .C = %C.decl
  166. // CHECK:STDOUT: }
  167. // CHECK:STDOUT: %Core.import = import Core
  168. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {}
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT:
  171. // CHECK:STDOUT: fn @C() {
  172. // CHECK:STDOUT: !entry:
  173. // CHECK:STDOUT: return
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: --- define.carbon
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: constants {
  179. // CHECK:STDOUT: %C: type = class_type @C [template]
  180. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  181. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  182. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  183. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  184. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: imports {
  188. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  189. // CHECK:STDOUT: import Core//prelude
  190. // CHECK:STDOUT: import Core//prelude/operators
  191. // CHECK:STDOUT: import Core//prelude/types
  192. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  193. // CHECK:STDOUT: import Core//prelude/operators/as
  194. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  195. // CHECK:STDOUT: import Core//prelude/operators/comparison
  196. // CHECK:STDOUT: import Core//prelude/types/bool
  197. // CHECK:STDOUT: }
  198. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  199. // CHECK:STDOUT: .C = %import_ref.1
  200. // CHECK:STDOUT: import Other//other_define
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: %import_ref.1: type = import_ref Other//other_define, inst+3, loaded [template = constants.%C]
  203. // CHECK:STDOUT: %import_ref.2 = import_ref Other//other_define, inst+4, unloaded
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: file {
  207. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  208. // CHECK:STDOUT: .Core = imports.%Core
  209. // CHECK:STDOUT: .Other = imports.%Other
  210. // CHECK:STDOUT: .c = %c
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: %Core.import = import Core
  213. // CHECK:STDOUT: %Other.import = import Other
  214. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  215. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  216. // CHECK:STDOUT: %c.var: ref %C = var c
  217. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT:
  220. // CHECK:STDOUT: class @C {
  221. // CHECK:STDOUT: !members:
  222. // CHECK:STDOUT: .Self = imports.%import_ref.2
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT:
  225. // CHECK:STDOUT: fn @__global_init() {
  226. // CHECK:STDOUT: !entry:
  227. // CHECK:STDOUT: %.loc6_19.1: %.1 = struct_literal ()
  228. // CHECK:STDOUT: %.loc6_19.2: init %C = class_init (), file.%c.var [template = constants.%struct]
  229. // CHECK:STDOUT: %.loc6_20: init %C = converted %.loc6_19.1, %.loc6_19.2 [template = constants.%struct]
  230. // CHECK:STDOUT: assign file.%c.var, %.loc6_20
  231. // CHECK:STDOUT: return
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: --- fail_extern.carbon
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: constants {
  237. // CHECK:STDOUT: %C: type = class_type @C [template]
  238. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: imports {
  242. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  243. // CHECK:STDOUT: import Core//prelude
  244. // CHECK:STDOUT: import Core//prelude/operators
  245. // CHECK:STDOUT: import Core//prelude/types
  246. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  247. // CHECK:STDOUT: import Core//prelude/operators/as
  248. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  249. // CHECK:STDOUT: import Core//prelude/operators/comparison
  250. // CHECK:STDOUT: import Core//prelude/types/bool
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  253. // CHECK:STDOUT: .C = %import_ref
  254. // CHECK:STDOUT: import Other//other_extern
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT: %import_ref: type = import_ref Other//other_extern, inst+3, loaded [template = constants.%C]
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: file {
  260. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  261. // CHECK:STDOUT: .Core = imports.%Core
  262. // CHECK:STDOUT: .Other = imports.%Other
  263. // CHECK:STDOUT: .c = %c
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %Core.import = import Core
  266. // CHECK:STDOUT: %Other.import = import Other
  267. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  268. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref [template = constants.%C]
  269. // CHECK:STDOUT: %c.var: ref <error> = var c
  270. // CHECK:STDOUT: %c: ref <error> = bind_name c, %c.var
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: class @C;
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: fn @__global_init() {
  276. // CHECK:STDOUT: !entry:
  277. // CHECK:STDOUT: %.loc14: %.1 = struct_literal ()
  278. // CHECK:STDOUT: assign file.%c.var, <error>
  279. // CHECK:STDOUT: return
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: --- fail_todo_merge_define_extern.carbon
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: constants {
  285. // CHECK:STDOUT: %C: type = class_type @C [template]
  286. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  287. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  288. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  289. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  290. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: imports {
  294. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  295. // CHECK:STDOUT: import Core//prelude
  296. // CHECK:STDOUT: import Core//prelude/operators
  297. // CHECK:STDOUT: import Core//prelude/types
  298. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  299. // CHECK:STDOUT: import Core//prelude/operators/as
  300. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  301. // CHECK:STDOUT: import Core//prelude/operators/comparison
  302. // CHECK:STDOUT: import Core//prelude/types/bool
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  305. // CHECK:STDOUT: .C = %import_ref.1
  306. // CHECK:STDOUT: import Other//other_define
  307. // CHECK:STDOUT: import Other//other_extern
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: %import_ref.1: type = import_ref Other//other_define, inst+3, loaded [template = constants.%C]
  310. // CHECK:STDOUT: %import_ref.2 = import_ref Other//other_define, inst+4, unloaded
  311. // CHECK:STDOUT: %import_ref.3 = import_ref Other//other_extern, inst+3, unloaded
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT:
  314. // CHECK:STDOUT: file {
  315. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  316. // CHECK:STDOUT: .Core = imports.%Core
  317. // CHECK:STDOUT: .Other = imports.%Other
  318. // CHECK:STDOUT: .c = %c
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: %Core.import = import Core
  321. // CHECK:STDOUT: %Other.import = import Other
  322. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  323. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  324. // CHECK:STDOUT: %c.var: ref %C = var c
  325. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: class @C {
  329. // CHECK:STDOUT: !members:
  330. // CHECK:STDOUT: .Self = imports.%import_ref.2
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: fn @__global_init() {
  334. // CHECK:STDOUT: !entry:
  335. // CHECK:STDOUT: %.loc19_19.1: %.1 = struct_literal ()
  336. // CHECK:STDOUT: %.loc19_19.2: init %C = class_init (), file.%c.var [template = constants.%struct]
  337. // CHECK:STDOUT: %.loc19_20: init %C = converted %.loc19_19.1, %.loc19_19.2 [template = constants.%struct]
  338. // CHECK:STDOUT: assign file.%c.var, %.loc19_20
  339. // CHECK:STDOUT: return
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: --- fail_conflict.carbon
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: constants {
  345. // CHECK:STDOUT: %C: type = class_type @C [template]
  346. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  347. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  348. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  349. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  350. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  351. // CHECK:STDOUT: }
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: imports {
  354. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  355. // CHECK:STDOUT: import Core//prelude
  356. // CHECK:STDOUT: import Core//prelude/operators
  357. // CHECK:STDOUT: import Core//prelude/types
  358. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  359. // CHECK:STDOUT: import Core//prelude/operators/as
  360. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  361. // CHECK:STDOUT: import Core//prelude/operators/comparison
  362. // CHECK:STDOUT: import Core//prelude/types/bool
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT: %Other: <namespace> = namespace file.%Other.import, [template] {
  365. // CHECK:STDOUT: .C = %import_ref.1
  366. // CHECK:STDOUT: import Other//other_define
  367. // CHECK:STDOUT: import Other//other_conflict
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %import_ref.1: type = import_ref Other//other_define, inst+3, loaded [template = constants.%C]
  370. // CHECK:STDOUT: %import_ref.2 = import_ref Other//other_define, inst+4, unloaded
  371. // CHECK:STDOUT: %import_ref.3 = import_ref Other//other_conflict, inst+3, unloaded
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: file {
  375. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  376. // CHECK:STDOUT: .Core = imports.%Core
  377. // CHECK:STDOUT: .Other = imports.%Other
  378. // CHECK:STDOUT: .c = %c
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT: %Core.import = import Core
  381. // CHECK:STDOUT: %Other.import = import Other
  382. // CHECK:STDOUT: %Other.ref: <namespace> = name_ref Other, imports.%Other [template = imports.%Other]
  383. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  384. // CHECK:STDOUT: %c.var: ref %C = var c
  385. // CHECK:STDOUT: %c: ref %C = bind_name c, %c.var
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: class @C {
  389. // CHECK:STDOUT: !members:
  390. // CHECK:STDOUT: .Self = imports.%import_ref.2
  391. // CHECK:STDOUT: }
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: fn @__global_init() {
  394. // CHECK:STDOUT: !entry:
  395. // CHECK:STDOUT: %.loc18_19.1: %.1 = struct_literal ()
  396. // CHECK:STDOUT: %.loc18_19.2: init %C = class_init (), file.%c.var [template = constants.%struct]
  397. // CHECK:STDOUT: %.loc18_20: init %C = converted %.loc18_19.1, %.loc18_19.2 [template = constants.%struct]
  398. // CHECK:STDOUT: assign file.%c.var, %.loc18_20
  399. // CHECK:STDOUT: return
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT: