cross_package_import.carbon 18 KB

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