cross_package_import.carbon 18 KB

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