import.carbon 66 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  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/function/declaration/import.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/declaration/import.carbon
  10. // ============================================================================
  11. // Setup files
  12. // ============================================================================
  13. // --- api.carbon
  14. library "[[@TEST_NAME]]";
  15. fn A();
  16. fn B(b: i32) -> i32;
  17. fn C(c: (i32,)) -> {.c: i32};
  18. extern fn D();
  19. namespace NS;
  20. fn NS.E();
  21. // --- extern_api.carbon
  22. library "[[@TEST_NAME]]";
  23. extern library "redecl_extern_api" fn A();
  24. extern library "redecl_extern_api" fn B(b: i32) -> i32;
  25. extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
  26. extern library "redecl_extern_api" fn D();
  27. namespace NS;
  28. extern library "redecl_extern_api" fn NS.E();
  29. // ============================================================================
  30. // Test files
  31. // ============================================================================
  32. // --- basics.carbon
  33. library "[[@TEST_NAME]]";
  34. import library "api";
  35. var a: () = A();
  36. var b: i32 = B(1);
  37. var c: {.c: i32} = C((1,));
  38. var d: () = D();
  39. var e: () = NS.E();
  40. // --- fail_redecl_api.carbon
  41. library "[[@TEST_NAME]]";
  42. import library "api";
  43. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn A` must match use of `extern` [RedeclExternMismatch]
  44. // CHECK:STDERR: extern fn A();
  45. // CHECK:STDERR: ^~~~~~~~~~~~~~
  46. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-5]]:1: in import [InImport]
  47. // CHECK:STDERR: api.carbon:4:1: note: previously declared here [RedeclPrevDecl]
  48. // CHECK:STDERR: fn A();
  49. // CHECK:STDERR: ^~~~~~~
  50. // CHECK:STDERR:
  51. extern fn A();
  52. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn B` must match use of `extern` [RedeclExternMismatch]
  53. // CHECK:STDERR: extern fn B(b: i32) -> i32;
  54. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-14]]:1: in import [InImport]
  56. // CHECK:STDERR: api.carbon:5:1: note: previously declared here [RedeclPrevDecl]
  57. // CHECK:STDERR: fn B(b: i32) -> i32;
  58. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  59. // CHECK:STDERR:
  60. extern fn B(b: i32) -> i32;
  61. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn C` must match use of `extern` [RedeclExternMismatch]
  62. // CHECK:STDERR: extern fn C(c: (i32,)) -> {.c: i32};
  63. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-23]]:1: in import [InImport]
  65. // CHECK:STDERR: api.carbon:6:1: note: previously declared here [RedeclPrevDecl]
  66. // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
  67. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  68. // CHECK:STDERR:
  69. extern fn C(c: (i32,)) -> {.c: i32};
  70. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclaration of `fn D` is redundant [RedeclRedundant]
  71. // CHECK:STDERR: extern fn D();
  72. // CHECK:STDERR: ^~~~~~~~~~~~~~
  73. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-32]]:1: in import [InImport]
  74. // CHECK:STDERR: api.carbon:7:1: note: previously declared here [RedeclPrevDecl]
  75. // CHECK:STDERR: extern fn D();
  76. // CHECK:STDERR: ^~~~~~~~~~~~~~
  77. // CHECK:STDERR:
  78. extern fn D();
  79. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE+8]]:1: error: redeclarations of `fn E` must match use of `extern` [RedeclExternMismatch]
  80. // CHECK:STDERR: extern fn NS.E();
  81. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  82. // CHECK:STDERR: fail_redecl_api.carbon:[[@LINE-41]]:1: in import [InImport]
  83. // CHECK:STDERR: api.carbon:10:1: note: previously declared here [RedeclPrevDecl]
  84. // CHECK:STDERR: fn NS.E();
  85. // CHECK:STDERR: ^~~~~~~~~~
  86. // CHECK:STDERR:
  87. extern fn NS.E();
  88. var a: () = A();
  89. var b: i32 = B(1);
  90. var c: {.c: i32} = C((1,));
  91. var d: () = D();
  92. var e: () = NS.E();
  93. // --- redecl_extern_api.carbon
  94. library "[[@TEST_NAME]]";
  95. import library "extern_api";
  96. extern fn A();
  97. extern fn B(b: i32) -> i32;
  98. extern fn C(c: (i32,)) -> {.c: i32};
  99. extern fn D();
  100. extern fn NS.E();
  101. var a: () = A();
  102. var b: i32 = B(1);
  103. var c: {.c: i32} = C((1,));
  104. var d: () = D();
  105. var e: () = NS.E();
  106. // --- fail_merge.carbon
  107. library "[[@TEST_NAME]]";
  108. // CHECK:STDERR: fail_merge.carbon:[[@LINE+45]]:1: in import [InImport]
  109. // CHECK:STDERR: extern_api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  110. // CHECK:STDERR: extern library "redecl_extern_api" fn A();
  111. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. // CHECK:STDERR: fail_merge.carbon:[[@LINE+41]]:1: in import [InImport]
  113. // CHECK:STDERR: api.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  114. // CHECK:STDERR: fn A();
  115. // CHECK:STDERR: ^~~~~~~
  116. // CHECK:STDERR:
  117. // CHECK:STDERR: fail_merge.carbon:[[@LINE+36]]:1: in import [InImport]
  118. // CHECK:STDERR: extern_api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  119. // CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32;
  120. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. // CHECK:STDERR: fail_merge.carbon:[[@LINE+32]]:1: in import [InImport]
  122. // CHECK:STDERR: api.carbon:5:1: note: name is previously declared here [NameDeclPrevious]
  123. // CHECK:STDERR: fn B(b: i32) -> i32;
  124. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  125. // CHECK:STDERR:
  126. // CHECK:STDERR: fail_merge.carbon:[[@LINE+27]]:1: in import [InImport]
  127. // CHECK:STDERR: extern_api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  128. // CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
  129. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. // CHECK:STDERR: fail_merge.carbon:[[@LINE+23]]:1: in import [InImport]
  131. // CHECK:STDERR: api.carbon:6:1: note: name is previously declared here [NameDeclPrevious]
  132. // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
  133. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134. // CHECK:STDERR:
  135. // CHECK:STDERR: fail_merge.carbon:[[@LINE+18]]:1: in import [InImport]
  136. // CHECK:STDERR: extern_api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  137. // CHECK:STDERR: extern library "redecl_extern_api" fn D();
  138. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  139. // CHECK:STDERR: fail_merge.carbon:[[@LINE+14]]:1: in import [InImport]
  140. // CHECK:STDERR: api.carbon:7:1: note: name is previously declared here [NameDeclPrevious]
  141. // CHECK:STDERR: extern fn D();
  142. // CHECK:STDERR: ^~~~~~~~~~~~~~
  143. // CHECK:STDERR:
  144. // CHECK:STDERR: fail_merge.carbon:[[@LINE+9]]:1: in import [InImport]
  145. // CHECK:STDERR: extern_api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  146. // CHECK:STDERR: extern library "redecl_extern_api" fn NS.E();
  147. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  148. // CHECK:STDERR: fail_merge.carbon:[[@LINE+5]]:1: in import [InImport]
  149. // CHECK:STDERR: api.carbon:10:1: note: name is previously declared here [NameDeclPrevious]
  150. // CHECK:STDERR: fn NS.E();
  151. // CHECK:STDERR: ^~~~~~~~~~
  152. // CHECK:STDERR:
  153. import library "api";
  154. import library "extern_api";
  155. var a: () = A();
  156. var b: i32 = B(1);
  157. var c: {.c: i32} = C((1,));
  158. var d: () = D();
  159. var e: () = NS.E();
  160. // --- fail_merge_reverse.carbon
  161. library "[[@TEST_NAME]]";
  162. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+44]]:1: in import [InImport]
  163. // CHECK:STDERR: api.carbon:4:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  164. // CHECK:STDERR: fn A();
  165. // CHECK:STDERR: ^~~~~~~
  166. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+40]]:1: in import [InImport]
  167. // CHECK:STDERR: extern_api.carbon:4:1: note: name is previously declared here [NameDeclPrevious]
  168. // CHECK:STDERR: extern library "redecl_extern_api" fn A();
  169. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  170. // CHECK:STDERR:
  171. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+35]]:1: in import [InImport]
  172. // CHECK:STDERR: api.carbon:5:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  173. // CHECK:STDERR: fn B(b: i32) -> i32;
  174. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  175. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+31]]:1: in import [InImport]
  176. // CHECK:STDERR: extern_api.carbon:5:1: note: name is previously declared here [NameDeclPrevious]
  177. // CHECK:STDERR: extern library "redecl_extern_api" fn B(b: i32) -> i32;
  178. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  179. // CHECK:STDERR:
  180. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+26]]:1: in import [InImport]
  181. // CHECK:STDERR: api.carbon:6:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  182. // CHECK:STDERR: fn C(c: (i32,)) -> {.c: i32};
  183. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  184. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+22]]:1: in import [InImport]
  185. // CHECK:STDERR: extern_api.carbon:6:1: note: name is previously declared here [NameDeclPrevious]
  186. // CHECK:STDERR: extern library "redecl_extern_api" fn C(c: (i32,)) -> {.c: i32};
  187. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  188. // CHECK:STDERR:
  189. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+17]]:1: in import [InImport]
  190. // CHECK:STDERR: api.carbon:7:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  191. // CHECK:STDERR: extern fn D();
  192. // CHECK:STDERR: ^~~~~~~~~~~~~~
  193. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+13]]:1: in import [InImport]
  194. // CHECK:STDERR: extern_api.carbon:7:1: note: name is previously declared here [NameDeclPrevious]
  195. // CHECK:STDERR: extern library "redecl_extern_api" fn D();
  196. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  197. // CHECK:STDERR:
  198. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+8]]:1: in import [InImport]
  199. // CHECK:STDERR: api.carbon:10:1: error: duplicate name being declared in the same scope [NameDeclDuplicate]
  200. // CHECK:STDERR: fn NS.E();
  201. // CHECK:STDERR: ^~~~~~~~~~
  202. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+4]]:1: in import [InImport]
  203. // CHECK:STDERR: extern_api.carbon:10:1: note: name is previously declared here [NameDeclPrevious]
  204. // CHECK:STDERR: extern library "redecl_extern_api" fn NS.E();
  205. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  206. import library "extern_api";
  207. import library "api";
  208. var a: () = A();
  209. var b: i32 = B(1);
  210. var c: {.c: i32} = C((1,));
  211. var d: () = D();
  212. var e: () = NS.E();
  213. // --- unloaded.carbon
  214. library "[[@TEST_NAME]]";
  215. import library "api";
  216. // --- unloaded_extern.carbon
  217. library "[[@TEST_NAME]]";
  218. import library "extern_api";
  219. // CHECK:STDOUT: --- api.carbon
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: constants {
  222. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  223. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  224. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  225. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  226. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  227. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  228. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  229. // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
  230. // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
  231. // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
  232. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  233. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  234. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  235. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  236. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  237. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: imports {
  241. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  242. // CHECK:STDOUT: .Int32 = %import_ref
  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/index
  249. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  250. // CHECK:STDOUT: import Core//prelude/operators/comparison
  251. // CHECK:STDOUT: import Core//prelude/types/bool
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  254. // CHECK:STDOUT: }
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: file {
  257. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  258. // CHECK:STDOUT: .Core = imports.%Core
  259. // CHECK:STDOUT: .A = %A.decl
  260. // CHECK:STDOUT: .B = %B.decl
  261. // CHECK:STDOUT: .C = %C.decl
  262. // CHECK:STDOUT: .D = %D.decl
  263. // CHECK:STDOUT: .NS = %NS
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %Core.import = import Core
  266. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
  267. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
  268. // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
  269. // CHECK:STDOUT: %b.param_patt: i32 = value_param_pattern %b.patt, runtime_param0
  270. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  271. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  272. // CHECK:STDOUT: } {
  273. // CHECK:STDOUT: %int.make_type_32.loc5_9: init type = call constants.%Int32() [template = i32]
  274. // CHECK:STDOUT: %.loc5_9.1: type = value_of_initializer %int.make_type_32.loc5_9 [template = i32]
  275. // CHECK:STDOUT: %.loc5_9.2: type = converted %int.make_type_32.loc5_9, %.loc5_9.1 [template = i32]
  276. // CHECK:STDOUT: %int.make_type_32.loc5_17: init type = call constants.%Int32() [template = i32]
  277. // CHECK:STDOUT: %.loc5_17.1: type = value_of_initializer %int.make_type_32.loc5_17 [template = i32]
  278. // CHECK:STDOUT: %.loc5_17.2: type = converted %int.make_type_32.loc5_17, %.loc5_17.1 [template = i32]
  279. // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
  280. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  281. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  282. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
  285. // CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
  286. // CHECK:STDOUT: %c.param_patt: %.3 = value_param_pattern %c.patt, runtime_param0
  287. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  288. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  289. // CHECK:STDOUT: } {
  290. // CHECK:STDOUT: %int.make_type_32.loc6_10: init type = call constants.%Int32() [template = i32]
  291. // CHECK:STDOUT: %.loc6_14.1: %.2 = tuple_literal (%int.make_type_32.loc6_10)
  292. // CHECK:STDOUT: %.loc6_14.2: type = value_of_initializer %int.make_type_32.loc6_10 [template = i32]
  293. // CHECK:STDOUT: %.loc6_14.3: type = converted %int.make_type_32.loc6_10, %.loc6_14.2 [template = i32]
  294. // CHECK:STDOUT: %.loc6_14.4: type = converted %.loc6_14.1, constants.%.3 [template = constants.%.3]
  295. // CHECK:STDOUT: %int.make_type_32.loc6_25: init type = call constants.%Int32() [template = i32]
  296. // CHECK:STDOUT: %.loc6_25.1: type = value_of_initializer %int.make_type_32.loc6_25 [template = i32]
  297. // CHECK:STDOUT: %.loc6_25.2: type = converted %int.make_type_32.loc6_25, %.loc6_25.1 [template = i32]
  298. // CHECK:STDOUT: %.loc6_28: type = struct_type {.c: i32} [template = constants.%.4]
  299. // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
  300. // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
  301. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  302. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
  305. // CHECK:STDOUT: %NS: <namespace> = namespace [template] {
  306. // CHECK:STDOUT: .E = %E.decl
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: fn @A();
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: fn @C(%c.param_patt: %.3) -> %.4;
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: extern fn @D();
  320. // CHECK:STDOUT:
  321. // CHECK:STDOUT: fn @E();
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: --- extern_api.carbon
  324. // CHECK:STDOUT:
  325. // CHECK:STDOUT: constants {
  326. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  327. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  328. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  329. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  330. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  331. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  332. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  333. // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
  334. // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
  335. // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
  336. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  337. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  338. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  339. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  340. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  341. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: imports {
  345. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  346. // CHECK:STDOUT: .Int32 = %import_ref
  347. // CHECK:STDOUT: import Core//prelude
  348. // CHECK:STDOUT: import Core//prelude/operators
  349. // CHECK:STDOUT: import Core//prelude/types
  350. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  351. // CHECK:STDOUT: import Core//prelude/operators/as
  352. // CHECK:STDOUT: import Core//prelude/operators/index
  353. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  354. // CHECK:STDOUT: import Core//prelude/operators/comparison
  355. // CHECK:STDOUT: import Core//prelude/types/bool
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: file {
  361. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  362. // CHECK:STDOUT: .Core = imports.%Core
  363. // CHECK:STDOUT: .A = %A.decl
  364. // CHECK:STDOUT: .B = %B.decl
  365. // CHECK:STDOUT: .C = %C.decl
  366. // CHECK:STDOUT: .D = %D.decl
  367. // CHECK:STDOUT: .NS = %NS
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %Core.import = import Core
  370. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
  371. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {
  372. // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
  373. // CHECK:STDOUT: %b.param_patt: i32 = value_param_pattern %b.patt, runtime_param0
  374. // CHECK:STDOUT: %return.patt: i32 = return_slot_pattern
  375. // CHECK:STDOUT: %return.param_patt: i32 = out_param_pattern %return.patt, runtime_param1
  376. // CHECK:STDOUT: } {
  377. // CHECK:STDOUT: %int.make_type_32.loc5_44: init type = call constants.%Int32() [template = i32]
  378. // CHECK:STDOUT: %.loc5_44.1: type = value_of_initializer %int.make_type_32.loc5_44 [template = i32]
  379. // CHECK:STDOUT: %.loc5_44.2: type = converted %int.make_type_32.loc5_44, %.loc5_44.1 [template = i32]
  380. // CHECK:STDOUT: %int.make_type_32.loc5_52: init type = call constants.%Int32() [template = i32]
  381. // CHECK:STDOUT: %.loc5_52.1: type = value_of_initializer %int.make_type_32.loc5_52 [template = i32]
  382. // CHECK:STDOUT: %.loc5_52.2: type = converted %int.make_type_32.loc5_52, %.loc5_52.1 [template = i32]
  383. // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
  384. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  385. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  386. // CHECK:STDOUT: %return: ref i32 = return_slot %return.param
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {
  389. // CHECK:STDOUT: %c.patt: %.3 = binding_pattern c
  390. // CHECK:STDOUT: %c.param_patt: %.3 = value_param_pattern %c.patt, runtime_param0
  391. // CHECK:STDOUT: %return.patt: %.4 = return_slot_pattern
  392. // CHECK:STDOUT: %return.param_patt: %.4 = out_param_pattern %return.patt, runtime_param1
  393. // CHECK:STDOUT: } {
  394. // CHECK:STDOUT: %int.make_type_32.loc6_45: init type = call constants.%Int32() [template = i32]
  395. // CHECK:STDOUT: %.loc6_49.1: %.2 = tuple_literal (%int.make_type_32.loc6_45)
  396. // CHECK:STDOUT: %.loc6_49.2: type = value_of_initializer %int.make_type_32.loc6_45 [template = i32]
  397. // CHECK:STDOUT: %.loc6_49.3: type = converted %int.make_type_32.loc6_45, %.loc6_49.2 [template = i32]
  398. // CHECK:STDOUT: %.loc6_49.4: type = converted %.loc6_49.1, constants.%.3 [template = constants.%.3]
  399. // CHECK:STDOUT: %int.make_type_32.loc6_60: init type = call constants.%Int32() [template = i32]
  400. // CHECK:STDOUT: %.loc6_60.1: type = value_of_initializer %int.make_type_32.loc6_60 [template = i32]
  401. // CHECK:STDOUT: %.loc6_60.2: type = converted %int.make_type_32.loc6_60, %.loc6_60.1 [template = i32]
  402. // CHECK:STDOUT: %.loc6_63: type = struct_type {.c: i32} [template = constants.%.4]
  403. // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
  404. // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
  405. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  406. // CHECK:STDOUT: %return: ref %.4 = return_slot %return.param
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
  409. // CHECK:STDOUT: %NS: <namespace> = namespace [template] {
  410. // CHECK:STDOUT: .E = %E.decl
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: extern fn @A();
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: extern fn @C(%c.param_patt: %.3) -> %.4;
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: extern fn @D();
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: extern fn @E();
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: --- basics.carbon
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: constants {
  430. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  431. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  432. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  433. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  434. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  435. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  436. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  437. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  438. // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
  439. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  440. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  441. // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
  442. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
  443. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  444. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  445. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  446. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: imports {
  450. // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
  451. // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
  452. // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
  453. // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
  454. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
  455. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  456. // CHECK:STDOUT: .E = %import_ref.6
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
  459. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  460. // CHECK:STDOUT: .Int32 = %import_ref.7
  461. // CHECK:STDOUT: import Core//prelude
  462. // CHECK:STDOUT: import Core//prelude/operators
  463. // CHECK:STDOUT: import Core//prelude/types
  464. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  465. // CHECK:STDOUT: import Core//prelude/operators/as
  466. // CHECK:STDOUT: import Core//prelude/operators/index
  467. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  468. // CHECK:STDOUT: import Core//prelude/operators/comparison
  469. // CHECK:STDOUT: import Core//prelude/types/bool
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: file {
  475. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  476. // CHECK:STDOUT: .A = imports.%import_ref.1
  477. // CHECK:STDOUT: .B = imports.%import_ref.2
  478. // CHECK:STDOUT: .C = imports.%import_ref.3
  479. // CHECK:STDOUT: .D = imports.%import_ref.4
  480. // CHECK:STDOUT: .NS = imports.%NS
  481. // CHECK:STDOUT: .Core = imports.%Core
  482. // CHECK:STDOUT: .a = %a
  483. // CHECK:STDOUT: .b = %b
  484. // CHECK:STDOUT: .c = %c
  485. // CHECK:STDOUT: .d = %d
  486. // CHECK:STDOUT: .e = %e
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %Core.import = import Core
  489. // CHECK:STDOUT: %default.import = import <invalid>
  490. // CHECK:STDOUT: %.loc6_9.1: %.1 = tuple_literal ()
  491. // CHECK:STDOUT: %.loc6_9.2: type = converted %.loc6_9.1, constants.%.1 [template = constants.%.1]
  492. // CHECK:STDOUT: %a.var: ref %.1 = var a
  493. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  494. // CHECK:STDOUT: %int.make_type_32.loc7: init type = call constants.%Int32() [template = i32]
  495. // CHECK:STDOUT: %.loc7_8.1: type = value_of_initializer %int.make_type_32.loc7 [template = i32]
  496. // CHECK:STDOUT: %.loc7_8.2: type = converted %int.make_type_32.loc7, %.loc7_8.1 [template = i32]
  497. // CHECK:STDOUT: %b.var: ref i32 = var b
  498. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  499. // CHECK:STDOUT: %int.make_type_32.loc8: init type = call constants.%Int32() [template = i32]
  500. // CHECK:STDOUT: %.loc8_13.1: type = value_of_initializer %int.make_type_32.loc8 [template = i32]
  501. // CHECK:STDOUT: %.loc8_13.2: type = converted %int.make_type_32.loc8, %.loc8_13.1 [template = i32]
  502. // CHECK:STDOUT: %.loc8_16: type = struct_type {.c: i32} [template = constants.%.3]
  503. // CHECK:STDOUT: %c.var: ref %.3 = var c
  504. // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
  505. // CHECK:STDOUT: %.loc9_9.1: %.1 = tuple_literal ()
  506. // CHECK:STDOUT: %.loc9_9.2: type = converted %.loc9_9.1, constants.%.1 [template = constants.%.1]
  507. // CHECK:STDOUT: %d.var: ref %.1 = var d
  508. // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
  509. // CHECK:STDOUT: %.loc10_9.1: %.1 = tuple_literal ()
  510. // CHECK:STDOUT: %.loc10_9.2: type = converted %.loc10_9.1, constants.%.1 [template = constants.%.1]
  511. // CHECK:STDOUT: %e.var: ref %.1 = var e
  512. // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: fn @A();
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: fn @C(%c.param_patt: %.4) -> %.3;
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: extern fn @D();
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: fn @E();
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: fn @__global_init() {
  528. // CHECK:STDOUT: !entry:
  529. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
  530. // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
  531. // CHECK:STDOUT: assign file.%a.var, %A.call
  532. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
  533. // CHECK:STDOUT: %.loc7: i32 = int_literal 1 [template = constants.%.2]
  534. // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc7)
  535. // CHECK:STDOUT: assign file.%b.var, %B.call
  536. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
  537. // CHECK:STDOUT: %.loc8_23: i32 = int_literal 1 [template = constants.%.2]
  538. // CHECK:STDOUT: %.loc8_25.1: %.4 = tuple_literal (%.loc8_23)
  539. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc8_23) [template = constants.%tuple]
  540. // CHECK:STDOUT: %.loc8_25.2: %.4 = converted %.loc8_25.1, %tuple [template = constants.%tuple]
  541. // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc8_25.2)
  542. // CHECK:STDOUT: assign file.%c.var, %C.call
  543. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
  544. // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
  545. // CHECK:STDOUT: assign file.%d.var, %D.call
  546. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  547. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
  548. // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
  549. // CHECK:STDOUT: assign file.%e.var, %E.call
  550. // CHECK:STDOUT: return
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: --- fail_redecl_api.carbon
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: constants {
  556. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  557. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  558. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  559. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  560. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  561. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  562. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  563. // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
  564. // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
  565. // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
  566. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  567. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  568. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  569. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  570. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  571. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  572. // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
  573. // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.5) [template]
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: imports {
  577. // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
  578. // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
  579. // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
  580. // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
  581. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
  582. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  583. // CHECK:STDOUT: .E = file.%E.decl
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
  586. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  587. // CHECK:STDOUT: .Int32 = %import_ref.7
  588. // CHECK:STDOUT: import Core//prelude
  589. // CHECK:STDOUT: import Core//prelude/operators
  590. // CHECK:STDOUT: import Core//prelude/types
  591. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  592. // CHECK:STDOUT: import Core//prelude/operators/as
  593. // CHECK:STDOUT: import Core//prelude/operators/index
  594. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  595. // CHECK:STDOUT: import Core//prelude/operators/comparison
  596. // CHECK:STDOUT: import Core//prelude/types/bool
  597. // CHECK:STDOUT: }
  598. // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: file {
  602. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  603. // CHECK:STDOUT: .A = %A.decl
  604. // CHECK:STDOUT: .B = %B.decl
  605. // CHECK:STDOUT: .C = %C.decl
  606. // CHECK:STDOUT: .D = %D.decl
  607. // CHECK:STDOUT: .NS = imports.%NS
  608. // CHECK:STDOUT: .Core = imports.%Core
  609. // CHECK:STDOUT: .a = %a
  610. // CHECK:STDOUT: .b = %b
  611. // CHECK:STDOUT: .c = %c
  612. // CHECK:STDOUT: .d = %d
  613. // CHECK:STDOUT: .e = %e
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT: %Core.import = import Core
  616. // CHECK:STDOUT: %default.import = import <invalid>
  617. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
  618. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
  619. // CHECK:STDOUT: %int.make_type_32.loc23_16: init type = call constants.%Int32() [template = i32]
  620. // CHECK:STDOUT: %.loc23_16.1: type = value_of_initializer %int.make_type_32.loc23_16 [template = i32]
  621. // CHECK:STDOUT: %.loc23_16.2: type = converted %int.make_type_32.loc23_16, %.loc23_16.1 [template = i32]
  622. // CHECK:STDOUT: %int.make_type_32.loc23_24: init type = call constants.%Int32() [template = i32]
  623. // CHECK:STDOUT: %.loc23_24.1: type = value_of_initializer %int.make_type_32.loc23_24 [template = i32]
  624. // CHECK:STDOUT: %.loc23_24.2: type = converted %int.make_type_32.loc23_24, %.loc23_24.1 [template = i32]
  625. // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
  626. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  627. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  628. // CHECK:STDOUT: %.loc23_21: ref i32 = return_slot %return.param
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
  631. // CHECK:STDOUT: %int.make_type_32.loc32_17: init type = call constants.%Int32() [template = i32]
  632. // CHECK:STDOUT: %.loc32_21.1: %.2 = tuple_literal (%int.make_type_32.loc32_17)
  633. // CHECK:STDOUT: %.loc32_21.2: type = value_of_initializer %int.make_type_32.loc32_17 [template = i32]
  634. // CHECK:STDOUT: %.loc32_21.3: type = converted %int.make_type_32.loc32_17, %.loc32_21.2 [template = i32]
  635. // CHECK:STDOUT: %.loc32_21.4: type = converted %.loc32_21.1, constants.%.3 [template = constants.%.3]
  636. // CHECK:STDOUT: %int.make_type_32.loc32_32: init type = call constants.%Int32() [template = i32]
  637. // CHECK:STDOUT: %.loc32_32.1: type = value_of_initializer %int.make_type_32.loc32_32 [template = i32]
  638. // CHECK:STDOUT: %.loc32_32.2: type = converted %int.make_type_32.loc32_32, %.loc32_32.1 [template = i32]
  639. // CHECK:STDOUT: %.loc32_35: type = struct_type {.c: i32} [template = constants.%.4]
  640. // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
  641. // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
  642. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  643. // CHECK:STDOUT: %.loc32_24: ref %.4 = return_slot %return.param
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
  646. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
  647. // CHECK:STDOUT: %.loc52_9.1: %.1 = tuple_literal ()
  648. // CHECK:STDOUT: %.loc52_9.2: type = converted %.loc52_9.1, constants.%.1 [template = constants.%.1]
  649. // CHECK:STDOUT: %a.var: ref %.1 = var a
  650. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  651. // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
  652. // CHECK:STDOUT: %.loc53_8.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
  653. // CHECK:STDOUT: %.loc53_8.2: type = converted %int.make_type_32.loc53, %.loc53_8.1 [template = i32]
  654. // CHECK:STDOUT: %b.var: ref i32 = var b
  655. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  656. // CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
  657. // CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
  658. // CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
  659. // CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.4]
  660. // CHECK:STDOUT: %c.var: ref %.4 = var c
  661. // CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
  662. // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
  663. // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
  664. // CHECK:STDOUT: %d.var: ref %.1 = var d
  665. // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
  666. // CHECK:STDOUT: %.loc56_9.1: %.1 = tuple_literal ()
  667. // CHECK:STDOUT: %.loc56_9.2: type = converted %.loc56_9.1, constants.%.1 [template = constants.%.1]
  668. // CHECK:STDOUT: %e.var: ref %.1 = var e
  669. // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: fn @A();
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: fn @C(%c.param_patt: %.3) -> %.4;
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: extern fn @D();
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: fn @E();
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: fn @__global_init() {
  685. // CHECK:STDOUT: !entry:
  686. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [template = constants.%A]
  687. // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
  688. // CHECK:STDOUT: assign file.%a.var, %A.call
  689. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
  690. // CHECK:STDOUT: %.loc53: i32 = int_literal 1 [template = constants.%.5]
  691. // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
  692. // CHECK:STDOUT: assign file.%b.var, %B.call
  693. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
  694. // CHECK:STDOUT: %.loc54_23: i32 = int_literal 1 [template = constants.%.5]
  695. // CHECK:STDOUT: %.loc54_25.1: %.3 = tuple_literal (%.loc54_23)
  696. // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.loc54_23) [template = constants.%tuple]
  697. // CHECK:STDOUT: %.loc54_25.2: %.3 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
  698. // CHECK:STDOUT: %C.call: init %.4 = call %C.ref(%.loc54_25.2)
  699. // CHECK:STDOUT: assign file.%c.var, %C.call
  700. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
  701. // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
  702. // CHECK:STDOUT: assign file.%d.var, %D.call
  703. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  704. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [template = constants.%E]
  705. // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
  706. // CHECK:STDOUT: assign file.%e.var, %E.call
  707. // CHECK:STDOUT: return
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: --- redecl_extern_api.carbon
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: constants {
  713. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  714. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  715. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  716. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  717. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  718. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  719. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  720. // CHECK:STDOUT: %.2: type = tuple_type (type) [template]
  721. // CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
  722. // CHECK:STDOUT: %.4: type = struct_type {.c: i32} [template]
  723. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  724. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  725. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  726. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  727. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  728. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  729. // CHECK:STDOUT: %.5: i32 = int_literal 1 [template]
  730. // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.5) [template]
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: imports {
  734. // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
  735. // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+28, loaded [template = constants.%B]
  736. // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+53, loaded [template = constants.%C]
  737. // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+56, loaded [template = constants.%D]
  738. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
  739. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  740. // CHECK:STDOUT: .E = file.%E.decl
  741. // CHECK:STDOUT: }
  742. // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+60, loaded [template = constants.%E]
  743. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  744. // CHECK:STDOUT: .Int32 = %import_ref.7
  745. // CHECK:STDOUT: import Core//prelude
  746. // CHECK:STDOUT: import Core//prelude/operators
  747. // CHECK:STDOUT: import Core//prelude/types
  748. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  749. // CHECK:STDOUT: import Core//prelude/operators/as
  750. // CHECK:STDOUT: import Core//prelude/operators/index
  751. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  752. // CHECK:STDOUT: import Core//prelude/operators/comparison
  753. // CHECK:STDOUT: import Core//prelude/types/bool
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT: %import_ref.7: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  756. // CHECK:STDOUT: }
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: file {
  759. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  760. // CHECK:STDOUT: .A = %A.decl
  761. // CHECK:STDOUT: .B = %B.decl
  762. // CHECK:STDOUT: .C = %C.decl
  763. // CHECK:STDOUT: .D = %D.decl
  764. // CHECK:STDOUT: .NS = imports.%NS
  765. // CHECK:STDOUT: .Core = imports.%Core
  766. // CHECK:STDOUT: .a = %a
  767. // CHECK:STDOUT: .b = %b
  768. // CHECK:STDOUT: .c = %c
  769. // CHECK:STDOUT: .d = %d
  770. // CHECK:STDOUT: .e = %e
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT: %Core.import = import Core
  773. // CHECK:STDOUT: %default.import = import <invalid>
  774. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [template = constants.%A] {} {}
  775. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [template = constants.%B] {} {
  776. // CHECK:STDOUT: %int.make_type_32.loc7_16: init type = call constants.%Int32() [template = i32]
  777. // CHECK:STDOUT: %.loc7_16.1: type = value_of_initializer %int.make_type_32.loc7_16 [template = i32]
  778. // CHECK:STDOUT: %.loc7_16.2: type = converted %int.make_type_32.loc7_16, %.loc7_16.1 [template = i32]
  779. // CHECK:STDOUT: %int.make_type_32.loc7_24: init type = call constants.%Int32() [template = i32]
  780. // CHECK:STDOUT: %.loc7_24.1: type = value_of_initializer %int.make_type_32.loc7_24 [template = i32]
  781. // CHECK:STDOUT: %.loc7_24.2: type = converted %int.make_type_32.loc7_24, %.loc7_24.1 [template = i32]
  782. // CHECK:STDOUT: %b.param: i32 = value_param runtime_param0
  783. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  784. // CHECK:STDOUT: %return.param: ref i32 = out_param runtime_param1
  785. // CHECK:STDOUT: %.loc7_21: ref i32 = return_slot %return.param
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [template = constants.%C] {} {
  788. // CHECK:STDOUT: %int.make_type_32.loc8_17: init type = call constants.%Int32() [template = i32]
  789. // CHECK:STDOUT: %.loc8_21.1: %.2 = tuple_literal (%int.make_type_32.loc8_17)
  790. // CHECK:STDOUT: %.loc8_21.2: type = value_of_initializer %int.make_type_32.loc8_17 [template = i32]
  791. // CHECK:STDOUT: %.loc8_21.3: type = converted %int.make_type_32.loc8_17, %.loc8_21.2 [template = i32]
  792. // CHECK:STDOUT: %.loc8_21.4: type = converted %.loc8_21.1, constants.%.3 [template = constants.%.3]
  793. // CHECK:STDOUT: %int.make_type_32.loc8_32: init type = call constants.%Int32() [template = i32]
  794. // CHECK:STDOUT: %.loc8_32.1: type = value_of_initializer %int.make_type_32.loc8_32 [template = i32]
  795. // CHECK:STDOUT: %.loc8_32.2: type = converted %int.make_type_32.loc8_32, %.loc8_32.1 [template = i32]
  796. // CHECK:STDOUT: %.loc8_35: type = struct_type {.c: i32} [template = constants.%.4]
  797. // CHECK:STDOUT: %c.param: %.3 = value_param runtime_param0
  798. // CHECK:STDOUT: %c: %.3 = bind_name c, %c.param
  799. // CHECK:STDOUT: %return.param: ref %.4 = out_param runtime_param1
  800. // CHECK:STDOUT: %.loc8_24: ref %.4 = return_slot %return.param
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [template = constants.%D] {} {}
  803. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [template = constants.%E] {} {}
  804. // CHECK:STDOUT: %.loc12_9.1: %.1 = tuple_literal ()
  805. // CHECK:STDOUT: %.loc12_9.2: type = converted %.loc12_9.1, constants.%.1 [template = constants.%.1]
  806. // CHECK:STDOUT: %a.var: ref %.1 = var a
  807. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  808. // CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
  809. // CHECK:STDOUT: %.loc13_8.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
  810. // CHECK:STDOUT: %.loc13_8.2: type = converted %int.make_type_32.loc13, %.loc13_8.1 [template = i32]
  811. // CHECK:STDOUT: %b.var: ref i32 = var b
  812. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  813. // CHECK:STDOUT: %int.make_type_32.loc14: init type = call constants.%Int32() [template = i32]
  814. // CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %int.make_type_32.loc14 [template = i32]
  815. // CHECK:STDOUT: %.loc14_13.2: type = converted %int.make_type_32.loc14, %.loc14_13.1 [template = i32]
  816. // CHECK:STDOUT: %.loc14_16: type = struct_type {.c: i32} [template = constants.%.4]
  817. // CHECK:STDOUT: %c.var: ref %.4 = var c
  818. // CHECK:STDOUT: %c: ref %.4 = bind_name c, %c.var
  819. // CHECK:STDOUT: %.loc15_9.1: %.1 = tuple_literal ()
  820. // CHECK:STDOUT: %.loc15_9.2: type = converted %.loc15_9.1, constants.%.1 [template = constants.%.1]
  821. // CHECK:STDOUT: %d.var: ref %.1 = var d
  822. // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
  823. // CHECK:STDOUT: %.loc16_9.1: %.1 = tuple_literal ()
  824. // CHECK:STDOUT: %.loc16_9.2: type = converted %.loc16_9.1, constants.%.1 [template = constants.%.1]
  825. // CHECK:STDOUT: %e.var: ref %.1 = var e
  826. // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: extern fn @A();
  830. // CHECK:STDOUT:
  831. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: extern fn @C(%c.param_patt: %.3) -> %.4;
  836. // CHECK:STDOUT:
  837. // CHECK:STDOUT: extern fn @D();
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: extern fn @E();
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: fn @__global_init() {
  842. // CHECK:STDOUT: !entry:
  843. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [template = constants.%A]
  844. // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
  845. // CHECK:STDOUT: assign file.%a.var, %A.call
  846. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [template = constants.%B]
  847. // CHECK:STDOUT: %.loc13: i32 = int_literal 1 [template = constants.%.5]
  848. // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc13)
  849. // CHECK:STDOUT: assign file.%b.var, %B.call
  850. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [template = constants.%C]
  851. // CHECK:STDOUT: %.loc14_23: i32 = int_literal 1 [template = constants.%.5]
  852. // CHECK:STDOUT: %.loc14_25.1: %.3 = tuple_literal (%.loc14_23)
  853. // CHECK:STDOUT: %tuple: %.3 = tuple_value (%.loc14_23) [template = constants.%tuple]
  854. // CHECK:STDOUT: %.loc14_25.2: %.3 = converted %.loc14_25.1, %tuple [template = constants.%tuple]
  855. // CHECK:STDOUT: %C.call: init %.4 = call %C.ref(%.loc14_25.2)
  856. // CHECK:STDOUT: assign file.%c.var, %C.call
  857. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [template = constants.%D]
  858. // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
  859. // CHECK:STDOUT: assign file.%d.var, %D.call
  860. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  861. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [template = constants.%E]
  862. // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
  863. // CHECK:STDOUT: assign file.%e.var, %E.call
  864. // CHECK:STDOUT: return
  865. // CHECK:STDOUT: }
  866. // CHECK:STDOUT:
  867. // CHECK:STDOUT: --- fail_merge.carbon
  868. // CHECK:STDOUT:
  869. // CHECK:STDOUT: constants {
  870. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  871. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  872. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  873. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  874. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  875. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  876. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  877. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  878. // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
  879. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  880. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  881. // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
  882. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
  883. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  884. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  885. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  886. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  887. // CHECK:STDOUT: }
  888. // CHECK:STDOUT:
  889. // CHECK:STDOUT: imports {
  890. // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//api, inst+3, loaded [template = constants.%A]
  891. // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//api, inst+28, loaded [template = constants.%B]
  892. // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//api, inst+53, loaded [template = constants.%C]
  893. // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//api, inst+56, loaded [template = constants.%D]
  894. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
  895. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  896. // CHECK:STDOUT: .E = %import_ref.6
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//api, inst+60, loaded [template = constants.%E]
  899. // CHECK:STDOUT: %import_ref.7 = import_ref Main//extern_api, inst+3, unloaded
  900. // CHECK:STDOUT: %import_ref.8 = import_ref Main//extern_api, inst+28, unloaded
  901. // CHECK:STDOUT: %import_ref.9 = import_ref Main//extern_api, inst+53, unloaded
  902. // CHECK:STDOUT: %import_ref.10 = import_ref Main//extern_api, inst+56, unloaded
  903. // CHECK:STDOUT: %import_ref.11 = import_ref Main//extern_api, inst+60, unloaded
  904. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  905. // CHECK:STDOUT: .Int32 = %import_ref.12
  906. // CHECK:STDOUT: import Core//prelude
  907. // CHECK:STDOUT: import Core//prelude/operators
  908. // CHECK:STDOUT: import Core//prelude/types
  909. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  910. // CHECK:STDOUT: import Core//prelude/operators/as
  911. // CHECK:STDOUT: import Core//prelude/operators/index
  912. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  913. // CHECK:STDOUT: import Core//prelude/operators/comparison
  914. // CHECK:STDOUT: import Core//prelude/types/bool
  915. // CHECK:STDOUT: }
  916. // CHECK:STDOUT: %import_ref.12: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  917. // CHECK:STDOUT: }
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: file {
  920. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  921. // CHECK:STDOUT: .A = imports.%import_ref.1
  922. // CHECK:STDOUT: .B = imports.%import_ref.2
  923. // CHECK:STDOUT: .C = imports.%import_ref.3
  924. // CHECK:STDOUT: .D = imports.%import_ref.4
  925. // CHECK:STDOUT: .NS = imports.%NS
  926. // CHECK:STDOUT: .Core = imports.%Core
  927. // CHECK:STDOUT: .a = %a
  928. // CHECK:STDOUT: .b = %b
  929. // CHECK:STDOUT: .c = %c
  930. // CHECK:STDOUT: .d = %d
  931. // CHECK:STDOUT: .e = %e
  932. // CHECK:STDOUT: }
  933. // CHECK:STDOUT: %Core.import = import Core
  934. // CHECK:STDOUT: %default.import = import <invalid>
  935. // CHECK:STDOUT: %.loc52_9.1: %.1 = tuple_literal ()
  936. // CHECK:STDOUT: %.loc52_9.2: type = converted %.loc52_9.1, constants.%.1 [template = constants.%.1]
  937. // CHECK:STDOUT: %a.var: ref %.1 = var a
  938. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  939. // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
  940. // CHECK:STDOUT: %.loc53_8.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
  941. // CHECK:STDOUT: %.loc53_8.2: type = converted %int.make_type_32.loc53, %.loc53_8.1 [template = i32]
  942. // CHECK:STDOUT: %b.var: ref i32 = var b
  943. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  944. // CHECK:STDOUT: %int.make_type_32.loc54: init type = call constants.%Int32() [template = i32]
  945. // CHECK:STDOUT: %.loc54_13.1: type = value_of_initializer %int.make_type_32.loc54 [template = i32]
  946. // CHECK:STDOUT: %.loc54_13.2: type = converted %int.make_type_32.loc54, %.loc54_13.1 [template = i32]
  947. // CHECK:STDOUT: %.loc54_16: type = struct_type {.c: i32} [template = constants.%.3]
  948. // CHECK:STDOUT: %c.var: ref %.3 = var c
  949. // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
  950. // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
  951. // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
  952. // CHECK:STDOUT: %d.var: ref %.1 = var d
  953. // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
  954. // CHECK:STDOUT: %.loc56_9.1: %.1 = tuple_literal ()
  955. // CHECK:STDOUT: %.loc56_9.2: type = converted %.loc56_9.1, constants.%.1 [template = constants.%.1]
  956. // CHECK:STDOUT: %e.var: ref %.1 = var e
  957. // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
  958. // CHECK:STDOUT: }
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: fn @A();
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  963. // CHECK:STDOUT:
  964. // CHECK:STDOUT: fn @B(%b.param_patt: i32) -> i32;
  965. // CHECK:STDOUT:
  966. // CHECK:STDOUT: fn @C(%c.param_patt: %.4) -> %.3;
  967. // CHECK:STDOUT:
  968. // CHECK:STDOUT: extern fn @D();
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: fn @E();
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: fn @__global_init() {
  973. // CHECK:STDOUT: !entry:
  974. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
  975. // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
  976. // CHECK:STDOUT: assign file.%a.var, %A.call
  977. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
  978. // CHECK:STDOUT: %.loc53: i32 = int_literal 1 [template = constants.%.2]
  979. // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc53)
  980. // CHECK:STDOUT: assign file.%b.var, %B.call
  981. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
  982. // CHECK:STDOUT: %.loc54_23: i32 = int_literal 1 [template = constants.%.2]
  983. // CHECK:STDOUT: %.loc54_25.1: %.4 = tuple_literal (%.loc54_23)
  984. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc54_23) [template = constants.%tuple]
  985. // CHECK:STDOUT: %.loc54_25.2: %.4 = converted %.loc54_25.1, %tuple [template = constants.%tuple]
  986. // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc54_25.2)
  987. // CHECK:STDOUT: assign file.%c.var, %C.call
  988. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
  989. // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
  990. // CHECK:STDOUT: assign file.%d.var, %D.call
  991. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  992. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
  993. // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
  994. // CHECK:STDOUT: assign file.%e.var, %E.call
  995. // CHECK:STDOUT: return
  996. // CHECK:STDOUT: }
  997. // CHECK:STDOUT:
  998. // CHECK:STDOUT: --- fail_merge_reverse.carbon
  999. // CHECK:STDOUT:
  1000. // CHECK:STDOUT: constants {
  1001. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  1002. // CHECK:STDOUT: %A.type: type = fn_type @A [template]
  1003. // CHECK:STDOUT: %A: %A.type = struct_value () [template]
  1004. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  1005. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  1006. // CHECK:STDOUT: %B.type: type = fn_type @B [template]
  1007. // CHECK:STDOUT: %B: %B.type = struct_value () [template]
  1008. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  1009. // CHECK:STDOUT: %.3: type = struct_type {.c: i32} [template]
  1010. // CHECK:STDOUT: %C.type: type = fn_type @C [template]
  1011. // CHECK:STDOUT: %C: %C.type = struct_value () [template]
  1012. // CHECK:STDOUT: %.4: type = tuple_type (i32) [template]
  1013. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.2) [template]
  1014. // CHECK:STDOUT: %D.type: type = fn_type @D [template]
  1015. // CHECK:STDOUT: %D: %D.type = struct_value () [template]
  1016. // CHECK:STDOUT: %E.type: type = fn_type @E [template]
  1017. // CHECK:STDOUT: %E: %E.type = struct_value () [template]
  1018. // CHECK:STDOUT: }
  1019. // CHECK:STDOUT:
  1020. // CHECK:STDOUT: imports {
  1021. // CHECK:STDOUT: %import_ref.1: %A.type = import_ref Main//extern_api, inst+3, loaded [template = constants.%A]
  1022. // CHECK:STDOUT: %import_ref.2: %B.type = import_ref Main//extern_api, inst+28, loaded [template = constants.%B]
  1023. // CHECK:STDOUT: %import_ref.3: %C.type = import_ref Main//extern_api, inst+53, loaded [template = constants.%C]
  1024. // CHECK:STDOUT: %import_ref.4: %D.type = import_ref Main//extern_api, inst+56, loaded [template = constants.%D]
  1025. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
  1026. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  1027. // CHECK:STDOUT: .E = %import_ref.6
  1028. // CHECK:STDOUT: }
  1029. // CHECK:STDOUT: %import_ref.6: %E.type = import_ref Main//extern_api, inst+60, loaded [template = constants.%E]
  1030. // CHECK:STDOUT: %import_ref.7 = import_ref Main//api, inst+3, unloaded
  1031. // CHECK:STDOUT: %import_ref.8 = import_ref Main//api, inst+28, unloaded
  1032. // CHECK:STDOUT: %import_ref.9 = import_ref Main//api, inst+53, unloaded
  1033. // CHECK:STDOUT: %import_ref.10 = import_ref Main//api, inst+56, unloaded
  1034. // CHECK:STDOUT: %import_ref.11 = import_ref Main//api, inst+60, unloaded
  1035. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1036. // CHECK:STDOUT: .Int32 = %import_ref.12
  1037. // CHECK:STDOUT: import Core//prelude
  1038. // CHECK:STDOUT: import Core//prelude/operators
  1039. // CHECK:STDOUT: import Core//prelude/types
  1040. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1041. // CHECK:STDOUT: import Core//prelude/operators/as
  1042. // CHECK:STDOUT: import Core//prelude/operators/index
  1043. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1044. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1045. // CHECK:STDOUT: import Core//prelude/types/bool
  1046. // CHECK:STDOUT: }
  1047. // CHECK:STDOUT: %import_ref.12: %Int32.type = import_ref Core//prelude/types, inst+15, loaded [template = constants.%Int32]
  1048. // CHECK:STDOUT: }
  1049. // CHECK:STDOUT:
  1050. // CHECK:STDOUT: file {
  1051. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1052. // CHECK:STDOUT: .A = imports.%import_ref.1
  1053. // CHECK:STDOUT: .B = imports.%import_ref.2
  1054. // CHECK:STDOUT: .C = imports.%import_ref.3
  1055. // CHECK:STDOUT: .D = imports.%import_ref.4
  1056. // CHECK:STDOUT: .NS = imports.%NS
  1057. // CHECK:STDOUT: .Core = imports.%Core
  1058. // CHECK:STDOUT: .a = %a
  1059. // CHECK:STDOUT: .b = %b
  1060. // CHECK:STDOUT: .c = %c
  1061. // CHECK:STDOUT: .d = %d
  1062. // CHECK:STDOUT: .e = %e
  1063. // CHECK:STDOUT: }
  1064. // CHECK:STDOUT: %Core.import = import Core
  1065. // CHECK:STDOUT: %default.import = import <invalid>
  1066. // CHECK:STDOUT: %.loc51_9.1: %.1 = tuple_literal ()
  1067. // CHECK:STDOUT: %.loc51_9.2: type = converted %.loc51_9.1, constants.%.1 [template = constants.%.1]
  1068. // CHECK:STDOUT: %a.var: ref %.1 = var a
  1069. // CHECK:STDOUT: %a: ref %.1 = bind_name a, %a.var
  1070. // CHECK:STDOUT: %int.make_type_32.loc52: init type = call constants.%Int32() [template = i32]
  1071. // CHECK:STDOUT: %.loc52_8.1: type = value_of_initializer %int.make_type_32.loc52 [template = i32]
  1072. // CHECK:STDOUT: %.loc52_8.2: type = converted %int.make_type_32.loc52, %.loc52_8.1 [template = i32]
  1073. // CHECK:STDOUT: %b.var: ref i32 = var b
  1074. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  1075. // CHECK:STDOUT: %int.make_type_32.loc53: init type = call constants.%Int32() [template = i32]
  1076. // CHECK:STDOUT: %.loc53_13.1: type = value_of_initializer %int.make_type_32.loc53 [template = i32]
  1077. // CHECK:STDOUT: %.loc53_13.2: type = converted %int.make_type_32.loc53, %.loc53_13.1 [template = i32]
  1078. // CHECK:STDOUT: %.loc53_16: type = struct_type {.c: i32} [template = constants.%.3]
  1079. // CHECK:STDOUT: %c.var: ref %.3 = var c
  1080. // CHECK:STDOUT: %c: ref %.3 = bind_name c, %c.var
  1081. // CHECK:STDOUT: %.loc54_9.1: %.1 = tuple_literal ()
  1082. // CHECK:STDOUT: %.loc54_9.2: type = converted %.loc54_9.1, constants.%.1 [template = constants.%.1]
  1083. // CHECK:STDOUT: %d.var: ref %.1 = var d
  1084. // CHECK:STDOUT: %d: ref %.1 = bind_name d, %d.var
  1085. // CHECK:STDOUT: %.loc55_9.1: %.1 = tuple_literal ()
  1086. // CHECK:STDOUT: %.loc55_9.2: type = converted %.loc55_9.1, constants.%.1 [template = constants.%.1]
  1087. // CHECK:STDOUT: %e.var: ref %.1 = var e
  1088. // CHECK:STDOUT: %e: ref %.1 = bind_name e, %e.var
  1089. // CHECK:STDOUT: }
  1090. // CHECK:STDOUT:
  1091. // CHECK:STDOUT: extern fn @A();
  1092. // CHECK:STDOUT:
  1093. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  1094. // CHECK:STDOUT:
  1095. // CHECK:STDOUT: extern fn @B(%b.param_patt: i32) -> i32;
  1096. // CHECK:STDOUT:
  1097. // CHECK:STDOUT: extern fn @C(%c.param_patt: %.4) -> %.3;
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: extern fn @D();
  1100. // CHECK:STDOUT:
  1101. // CHECK:STDOUT: extern fn @E();
  1102. // CHECK:STDOUT:
  1103. // CHECK:STDOUT: fn @__global_init() {
  1104. // CHECK:STDOUT: !entry:
  1105. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%import_ref.1 [template = constants.%A]
  1106. // CHECK:STDOUT: %A.call: init %.1 = call %A.ref()
  1107. // CHECK:STDOUT: assign file.%a.var, %A.call
  1108. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%import_ref.2 [template = constants.%B]
  1109. // CHECK:STDOUT: %.loc52: i32 = int_literal 1 [template = constants.%.2]
  1110. // CHECK:STDOUT: %B.call: init i32 = call %B.ref(%.loc52)
  1111. // CHECK:STDOUT: assign file.%b.var, %B.call
  1112. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.3 [template = constants.%C]
  1113. // CHECK:STDOUT: %.loc53_23: i32 = int_literal 1 [template = constants.%.2]
  1114. // CHECK:STDOUT: %.loc53_25.1: %.4 = tuple_literal (%.loc53_23)
  1115. // CHECK:STDOUT: %tuple: %.4 = tuple_value (%.loc53_23) [template = constants.%tuple]
  1116. // CHECK:STDOUT: %.loc53_25.2: %.4 = converted %.loc53_25.1, %tuple [template = constants.%tuple]
  1117. // CHECK:STDOUT: %C.call: init %.3 = call %C.ref(%.loc53_25.2)
  1118. // CHECK:STDOUT: assign file.%c.var, %C.call
  1119. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%import_ref.4 [template = constants.%D]
  1120. // CHECK:STDOUT: %D.call: init %.1 = call %D.ref()
  1121. // CHECK:STDOUT: assign file.%d.var, %D.call
  1122. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [template = imports.%NS]
  1123. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%import_ref.6 [template = constants.%E]
  1124. // CHECK:STDOUT: %E.call: init %.1 = call %E.ref()
  1125. // CHECK:STDOUT: assign file.%e.var, %E.call
  1126. // CHECK:STDOUT: return
  1127. // CHECK:STDOUT: }
  1128. // CHECK:STDOUT:
  1129. // CHECK:STDOUT: --- unloaded.carbon
  1130. // CHECK:STDOUT:
  1131. // CHECK:STDOUT: imports {
  1132. // CHECK:STDOUT: %import_ref.1 = import_ref Main//api, inst+3, unloaded
  1133. // CHECK:STDOUT: %import_ref.2 = import_ref Main//api, inst+28, unloaded
  1134. // CHECK:STDOUT: %import_ref.3 = import_ref Main//api, inst+53, unloaded
  1135. // CHECK:STDOUT: %import_ref.4 = import_ref Main//api, inst+56, unloaded
  1136. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//api, inst+59, loaded
  1137. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  1138. // CHECK:STDOUT: .E = %import_ref.6
  1139. // CHECK:STDOUT: }
  1140. // CHECK:STDOUT: %import_ref.6 = import_ref Main//api, inst+60, unloaded
  1141. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1142. // CHECK:STDOUT: import Core//prelude
  1143. // CHECK:STDOUT: import Core//prelude/operators
  1144. // CHECK:STDOUT: import Core//prelude/types
  1145. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1146. // CHECK:STDOUT: import Core//prelude/operators/as
  1147. // CHECK:STDOUT: import Core//prelude/operators/index
  1148. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1149. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1150. // CHECK:STDOUT: import Core//prelude/types/bool
  1151. // CHECK:STDOUT: }
  1152. // CHECK:STDOUT: }
  1153. // CHECK:STDOUT:
  1154. // CHECK:STDOUT: file {
  1155. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1156. // CHECK:STDOUT: .A = imports.%import_ref.1
  1157. // CHECK:STDOUT: .B = imports.%import_ref.2
  1158. // CHECK:STDOUT: .C = imports.%import_ref.3
  1159. // CHECK:STDOUT: .D = imports.%import_ref.4
  1160. // CHECK:STDOUT: .NS = imports.%NS
  1161. // CHECK:STDOUT: .Core = imports.%Core
  1162. // CHECK:STDOUT: }
  1163. // CHECK:STDOUT: %Core.import = import Core
  1164. // CHECK:STDOUT: %default.import = import <invalid>
  1165. // CHECK:STDOUT: }
  1166. // CHECK:STDOUT:
  1167. // CHECK:STDOUT: --- unloaded_extern.carbon
  1168. // CHECK:STDOUT:
  1169. // CHECK:STDOUT: imports {
  1170. // CHECK:STDOUT: %import_ref.1 = import_ref Main//extern_api, inst+3, unloaded
  1171. // CHECK:STDOUT: %import_ref.2 = import_ref Main//extern_api, inst+28, unloaded
  1172. // CHECK:STDOUT: %import_ref.3 = import_ref Main//extern_api, inst+53, unloaded
  1173. // CHECK:STDOUT: %import_ref.4 = import_ref Main//extern_api, inst+56, unloaded
  1174. // CHECK:STDOUT: %import_ref.5: <namespace> = import_ref Main//extern_api, inst+59, loaded
  1175. // CHECK:STDOUT: %NS: <namespace> = namespace %import_ref.5, [template] {
  1176. // CHECK:STDOUT: .E = %import_ref.6
  1177. // CHECK:STDOUT: }
  1178. // CHECK:STDOUT: %import_ref.6 = import_ref Main//extern_api, inst+60, unloaded
  1179. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  1180. // CHECK:STDOUT: import Core//prelude
  1181. // CHECK:STDOUT: import Core//prelude/operators
  1182. // CHECK:STDOUT: import Core//prelude/types
  1183. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  1184. // CHECK:STDOUT: import Core//prelude/operators/as
  1185. // CHECK:STDOUT: import Core//prelude/operators/index
  1186. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  1187. // CHECK:STDOUT: import Core//prelude/operators/comparison
  1188. // CHECK:STDOUT: import Core//prelude/types/bool
  1189. // CHECK:STDOUT: }
  1190. // CHECK:STDOUT: }
  1191. // CHECK:STDOUT:
  1192. // CHECK:STDOUT: file {
  1193. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  1194. // CHECK:STDOUT: .A = imports.%import_ref.1
  1195. // CHECK:STDOUT: .B = imports.%import_ref.2
  1196. // CHECK:STDOUT: .C = imports.%import_ref.3
  1197. // CHECK:STDOUT: .D = imports.%import_ref.4
  1198. // CHECK:STDOUT: .NS = imports.%NS
  1199. // CHECK:STDOUT: .Core = imports.%Core
  1200. // CHECK:STDOUT: }
  1201. // CHECK:STDOUT: %Core.import = import Core
  1202. // CHECK:STDOUT: %default.import = import <invalid>
  1203. // CHECK:STDOUT: }
  1204. // CHECK:STDOUT: