import.carbon 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411
  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 `A` 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 `B` 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 `C` 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 `D` 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 `E` 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+45]]:1: in import [InImport]
  163. // CHECK:STDERR: api.carbon:4:1: error: duplicate name `A` being declared in the same scope [NameDeclDuplicate]
  164. // CHECK:STDERR: fn A();
  165. // CHECK:STDERR: ^~~~~~~
  166. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+41]]: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+36]]:1: in import [InImport]
  172. // CHECK:STDERR: api.carbon:5:1: error: duplicate name `B` 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+32]]: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+27]]:1: in import [InImport]
  181. // CHECK:STDERR: api.carbon:6:1: error: duplicate name `C` 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+23]]: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+18]]:1: in import [InImport]
  190. // CHECK:STDERR: api.carbon:7:1: error: duplicate name `D` being declared in the same scope [NameDeclDuplicate]
  191. // CHECK:STDERR: extern fn D();
  192. // CHECK:STDERR: ^~~~~~~~~~~~~~
  193. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+14]]: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+9]]:1: in import [InImport]
  199. // CHECK:STDERR: api.carbon:10:1: error: duplicate name `E` being declared in the same scope [NameDeclDuplicate]
  200. // CHECK:STDERR: fn NS.E();
  201. // CHECK:STDERR: ^~~~~~~~~~
  202. // CHECK:STDERR: fail_merge_reverse.carbon:[[@LINE+5]]: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. // CHECK:STDERR:
  207. import library "extern_api";
  208. import library "api";
  209. var a: () = A();
  210. var b: i32 = B(1);
  211. var c: {.c: i32} = C((1,));
  212. var d: () = D();
  213. var e: () = NS.E();
  214. // --- unloaded.carbon
  215. library "[[@TEST_NAME]]";
  216. import library "api";
  217. // --- unloaded_extern.carbon
  218. library "[[@TEST_NAME]]";
  219. import library "extern_api";
  220. // CHECK:STDOUT: --- api.carbon
  221. // CHECK:STDOUT:
  222. // CHECK:STDOUT: constants {
  223. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  224. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  225. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  226. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  227. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  228. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  229. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  230. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  231. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  232. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  233. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  234. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  235. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  236. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  237. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: imports {
  241. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  242. // CHECK:STDOUT: .Int = %Core.Int
  243. // CHECK:STDOUT: import Core//prelude
  244. // CHECK:STDOUT: import Core//prelude/...
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: file {
  249. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  250. // CHECK:STDOUT: .Core = imports.%Core
  251. // CHECK:STDOUT: .A = %A.decl
  252. // CHECK:STDOUT: .B = %B.decl
  253. // CHECK:STDOUT: .C = %C.decl
  254. // CHECK:STDOUT: .D = %D.decl
  255. // CHECK:STDOUT: .NS = %NS
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT: %Core.import = import Core
  258. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  259. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {
  260. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  261. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, call_param0
  262. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  263. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, call_param1
  264. // CHECK:STDOUT: } {
  265. // CHECK:STDOUT: %int_32.loc5_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  266. // CHECK:STDOUT: %i32.loc5_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  267. // CHECK:STDOUT: %b.param: %i32 = value_param call_param0
  268. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5_9 [concrete = constants.%i32] {
  269. // CHECK:STDOUT: %int_32.loc5_9: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  270. // CHECK:STDOUT: %i32.loc5_9: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  273. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  274. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {
  277. // CHECK:STDOUT: %c.patt: %tuple.type.a1c = binding_pattern c
  278. // CHECK:STDOUT: %c.param_patt: %tuple.type.a1c = value_param_pattern %c.patt, call_param0
  279. // CHECK:STDOUT: %return.patt: %struct_type.c = return_slot_pattern
  280. // CHECK:STDOUT: %return.param_patt: %struct_type.c = out_param_pattern %return.patt, call_param1
  281. // CHECK:STDOUT: } {
  282. // CHECK:STDOUT: %int_32.loc6_25: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  283. // CHECK:STDOUT: %i32.loc6_25: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  284. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  285. // CHECK:STDOUT: %c.param: %tuple.type.a1c = value_param call_param0
  286. // CHECK:STDOUT: %.loc6_14.1: type = splice_block %.loc6_14.3 [concrete = constants.%tuple.type.a1c] {
  287. // CHECK:STDOUT: %int_32.loc6_10: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  288. // CHECK:STDOUT: %i32.loc6_10: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  289. // CHECK:STDOUT: %.loc6_14.2: %tuple.type.85c = tuple_literal (%i32.loc6_10)
  290. // CHECK:STDOUT: %.loc6_14.3: type = converted %.loc6_14.2, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c]
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: %c: %tuple.type.a1c = bind_name c, %c.param
  293. // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1
  294. // CHECK:STDOUT: %return: ref %struct_type.c = return_slot %return.param
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {}
  297. // CHECK:STDOUT: %NS: <namespace> = namespace [concrete] {
  298. // CHECK:STDOUT: .E = %E.decl
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {}
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT:
  303. // CHECK:STDOUT: fn @A();
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: fn @B(%b.param_patt: %i32) -> %i32;
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c;
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: extern fn @D();
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: fn @E();
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: --- extern_api.carbon
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: constants {
  316. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  317. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  318. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  319. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  320. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  321. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  322. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  323. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  324. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  325. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  326. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  327. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  328. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  329. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  330. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: imports {
  334. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  335. // CHECK:STDOUT: .Int = %Core.Int
  336. // CHECK:STDOUT: import Core//prelude
  337. // CHECK:STDOUT: import Core//prelude/...
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT: }
  340. // CHECK:STDOUT:
  341. // CHECK:STDOUT: file {
  342. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  343. // CHECK:STDOUT: .Core = imports.%Core
  344. // CHECK:STDOUT: .A = %A.decl
  345. // CHECK:STDOUT: .B = %B.decl
  346. // CHECK:STDOUT: .C = %C.decl
  347. // CHECK:STDOUT: .D = %D.decl
  348. // CHECK:STDOUT: .NS = %NS
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT: %Core.import = import Core
  351. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  352. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {
  353. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  354. // CHECK:STDOUT: %b.param_patt: %i32 = value_param_pattern %b.patt, call_param0
  355. // CHECK:STDOUT: %return.patt: %i32 = return_slot_pattern
  356. // CHECK:STDOUT: %return.param_patt: %i32 = out_param_pattern %return.patt, call_param1
  357. // CHECK:STDOUT: } {
  358. // CHECK:STDOUT: %int_32.loc5_52: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  359. // CHECK:STDOUT: %i32.loc5_52: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  360. // CHECK:STDOUT: %b.param: %i32 = value_param call_param0
  361. // CHECK:STDOUT: %.loc5: type = splice_block %i32.loc5_44 [concrete = constants.%i32] {
  362. // CHECK:STDOUT: %int_32.loc5_44: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  363. // CHECK:STDOUT: %i32.loc5_44: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  366. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  367. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {
  370. // CHECK:STDOUT: %c.patt: %tuple.type.a1c = binding_pattern c
  371. // CHECK:STDOUT: %c.param_patt: %tuple.type.a1c = value_param_pattern %c.patt, call_param0
  372. // CHECK:STDOUT: %return.patt: %struct_type.c = return_slot_pattern
  373. // CHECK:STDOUT: %return.param_patt: %struct_type.c = out_param_pattern %return.patt, call_param1
  374. // CHECK:STDOUT: } {
  375. // CHECK:STDOUT: %int_32.loc6_60: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  376. // CHECK:STDOUT: %i32.loc6_60: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  377. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  378. // CHECK:STDOUT: %c.param: %tuple.type.a1c = value_param call_param0
  379. // CHECK:STDOUT: %.loc6_49.1: type = splice_block %.loc6_49.3 [concrete = constants.%tuple.type.a1c] {
  380. // CHECK:STDOUT: %int_32.loc6_45: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  381. // CHECK:STDOUT: %i32.loc6_45: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  382. // CHECK:STDOUT: %.loc6_49.2: %tuple.type.85c = tuple_literal (%i32.loc6_45)
  383. // CHECK:STDOUT: %.loc6_49.3: type = converted %.loc6_49.2, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c]
  384. // CHECK:STDOUT: }
  385. // CHECK:STDOUT: %c: %tuple.type.a1c = bind_name c, %c.param
  386. // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1
  387. // CHECK:STDOUT: %return: ref %struct_type.c = return_slot %return.param
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {}
  390. // CHECK:STDOUT: %NS: <namespace> = namespace [concrete] {
  391. // CHECK:STDOUT: .E = %E.decl
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {}
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: extern fn @A();
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: extern fn @B(%b.param_patt: %i32) -> %i32;
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: extern fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c;
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: extern fn @D();
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: extern fn @E();
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: --- basics.carbon
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: constants {
  409. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  410. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  411. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  412. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  413. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  414. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  415. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  416. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  417. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  418. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  419. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  420. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  421. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  422. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%impl_witness.d39) [concrete]
  423. // CHECK:STDOUT: %.be7: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  424. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  425. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  426. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  427. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  428. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  429. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  430. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  431. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  432. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  433. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_1.5d2) [concrete]
  434. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  435. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  436. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  437. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: imports {
  441. // CHECK:STDOUT: %Main.A: %A.type = import_ref Main//api, A, loaded [concrete = constants.%A]
  442. // CHECK:STDOUT: %Main.B: %B.type = import_ref Main//api, B, loaded [concrete = constants.%B]
  443. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//api, C, loaded [concrete = constants.%C]
  444. // CHECK:STDOUT: %Main.D: %D.type = import_ref Main//api, D, loaded [concrete = constants.%D]
  445. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//api, NS, loaded
  446. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  447. // CHECK:STDOUT: .E = %Main.E
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: %Main.E: %E.type = import_ref Main//api, E, loaded [concrete = constants.%E]
  450. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  451. // CHECK:STDOUT: .Int = %Core.Int
  452. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  453. // CHECK:STDOUT: import Core//prelude
  454. // CHECK:STDOUT: import Core//prelude/...
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: file {
  459. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  460. // CHECK:STDOUT: .A = imports.%Main.A
  461. // CHECK:STDOUT: .B = imports.%Main.B
  462. // CHECK:STDOUT: .C = imports.%Main.C
  463. // CHECK:STDOUT: .D = imports.%Main.D
  464. // CHECK:STDOUT: .NS = imports.%NS
  465. // CHECK:STDOUT: .Core = imports.%Core
  466. // CHECK:STDOUT: .a = %a
  467. // CHECK:STDOUT: .b = %b
  468. // CHECK:STDOUT: .c = %c
  469. // CHECK:STDOUT: .d = %d
  470. // CHECK:STDOUT: .e = %e
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT: %Core.import = import Core
  473. // CHECK:STDOUT: %default.import = import <none>
  474. // CHECK:STDOUT: name_binding_decl {
  475. // CHECK:STDOUT: %a.patt: %empty_tuple.type = binding_pattern a
  476. // CHECK:STDOUT: %.loc6_1: %empty_tuple.type = var_pattern %a.patt
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
  479. // CHECK:STDOUT: %.loc6_9.1: type = splice_block %.loc6_9.3 [concrete = constants.%empty_tuple.type] {
  480. // CHECK:STDOUT: %.loc6_9.2: %empty_tuple.type = tuple_literal ()
  481. // CHECK:STDOUT: %.loc6_9.3: type = converted %.loc6_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
  484. // CHECK:STDOUT: name_binding_decl {
  485. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  486. // CHECK:STDOUT: %.loc7_1: %i32 = var_pattern %b.patt
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %b.var: ref %i32 = var b
  489. // CHECK:STDOUT: %.loc7_8: type = splice_block %i32.loc7 [concrete = constants.%i32] {
  490. // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  491. // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
  494. // CHECK:STDOUT: name_binding_decl {
  495. // CHECK:STDOUT: %c.patt: %struct_type.c = binding_pattern c
  496. // CHECK:STDOUT: %.loc8_1: %struct_type.c = var_pattern %c.patt
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT: %c.var: ref %struct_type.c = var c
  499. // CHECK:STDOUT: %.loc8_16: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] {
  500. // CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  501. // CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  502. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT: %c: ref %struct_type.c = bind_name c, %c.var
  505. // CHECK:STDOUT: name_binding_decl {
  506. // CHECK:STDOUT: %d.patt: %empty_tuple.type = binding_pattern d
  507. // CHECK:STDOUT: %.loc9_1: %empty_tuple.type = var_pattern %d.patt
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
  510. // CHECK:STDOUT: %.loc9_9.1: type = splice_block %.loc9_9.3 [concrete = constants.%empty_tuple.type] {
  511. // CHECK:STDOUT: %.loc9_9.2: %empty_tuple.type = tuple_literal ()
  512. // CHECK:STDOUT: %.loc9_9.3: type = converted %.loc9_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var
  515. // CHECK:STDOUT: name_binding_decl {
  516. // CHECK:STDOUT: %e.patt: %empty_tuple.type = binding_pattern e
  517. // CHECK:STDOUT: %.loc10_1: %empty_tuple.type = var_pattern %e.patt
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var e
  520. // CHECK:STDOUT: %.loc10_9.1: type = splice_block %.loc10_9.3 [concrete = constants.%empty_tuple.type] {
  521. // CHECK:STDOUT: %.loc10_9.2: %empty_tuple.type = tuple_literal ()
  522. // CHECK:STDOUT: %.loc10_9.3: type = converted %.loc10_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  523. // CHECK:STDOUT: }
  524. // CHECK:STDOUT: %e: ref %empty_tuple.type = bind_name e, %e.var
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: fn @A() [from "api.carbon"];
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: fn @B(%b.param_patt: %i32) -> %i32 [from "api.carbon"];
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c [from "api.carbon"];
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: extern fn @D() [from "api.carbon"];
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: fn @E() [from "api.carbon"];
  536. // CHECK:STDOUT:
  537. // CHECK:STDOUT: fn @__global_init() {
  538. // CHECK:STDOUT: !entry:
  539. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%Main.A [concrete = constants.%A]
  540. // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
  541. // CHECK:STDOUT: assign file.%a.var, %A.call
  542. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B]
  543. // CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  544. // CHECK:STDOUT: %impl.elem0.loc7: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  545. // CHECK:STDOUT: %bound_method.loc7_16.1: <bound method> = bound_method %int_1.loc7, %impl.elem0.loc7 [concrete = constants.%Convert.bound]
  546. // CHECK:STDOUT: %specific_fn.loc7: <specific function> = specific_function %impl.elem0.loc7, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  547. // CHECK:STDOUT: %bound_method.loc7_16.2: <bound method> = bound_method %int_1.loc7, %specific_fn.loc7 [concrete = constants.%bound_method]
  548. // CHECK:STDOUT: %int.convert_checked.loc7: init %i32 = call %bound_method.loc7_16.2(%int_1.loc7) [concrete = constants.%int_1.5d2]
  549. // CHECK:STDOUT: %.loc7_16.1: %i32 = value_of_initializer %int.convert_checked.loc7 [concrete = constants.%int_1.5d2]
  550. // CHECK:STDOUT: %.loc7_16.2: %i32 = converted %int_1.loc7, %.loc7_16.1 [concrete = constants.%int_1.5d2]
  551. // CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc7_16.2)
  552. // CHECK:STDOUT: assign file.%b.var, %B.call
  553. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C]
  554. // CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  555. // CHECK:STDOUT: %.loc8_25.1: %tuple.type.985 = tuple_literal (%int_1.loc8)
  556. // CHECK:STDOUT: %impl.elem0.loc8: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  557. // CHECK:STDOUT: %bound_method.loc8_25.1: <bound method> = bound_method %int_1.loc8, %impl.elem0.loc8 [concrete = constants.%Convert.bound]
  558. // CHECK:STDOUT: %specific_fn.loc8: <specific function> = specific_function %impl.elem0.loc8, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  559. // CHECK:STDOUT: %bound_method.loc8_25.2: <bound method> = bound_method %int_1.loc8, %specific_fn.loc8 [concrete = constants.%bound_method]
  560. // CHECK:STDOUT: %int.convert_checked.loc8: init %i32 = call %bound_method.loc8_25.2(%int_1.loc8) [concrete = constants.%int_1.5d2]
  561. // CHECK:STDOUT: %.loc8_25.2: %i32 = value_of_initializer %int.convert_checked.loc8 [concrete = constants.%int_1.5d2]
  562. // CHECK:STDOUT: %.loc8_25.3: %i32 = converted %int_1.loc8, %.loc8_25.2 [concrete = constants.%int_1.5d2]
  563. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%.loc8_25.3) [concrete = constants.%tuple]
  564. // CHECK:STDOUT: %.loc8_25.4: %tuple.type.a1c = converted %.loc8_25.1, %tuple [concrete = constants.%tuple]
  565. // CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc8_25.4)
  566. // CHECK:STDOUT: assign file.%c.var, %C.call
  567. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D]
  568. // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
  569. // CHECK:STDOUT: assign file.%d.var, %D.call
  570. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [concrete = imports.%NS]
  571. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%Main.E [concrete = constants.%E]
  572. // CHECK:STDOUT: %E.call: init %empty_tuple.type = call %E.ref()
  573. // CHECK:STDOUT: assign file.%e.var, %E.call
  574. // CHECK:STDOUT: return
  575. // CHECK:STDOUT: }
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: --- fail_redecl_api.carbon
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: constants {
  580. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  581. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  582. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  583. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  584. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  585. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  586. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  587. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  588. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  589. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  590. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  591. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  592. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  593. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  594. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  595. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  596. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  597. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  598. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  599. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  600. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  601. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  602. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%impl_witness.d39) [concrete]
  603. // CHECK:STDOUT: %.be7: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  604. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  605. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  606. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  607. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  608. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  609. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_1.5d2) [concrete]
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: imports {
  613. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//api, NS, loaded
  614. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  615. // CHECK:STDOUT: .E = file.%E.decl
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  618. // CHECK:STDOUT: .Int = %Core.Int
  619. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  620. // CHECK:STDOUT: import Core//prelude
  621. // CHECK:STDOUT: import Core//prelude/...
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: file {
  626. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  627. // CHECK:STDOUT: .A = %A.decl
  628. // CHECK:STDOUT: .B = %B.decl
  629. // CHECK:STDOUT: .C = %C.decl
  630. // CHECK:STDOUT: .D = %D.decl
  631. // CHECK:STDOUT: .NS = imports.%NS
  632. // CHECK:STDOUT: .Core = imports.%Core
  633. // CHECK:STDOUT: .a = %a
  634. // CHECK:STDOUT: .b = %b
  635. // CHECK:STDOUT: .c = %c
  636. // CHECK:STDOUT: .d = %d
  637. // CHECK:STDOUT: .e = %e
  638. // CHECK:STDOUT: }
  639. // CHECK:STDOUT: %Core.import = import Core
  640. // CHECK:STDOUT: %default.import = import <none>
  641. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  642. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {
  643. // CHECK:STDOUT: %int_32.loc23_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  644. // CHECK:STDOUT: %i32.loc23_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  645. // CHECK:STDOUT: %b.param: %i32 = value_param call_param0
  646. // CHECK:STDOUT: %.loc23: type = splice_block %i32.loc23_16 [concrete = constants.%i32] {
  647. // CHECK:STDOUT: %int_32.loc23_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  648. // CHECK:STDOUT: %i32.loc23_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  649. // CHECK:STDOUT: }
  650. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  651. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  652. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {} {
  655. // CHECK:STDOUT: %int_32.loc32_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  656. // CHECK:STDOUT: %i32.loc32_32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  657. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  658. // CHECK:STDOUT: %c.param: %tuple.type.a1c = value_param call_param0
  659. // CHECK:STDOUT: %.loc32_21.1: type = splice_block %.loc32_21.3 [concrete = constants.%tuple.type.a1c] {
  660. // CHECK:STDOUT: %int_32.loc32_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  661. // CHECK:STDOUT: %i32.loc32_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  662. // CHECK:STDOUT: %.loc32_21.2: %tuple.type.85c = tuple_literal (%i32.loc32_17)
  663. // CHECK:STDOUT: %.loc32_21.3: type = converted %.loc32_21.2, constants.%tuple.type.a1c [concrete = constants.%tuple.type.a1c]
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: %c: %tuple.type.a1c = bind_name c, %c.param
  666. // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1
  667. // CHECK:STDOUT: %return: ref %struct_type.c = return_slot %return.param
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {}
  670. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {}
  671. // CHECK:STDOUT: name_binding_decl {
  672. // CHECK:STDOUT: %a.patt: %empty_tuple.type = binding_pattern a
  673. // CHECK:STDOUT: %.loc52_1: %empty_tuple.type = var_pattern %a.patt
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
  676. // CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] {
  677. // CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal ()
  678. // CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
  681. // CHECK:STDOUT: name_binding_decl {
  682. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  683. // CHECK:STDOUT: %.loc53_1: %i32 = var_pattern %b.patt
  684. // CHECK:STDOUT: }
  685. // CHECK:STDOUT: %b.var: ref %i32 = var b
  686. // CHECK:STDOUT: %.loc53_8: type = splice_block %i32.loc53 [concrete = constants.%i32] {
  687. // CHECK:STDOUT: %int_32.loc53: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  688. // CHECK:STDOUT: %i32.loc53: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
  691. // CHECK:STDOUT: name_binding_decl {
  692. // CHECK:STDOUT: %c.patt: %struct_type.c = binding_pattern c
  693. // CHECK:STDOUT: %.loc54_1: %struct_type.c = var_pattern %c.patt
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT: %c.var: ref %struct_type.c = var c
  696. // CHECK:STDOUT: %.loc54_16: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] {
  697. // CHECK:STDOUT: %int_32.loc54: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  698. // CHECK:STDOUT: %i32.loc54: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  699. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT: %c: ref %struct_type.c = bind_name c, %c.var
  702. // CHECK:STDOUT: name_binding_decl {
  703. // CHECK:STDOUT: %d.patt: %empty_tuple.type = binding_pattern d
  704. // CHECK:STDOUT: %.loc55_1: %empty_tuple.type = var_pattern %d.patt
  705. // CHECK:STDOUT: }
  706. // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
  707. // CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] {
  708. // CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal ()
  709. // CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  710. // CHECK:STDOUT: }
  711. // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var
  712. // CHECK:STDOUT: name_binding_decl {
  713. // CHECK:STDOUT: %e.patt: %empty_tuple.type = binding_pattern e
  714. // CHECK:STDOUT: %.loc56_1: %empty_tuple.type = var_pattern %e.patt
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var e
  717. // CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] {
  718. // CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal ()
  719. // CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  720. // CHECK:STDOUT: }
  721. // CHECK:STDOUT: %e: ref %empty_tuple.type = bind_name e, %e.var
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: fn @A() [from "api.carbon"];
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: fn @B(%b.param_patt: %i32) -> %i32 [from "api.carbon"];
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c [from "api.carbon"];
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: extern fn @D() [from "api.carbon"];
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: fn @E() [from "api.carbon"];
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: fn @__global_init() {
  735. // CHECK:STDOUT: !entry:
  736. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A]
  737. // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
  738. // CHECK:STDOUT: assign file.%a.var, %A.call
  739. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [concrete = constants.%B]
  740. // CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  741. // CHECK:STDOUT: %impl.elem0.loc53: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  742. // CHECK:STDOUT: %bound_method.loc53_16.1: <bound method> = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Convert.bound]
  743. // CHECK:STDOUT: %specific_fn.loc53: <specific function> = specific_function %impl.elem0.loc53, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  744. // CHECK:STDOUT: %bound_method.loc53_16.2: <bound method> = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method]
  745. // CHECK:STDOUT: %int.convert_checked.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.5d2]
  746. // CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %int.convert_checked.loc53 [concrete = constants.%int_1.5d2]
  747. // CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.5d2]
  748. // CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2)
  749. // CHECK:STDOUT: assign file.%b.var, %B.call
  750. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C]
  751. // CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  752. // CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54)
  753. // CHECK:STDOUT: %impl.elem0.loc54: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  754. // CHECK:STDOUT: %bound_method.loc54_25.1: <bound method> = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Convert.bound]
  755. // CHECK:STDOUT: %specific_fn.loc54: <specific function> = specific_function %impl.elem0.loc54, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  756. // CHECK:STDOUT: %bound_method.loc54_25.2: <bound method> = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method]
  757. // CHECK:STDOUT: %int.convert_checked.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.5d2]
  758. // CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %int.convert_checked.loc54 [concrete = constants.%int_1.5d2]
  759. // CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.5d2]
  760. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%.loc54_25.3) [concrete = constants.%tuple]
  761. // CHECK:STDOUT: %.loc54_25.4: %tuple.type.a1c = converted %.loc54_25.1, %tuple [concrete = constants.%tuple]
  762. // CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4)
  763. // CHECK:STDOUT: assign file.%c.var, %C.call
  764. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D]
  765. // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
  766. // CHECK:STDOUT: assign file.%d.var, %D.call
  767. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [concrete = imports.%NS]
  768. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [concrete = constants.%E]
  769. // CHECK:STDOUT: %E.call: init %empty_tuple.type = call %E.ref()
  770. // CHECK:STDOUT: assign file.%e.var, %E.call
  771. // CHECK:STDOUT: return
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: --- redecl_extern_api.carbon
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: constants {
  777. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  778. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  779. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  780. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  781. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  782. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  783. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  784. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  785. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  786. // CHECK:STDOUT: %tuple.type.dd4: type = tuple_type (%i32) [concrete]
  787. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  788. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  789. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  790. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  791. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  792. // CHECK:STDOUT: %tuple.type.85c: type = tuple_type (type) [concrete]
  793. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  794. // CHECK:STDOUT: %ImplicitAs.type.9ba: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  795. // CHECK:STDOUT: %Convert.type.6da: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  796. // CHECK:STDOUT: %impl_witness.b97: <witness> = impl_witness (imports.%Core.import_ref.a86), @impl.c81(%int_32) [concrete]
  797. // CHECK:STDOUT: %Convert.type.ed5: type = fn_type @Convert.2, @impl.c81(%int_32) [concrete]
  798. // CHECK:STDOUT: %Convert.16d: %Convert.type.ed5 = struct_value () [concrete]
  799. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.9ba = facet_value Core.IntLiteral, (%impl_witness.b97) [concrete]
  800. // CHECK:STDOUT: %.b14: type = fn_type_with_self_type %Convert.type.6da, %ImplicitAs.facet [concrete]
  801. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.16d [concrete]
  802. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.16d, @Convert.2(%int_32) [concrete]
  803. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  804. // CHECK:STDOUT: %int_1.47b: %i32 = int_value 1 [concrete]
  805. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  806. // CHECK:STDOUT: %tuple: %tuple.type.dd4 = tuple_value (%int_1.47b) [concrete]
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: imports {
  810. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//extern_api, NS, loaded
  811. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  812. // CHECK:STDOUT: .E = file.%E.decl
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  815. // CHECK:STDOUT: .Int = %Core.Int
  816. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  817. // CHECK:STDOUT: import Core//prelude
  818. // CHECK:STDOUT: import Core//prelude/...
  819. // CHECK:STDOUT: }
  820. // CHECK:STDOUT: }
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: file {
  823. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  824. // CHECK:STDOUT: .A = %A.decl
  825. // CHECK:STDOUT: .B = %B.decl
  826. // CHECK:STDOUT: .C = %C.decl
  827. // CHECK:STDOUT: .D = %D.decl
  828. // CHECK:STDOUT: .NS = imports.%NS
  829. // CHECK:STDOUT: .Core = imports.%Core
  830. // CHECK:STDOUT: .a = %a
  831. // CHECK:STDOUT: .b = %b
  832. // CHECK:STDOUT: .c = %c
  833. // CHECK:STDOUT: .d = %d
  834. // CHECK:STDOUT: .e = %e
  835. // CHECK:STDOUT: }
  836. // CHECK:STDOUT: %Core.import = import Core
  837. // CHECK:STDOUT: %default.import = import <none>
  838. // CHECK:STDOUT: %A.decl: %A.type = fn_decl @A [concrete = constants.%A] {} {}
  839. // CHECK:STDOUT: %B.decl: %B.type = fn_decl @B [concrete = constants.%B] {} {
  840. // CHECK:STDOUT: %int_32.loc7_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  841. // CHECK:STDOUT: %i32.loc7_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  842. // CHECK:STDOUT: %b.param: %i32 = value_param call_param0
  843. // CHECK:STDOUT: %.loc7: type = splice_block %i32.loc7_16 [concrete = constants.%i32] {
  844. // CHECK:STDOUT: %int_32.loc7_16: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  845. // CHECK:STDOUT: %i32.loc7_16: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  846. // CHECK:STDOUT: }
  847. // CHECK:STDOUT: %b: %i32 = bind_name b, %b.param
  848. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  849. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  850. // CHECK:STDOUT: }
  851. // CHECK:STDOUT: %C.decl: %C.type = fn_decl @C [concrete = constants.%C] {} {
  852. // CHECK:STDOUT: %int_32.loc8_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  853. // CHECK:STDOUT: %i32.loc8_32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  854. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  855. // CHECK:STDOUT: %c.param: %tuple.type.dd4 = value_param call_param0
  856. // CHECK:STDOUT: %.loc8_21.1: type = splice_block %.loc8_21.3 [concrete = constants.%tuple.type.dd4] {
  857. // CHECK:STDOUT: %int_32.loc8_17: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  858. // CHECK:STDOUT: %i32.loc8_17: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  859. // CHECK:STDOUT: %.loc8_21.2: %tuple.type.85c = tuple_literal (%i32.loc8_17)
  860. // CHECK:STDOUT: %.loc8_21.3: type = converted %.loc8_21.2, constants.%tuple.type.dd4 [concrete = constants.%tuple.type.dd4]
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT: %c: %tuple.type.dd4 = bind_name c, %c.param
  863. // CHECK:STDOUT: %return.param: ref %struct_type.c = out_param call_param1
  864. // CHECK:STDOUT: %return: ref %struct_type.c = return_slot %return.param
  865. // CHECK:STDOUT: }
  866. // CHECK:STDOUT: %D.decl: %D.type = fn_decl @D [concrete = constants.%D] {} {}
  867. // CHECK:STDOUT: %E.decl: %E.type = fn_decl @E [concrete = constants.%E] {} {}
  868. // CHECK:STDOUT: name_binding_decl {
  869. // CHECK:STDOUT: %a.patt: %empty_tuple.type = binding_pattern a
  870. // CHECK:STDOUT: %.loc12_1: %empty_tuple.type = var_pattern %a.patt
  871. // CHECK:STDOUT: }
  872. // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
  873. // CHECK:STDOUT: %.loc12_9.1: type = splice_block %.loc12_9.3 [concrete = constants.%empty_tuple.type] {
  874. // CHECK:STDOUT: %.loc12_9.2: %empty_tuple.type = tuple_literal ()
  875. // CHECK:STDOUT: %.loc12_9.3: type = converted %.loc12_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  876. // CHECK:STDOUT: }
  877. // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
  878. // CHECK:STDOUT: name_binding_decl {
  879. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  880. // CHECK:STDOUT: %.loc13_1: %i32 = var_pattern %b.patt
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT: %b.var: ref %i32 = var b
  883. // CHECK:STDOUT: %.loc13_8: type = splice_block %i32.loc13 [concrete = constants.%i32] {
  884. // CHECK:STDOUT: %int_32.loc13: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  885. // CHECK:STDOUT: %i32.loc13: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  886. // CHECK:STDOUT: }
  887. // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
  888. // CHECK:STDOUT: name_binding_decl {
  889. // CHECK:STDOUT: %c.patt: %struct_type.c = binding_pattern c
  890. // CHECK:STDOUT: %.loc14_1: %struct_type.c = var_pattern %c.patt
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT: %c.var: ref %struct_type.c = var c
  893. // CHECK:STDOUT: %.loc14_16: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] {
  894. // CHECK:STDOUT: %int_32.loc14: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  895. // CHECK:STDOUT: %i32.loc14: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  896. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  897. // CHECK:STDOUT: }
  898. // CHECK:STDOUT: %c: ref %struct_type.c = bind_name c, %c.var
  899. // CHECK:STDOUT: name_binding_decl {
  900. // CHECK:STDOUT: %d.patt: %empty_tuple.type = binding_pattern d
  901. // CHECK:STDOUT: %.loc15_1: %empty_tuple.type = var_pattern %d.patt
  902. // CHECK:STDOUT: }
  903. // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
  904. // CHECK:STDOUT: %.loc15_9.1: type = splice_block %.loc15_9.3 [concrete = constants.%empty_tuple.type] {
  905. // CHECK:STDOUT: %.loc15_9.2: %empty_tuple.type = tuple_literal ()
  906. // CHECK:STDOUT: %.loc15_9.3: type = converted %.loc15_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  907. // CHECK:STDOUT: }
  908. // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var
  909. // CHECK:STDOUT: name_binding_decl {
  910. // CHECK:STDOUT: %e.patt: %empty_tuple.type = binding_pattern e
  911. // CHECK:STDOUT: %.loc16_1: %empty_tuple.type = var_pattern %e.patt
  912. // CHECK:STDOUT: }
  913. // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var e
  914. // CHECK:STDOUT: %.loc16_9.1: type = splice_block %.loc16_9.3 [concrete = constants.%empty_tuple.type] {
  915. // CHECK:STDOUT: %.loc16_9.2: %empty_tuple.type = tuple_literal ()
  916. // CHECK:STDOUT: %.loc16_9.3: type = converted %.loc16_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  917. // CHECK:STDOUT: }
  918. // CHECK:STDOUT: %e: ref %empty_tuple.type = bind_name e, %e.var
  919. // CHECK:STDOUT: }
  920. // CHECK:STDOUT:
  921. // CHECK:STDOUT: extern fn @A();
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: extern fn @B(%b.param_patt: %i32) -> %i32;
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: extern fn @C(%c.param_patt: %tuple.type.dd4) -> %struct_type.c;
  926. // CHECK:STDOUT:
  927. // CHECK:STDOUT: extern fn @D();
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: extern fn @E();
  930. // CHECK:STDOUT:
  931. // CHECK:STDOUT: fn @__global_init() {
  932. // CHECK:STDOUT: !entry:
  933. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [concrete = constants.%A]
  934. // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
  935. // CHECK:STDOUT: assign file.%a.var, %A.call
  936. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, file.%B.decl [concrete = constants.%B]
  937. // CHECK:STDOUT: %int_1.loc13: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  938. // CHECK:STDOUT: %impl.elem0.loc13: %.b14 = impl_witness_access constants.%impl_witness.b97, element0 [concrete = constants.%Convert.16d]
  939. // CHECK:STDOUT: %bound_method.loc13_16.1: <bound method> = bound_method %int_1.loc13, %impl.elem0.loc13 [concrete = constants.%Convert.bound]
  940. // CHECK:STDOUT: %specific_fn.loc13: <specific function> = specific_function %impl.elem0.loc13, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  941. // CHECK:STDOUT: %bound_method.loc13_16.2: <bound method> = bound_method %int_1.loc13, %specific_fn.loc13 [concrete = constants.%bound_method]
  942. // CHECK:STDOUT: %int.convert_checked.loc13: init %i32 = call %bound_method.loc13_16.2(%int_1.loc13) [concrete = constants.%int_1.47b]
  943. // CHECK:STDOUT: %.loc13_16.1: %i32 = value_of_initializer %int.convert_checked.loc13 [concrete = constants.%int_1.47b]
  944. // CHECK:STDOUT: %.loc13_16.2: %i32 = converted %int_1.loc13, %.loc13_16.1 [concrete = constants.%int_1.47b]
  945. // CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc13_16.2)
  946. // CHECK:STDOUT: assign file.%b.var, %B.call
  947. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C]
  948. // CHECK:STDOUT: %int_1.loc14: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  949. // CHECK:STDOUT: %.loc14_25.1: %tuple.type.985 = tuple_literal (%int_1.loc14)
  950. // CHECK:STDOUT: %impl.elem0.loc14: %.b14 = impl_witness_access constants.%impl_witness.b97, element0 [concrete = constants.%Convert.16d]
  951. // CHECK:STDOUT: %bound_method.loc14_25.1: <bound method> = bound_method %int_1.loc14, %impl.elem0.loc14 [concrete = constants.%Convert.bound]
  952. // CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  953. // CHECK:STDOUT: %bound_method.loc14_25.2: <bound method> = bound_method %int_1.loc14, %specific_fn.loc14 [concrete = constants.%bound_method]
  954. // CHECK:STDOUT: %int.convert_checked.loc14: init %i32 = call %bound_method.loc14_25.2(%int_1.loc14) [concrete = constants.%int_1.47b]
  955. // CHECK:STDOUT: %.loc14_25.2: %i32 = value_of_initializer %int.convert_checked.loc14 [concrete = constants.%int_1.47b]
  956. // CHECK:STDOUT: %.loc14_25.3: %i32 = converted %int_1.loc14, %.loc14_25.2 [concrete = constants.%int_1.47b]
  957. // CHECK:STDOUT: %tuple: %tuple.type.dd4 = tuple_value (%.loc14_25.3) [concrete = constants.%tuple]
  958. // CHECK:STDOUT: %.loc14_25.4: %tuple.type.dd4 = converted %.loc14_25.1, %tuple [concrete = constants.%tuple]
  959. // CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc14_25.4)
  960. // CHECK:STDOUT: assign file.%c.var, %C.call
  961. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, file.%D.decl [concrete = constants.%D]
  962. // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
  963. // CHECK:STDOUT: assign file.%d.var, %D.call
  964. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [concrete = imports.%NS]
  965. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, file.%E.decl [concrete = constants.%E]
  966. // CHECK:STDOUT: %E.call: init %empty_tuple.type = call %E.ref()
  967. // CHECK:STDOUT: assign file.%e.var, %E.call
  968. // CHECK:STDOUT: return
  969. // CHECK:STDOUT: }
  970. // CHECK:STDOUT:
  971. // CHECK:STDOUT: --- fail_merge.carbon
  972. // CHECK:STDOUT:
  973. // CHECK:STDOUT: constants {
  974. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  975. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  976. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  977. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  978. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  979. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  980. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  981. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  982. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  983. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  984. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  985. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  986. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  987. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%impl_witness.d39) [concrete]
  988. // CHECK:STDOUT: %.be7: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  989. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  990. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  991. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  992. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  993. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  994. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  995. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  996. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  997. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  998. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_1.5d2) [concrete]
  999. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  1000. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  1001. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  1002. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  1003. // CHECK:STDOUT: }
  1004. // CHECK:STDOUT:
  1005. // CHECK:STDOUT: imports {
  1006. // CHECK:STDOUT: %Main.A: %A.type = import_ref Main//api, A, loaded [concrete = constants.%A]
  1007. // CHECK:STDOUT: %Main.B: %B.type = import_ref Main//api, B, loaded [concrete = constants.%B]
  1008. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//api, C, loaded [concrete = constants.%C]
  1009. // CHECK:STDOUT: %Main.D: %D.type = import_ref Main//api, D, loaded [concrete = constants.%D]
  1010. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//api, NS, loaded
  1011. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  1012. // CHECK:STDOUT: .E = %Main.E
  1013. // CHECK:STDOUT: }
  1014. // CHECK:STDOUT: %Main.E: %E.type = import_ref Main//api, E, loaded [concrete = constants.%E]
  1015. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1016. // CHECK:STDOUT: .Int = %Core.Int
  1017. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1018. // CHECK:STDOUT: import Core//prelude
  1019. // CHECK:STDOUT: import Core//prelude/...
  1020. // CHECK:STDOUT: }
  1021. // CHECK:STDOUT: }
  1022. // CHECK:STDOUT:
  1023. // CHECK:STDOUT: file {
  1024. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1025. // CHECK:STDOUT: .A = imports.%Main.A
  1026. // CHECK:STDOUT: .B = imports.%Main.B
  1027. // CHECK:STDOUT: .C = imports.%Main.C
  1028. // CHECK:STDOUT: .D = imports.%Main.D
  1029. // CHECK:STDOUT: .NS = imports.%NS
  1030. // CHECK:STDOUT: .Core = imports.%Core
  1031. // CHECK:STDOUT: .a = %a
  1032. // CHECK:STDOUT: .b = %b
  1033. // CHECK:STDOUT: .c = %c
  1034. // CHECK:STDOUT: .d = %d
  1035. // CHECK:STDOUT: .e = %e
  1036. // CHECK:STDOUT: }
  1037. // CHECK:STDOUT: %Core.import = import Core
  1038. // CHECK:STDOUT: %default.import = import <none>
  1039. // CHECK:STDOUT: name_binding_decl {
  1040. // CHECK:STDOUT: %a.patt: %empty_tuple.type = binding_pattern a
  1041. // CHECK:STDOUT: %.loc52_1: %empty_tuple.type = var_pattern %a.patt
  1042. // CHECK:STDOUT: }
  1043. // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
  1044. // CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] {
  1045. // CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal ()
  1046. // CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1047. // CHECK:STDOUT: }
  1048. // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
  1049. // CHECK:STDOUT: name_binding_decl {
  1050. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  1051. // CHECK:STDOUT: %.loc53_1: %i32 = var_pattern %b.patt
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT: %b.var: ref %i32 = var b
  1054. // CHECK:STDOUT: %.loc53_8: type = splice_block %i32.loc53 [concrete = constants.%i32] {
  1055. // CHECK:STDOUT: %int_32.loc53: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1056. // CHECK:STDOUT: %i32.loc53: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1057. // CHECK:STDOUT: }
  1058. // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
  1059. // CHECK:STDOUT: name_binding_decl {
  1060. // CHECK:STDOUT: %c.patt: %struct_type.c = binding_pattern c
  1061. // CHECK:STDOUT: %.loc54_1: %struct_type.c = var_pattern %c.patt
  1062. // CHECK:STDOUT: }
  1063. // CHECK:STDOUT: %c.var: ref %struct_type.c = var c
  1064. // CHECK:STDOUT: %.loc54_16: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] {
  1065. // CHECK:STDOUT: %int_32.loc54: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1066. // CHECK:STDOUT: %i32.loc54: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1067. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  1068. // CHECK:STDOUT: }
  1069. // CHECK:STDOUT: %c: ref %struct_type.c = bind_name c, %c.var
  1070. // CHECK:STDOUT: name_binding_decl {
  1071. // CHECK:STDOUT: %d.patt: %empty_tuple.type = binding_pattern d
  1072. // CHECK:STDOUT: %.loc55_1: %empty_tuple.type = var_pattern %d.patt
  1073. // CHECK:STDOUT: }
  1074. // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
  1075. // CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] {
  1076. // CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal ()
  1077. // CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1078. // CHECK:STDOUT: }
  1079. // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var
  1080. // CHECK:STDOUT: name_binding_decl {
  1081. // CHECK:STDOUT: %e.patt: %empty_tuple.type = binding_pattern e
  1082. // CHECK:STDOUT: %.loc56_1: %empty_tuple.type = var_pattern %e.patt
  1083. // CHECK:STDOUT: }
  1084. // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var e
  1085. // CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] {
  1086. // CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal ()
  1087. // CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1088. // CHECK:STDOUT: }
  1089. // CHECK:STDOUT: %e: ref %empty_tuple.type = bind_name e, %e.var
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT:
  1092. // CHECK:STDOUT: fn @A() [from "api.carbon"];
  1093. // CHECK:STDOUT:
  1094. // CHECK:STDOUT: fn @B(%b.param_patt: %i32) -> %i32 [from "api.carbon"];
  1095. // CHECK:STDOUT:
  1096. // CHECK:STDOUT: fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c [from "api.carbon"];
  1097. // CHECK:STDOUT:
  1098. // CHECK:STDOUT: extern fn @D() [from "api.carbon"];
  1099. // CHECK:STDOUT:
  1100. // CHECK:STDOUT: fn @E() [from "api.carbon"];
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: fn @__global_init() {
  1103. // CHECK:STDOUT: !entry:
  1104. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1105. // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
  1106. // CHECK:STDOUT: assign file.%a.var, %A.call
  1107. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1108. // CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1109. // CHECK:STDOUT: %impl.elem0.loc53: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  1110. // CHECK:STDOUT: %bound_method.loc53_16.1: <bound method> = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Convert.bound]
  1111. // CHECK:STDOUT: %specific_fn.loc53: <specific function> = specific_function %impl.elem0.loc53, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1112. // CHECK:STDOUT: %bound_method.loc53_16.2: <bound method> = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method]
  1113. // CHECK:STDOUT: %int.convert_checked.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.5d2]
  1114. // CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %int.convert_checked.loc53 [concrete = constants.%int_1.5d2]
  1115. // CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.5d2]
  1116. // CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2)
  1117. // CHECK:STDOUT: assign file.%b.var, %B.call
  1118. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C]
  1119. // CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1120. // CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54)
  1121. // CHECK:STDOUT: %impl.elem0.loc54: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  1122. // CHECK:STDOUT: %bound_method.loc54_25.1: <bound method> = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Convert.bound]
  1123. // CHECK:STDOUT: %specific_fn.loc54: <specific function> = specific_function %impl.elem0.loc54, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1124. // CHECK:STDOUT: %bound_method.loc54_25.2: <bound method> = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method]
  1125. // CHECK:STDOUT: %int.convert_checked.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.5d2]
  1126. // CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %int.convert_checked.loc54 [concrete = constants.%int_1.5d2]
  1127. // CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.5d2]
  1128. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%.loc54_25.3) [concrete = constants.%tuple]
  1129. // CHECK:STDOUT: %.loc54_25.4: %tuple.type.a1c = converted %.loc54_25.1, %tuple [concrete = constants.%tuple]
  1130. // CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4)
  1131. // CHECK:STDOUT: assign file.%c.var, %C.call
  1132. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D]
  1133. // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
  1134. // CHECK:STDOUT: assign file.%d.var, %D.call
  1135. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [concrete = imports.%NS]
  1136. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%Main.E [concrete = constants.%E]
  1137. // CHECK:STDOUT: %E.call: init %empty_tuple.type = call %E.ref()
  1138. // CHECK:STDOUT: assign file.%e.var, %E.call
  1139. // CHECK:STDOUT: return
  1140. // CHECK:STDOUT: }
  1141. // CHECK:STDOUT:
  1142. // CHECK:STDOUT: --- fail_merge_reverse.carbon
  1143. // CHECK:STDOUT:
  1144. // CHECK:STDOUT: constants {
  1145. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1146. // CHECK:STDOUT: %A.type: type = fn_type @A [concrete]
  1147. // CHECK:STDOUT: %A: %A.type = struct_value () [concrete]
  1148. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1149. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1150. // CHECK:STDOUT: %B.type: type = fn_type @B [concrete]
  1151. // CHECK:STDOUT: %B: %B.type = struct_value () [concrete]
  1152. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1153. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1154. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1155. // CHECK:STDOUT: %impl_witness.d39: <witness> = impl_witness (imports.%Core.import_ref.a5b), @impl.4f9(%int_32) [concrete]
  1156. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1157. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1158. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%impl_witness.d39) [concrete]
  1159. // CHECK:STDOUT: %.be7: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1160. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1161. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1162. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1163. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1164. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete]
  1165. // CHECK:STDOUT: %C.type: type = fn_type @C [concrete]
  1166. // CHECK:STDOUT: %C: %C.type = struct_value () [concrete]
  1167. // CHECK:STDOUT: %tuple.type.a1c: type = tuple_type (%i32) [concrete]
  1168. // CHECK:STDOUT: %tuple.type.985: type = tuple_type (Core.IntLiteral) [concrete]
  1169. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%int_1.5d2) [concrete]
  1170. // CHECK:STDOUT: %D.type: type = fn_type @D [concrete]
  1171. // CHECK:STDOUT: %D: %D.type = struct_value () [concrete]
  1172. // CHECK:STDOUT: %E.type: type = fn_type @E [concrete]
  1173. // CHECK:STDOUT: %E: %E.type = struct_value () [concrete]
  1174. // CHECK:STDOUT: }
  1175. // CHECK:STDOUT:
  1176. // CHECK:STDOUT: imports {
  1177. // CHECK:STDOUT: %Main.A: %A.type = import_ref Main//extern_api, A, loaded [concrete = constants.%A]
  1178. // CHECK:STDOUT: %Main.B: %B.type = import_ref Main//extern_api, B, loaded [concrete = constants.%B]
  1179. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//extern_api, C, loaded [concrete = constants.%C]
  1180. // CHECK:STDOUT: %Main.D: %D.type = import_ref Main//extern_api, D, loaded [concrete = constants.%D]
  1181. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//extern_api, NS, loaded
  1182. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  1183. // CHECK:STDOUT: .E = %Main.E
  1184. // CHECK:STDOUT: }
  1185. // CHECK:STDOUT: %Main.E: %E.type = import_ref Main//extern_api, E, loaded [concrete = constants.%E]
  1186. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1187. // CHECK:STDOUT: .Int = %Core.Int
  1188. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1189. // CHECK:STDOUT: import Core//prelude
  1190. // CHECK:STDOUT: import Core//prelude/...
  1191. // CHECK:STDOUT: }
  1192. // CHECK:STDOUT: }
  1193. // CHECK:STDOUT:
  1194. // CHECK:STDOUT: file {
  1195. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1196. // CHECK:STDOUT: .A = imports.%Main.A
  1197. // CHECK:STDOUT: .B = imports.%Main.B
  1198. // CHECK:STDOUT: .C = imports.%Main.C
  1199. // CHECK:STDOUT: .D = imports.%Main.D
  1200. // CHECK:STDOUT: .NS = imports.%NS
  1201. // CHECK:STDOUT: .Core = imports.%Core
  1202. // CHECK:STDOUT: .a = %a
  1203. // CHECK:STDOUT: .b = %b
  1204. // CHECK:STDOUT: .c = %c
  1205. // CHECK:STDOUT: .d = %d
  1206. // CHECK:STDOUT: .e = %e
  1207. // CHECK:STDOUT: }
  1208. // CHECK:STDOUT: %Core.import = import Core
  1209. // CHECK:STDOUT: %default.import = import <none>
  1210. // CHECK:STDOUT: name_binding_decl {
  1211. // CHECK:STDOUT: %a.patt: %empty_tuple.type = binding_pattern a
  1212. // CHECK:STDOUT: %.loc52_1: %empty_tuple.type = var_pattern %a.patt
  1213. // CHECK:STDOUT: }
  1214. // CHECK:STDOUT: %a.var: ref %empty_tuple.type = var a
  1215. // CHECK:STDOUT: %.loc52_9.1: type = splice_block %.loc52_9.3 [concrete = constants.%empty_tuple.type] {
  1216. // CHECK:STDOUT: %.loc52_9.2: %empty_tuple.type = tuple_literal ()
  1217. // CHECK:STDOUT: %.loc52_9.3: type = converted %.loc52_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1218. // CHECK:STDOUT: }
  1219. // CHECK:STDOUT: %a: ref %empty_tuple.type = bind_name a, %a.var
  1220. // CHECK:STDOUT: name_binding_decl {
  1221. // CHECK:STDOUT: %b.patt: %i32 = binding_pattern b
  1222. // CHECK:STDOUT: %.loc53_1: %i32 = var_pattern %b.patt
  1223. // CHECK:STDOUT: }
  1224. // CHECK:STDOUT: %b.var: ref %i32 = var b
  1225. // CHECK:STDOUT: %.loc53_8: type = splice_block %i32.loc53 [concrete = constants.%i32] {
  1226. // CHECK:STDOUT: %int_32.loc53: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1227. // CHECK:STDOUT: %i32.loc53: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1228. // CHECK:STDOUT: }
  1229. // CHECK:STDOUT: %b: ref %i32 = bind_name b, %b.var
  1230. // CHECK:STDOUT: name_binding_decl {
  1231. // CHECK:STDOUT: %c.patt: %struct_type.c = binding_pattern c
  1232. // CHECK:STDOUT: %.loc54_1: %struct_type.c = var_pattern %c.patt
  1233. // CHECK:STDOUT: }
  1234. // CHECK:STDOUT: %c.var: ref %struct_type.c = var c
  1235. // CHECK:STDOUT: %.loc54_16: type = splice_block %struct_type.c [concrete = constants.%struct_type.c] {
  1236. // CHECK:STDOUT: %int_32.loc54: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1237. // CHECK:STDOUT: %i32.loc54: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1238. // CHECK:STDOUT: %struct_type.c: type = struct_type {.c: %i32} [concrete = constants.%struct_type.c]
  1239. // CHECK:STDOUT: }
  1240. // CHECK:STDOUT: %c: ref %struct_type.c = bind_name c, %c.var
  1241. // CHECK:STDOUT: name_binding_decl {
  1242. // CHECK:STDOUT: %d.patt: %empty_tuple.type = binding_pattern d
  1243. // CHECK:STDOUT: %.loc55_1: %empty_tuple.type = var_pattern %d.patt
  1244. // CHECK:STDOUT: }
  1245. // CHECK:STDOUT: %d.var: ref %empty_tuple.type = var d
  1246. // CHECK:STDOUT: %.loc55_9.1: type = splice_block %.loc55_9.3 [concrete = constants.%empty_tuple.type] {
  1247. // CHECK:STDOUT: %.loc55_9.2: %empty_tuple.type = tuple_literal ()
  1248. // CHECK:STDOUT: %.loc55_9.3: type = converted %.loc55_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1249. // CHECK:STDOUT: }
  1250. // CHECK:STDOUT: %d: ref %empty_tuple.type = bind_name d, %d.var
  1251. // CHECK:STDOUT: name_binding_decl {
  1252. // CHECK:STDOUT: %e.patt: %empty_tuple.type = binding_pattern e
  1253. // CHECK:STDOUT: %.loc56_1: %empty_tuple.type = var_pattern %e.patt
  1254. // CHECK:STDOUT: }
  1255. // CHECK:STDOUT: %e.var: ref %empty_tuple.type = var e
  1256. // CHECK:STDOUT: %.loc56_9.1: type = splice_block %.loc56_9.3 [concrete = constants.%empty_tuple.type] {
  1257. // CHECK:STDOUT: %.loc56_9.2: %empty_tuple.type = tuple_literal ()
  1258. // CHECK:STDOUT: %.loc56_9.3: type = converted %.loc56_9.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1259. // CHECK:STDOUT: }
  1260. // CHECK:STDOUT: %e: ref %empty_tuple.type = bind_name e, %e.var
  1261. // CHECK:STDOUT: }
  1262. // CHECK:STDOUT:
  1263. // CHECK:STDOUT: extern fn @A();
  1264. // CHECK:STDOUT:
  1265. // CHECK:STDOUT: extern fn @B(%b.param_patt: %i32) -> %i32;
  1266. // CHECK:STDOUT:
  1267. // CHECK:STDOUT: extern fn @C(%c.param_patt: %tuple.type.a1c) -> %struct_type.c;
  1268. // CHECK:STDOUT:
  1269. // CHECK:STDOUT: extern fn @D();
  1270. // CHECK:STDOUT:
  1271. // CHECK:STDOUT: extern fn @E();
  1272. // CHECK:STDOUT:
  1273. // CHECK:STDOUT: fn @__global_init() {
  1274. // CHECK:STDOUT: !entry:
  1275. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, imports.%Main.A [concrete = constants.%A]
  1276. // CHECK:STDOUT: %A.call: init %empty_tuple.type = call %A.ref()
  1277. // CHECK:STDOUT: assign file.%a.var, %A.call
  1278. // CHECK:STDOUT: %B.ref: %B.type = name_ref B, imports.%Main.B [concrete = constants.%B]
  1279. // CHECK:STDOUT: %int_1.loc53: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1280. // CHECK:STDOUT: %impl.elem0.loc53: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  1281. // CHECK:STDOUT: %bound_method.loc53_16.1: <bound method> = bound_method %int_1.loc53, %impl.elem0.loc53 [concrete = constants.%Convert.bound]
  1282. // CHECK:STDOUT: %specific_fn.loc53: <specific function> = specific_function %impl.elem0.loc53, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1283. // CHECK:STDOUT: %bound_method.loc53_16.2: <bound method> = bound_method %int_1.loc53, %specific_fn.loc53 [concrete = constants.%bound_method]
  1284. // CHECK:STDOUT: %int.convert_checked.loc53: init %i32 = call %bound_method.loc53_16.2(%int_1.loc53) [concrete = constants.%int_1.5d2]
  1285. // CHECK:STDOUT: %.loc53_16.1: %i32 = value_of_initializer %int.convert_checked.loc53 [concrete = constants.%int_1.5d2]
  1286. // CHECK:STDOUT: %.loc53_16.2: %i32 = converted %int_1.loc53, %.loc53_16.1 [concrete = constants.%int_1.5d2]
  1287. // CHECK:STDOUT: %B.call: init %i32 = call %B.ref(%.loc53_16.2)
  1288. // CHECK:STDOUT: assign file.%b.var, %B.call
  1289. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C]
  1290. // CHECK:STDOUT: %int_1.loc54: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1291. // CHECK:STDOUT: %.loc54_25.1: %tuple.type.985 = tuple_literal (%int_1.loc54)
  1292. // CHECK:STDOUT: %impl.elem0.loc54: %.be7 = impl_witness_access constants.%impl_witness.d39, element0 [concrete = constants.%Convert.956]
  1293. // CHECK:STDOUT: %bound_method.loc54_25.1: <bound method> = bound_method %int_1.loc54, %impl.elem0.loc54 [concrete = constants.%Convert.bound]
  1294. // CHECK:STDOUT: %specific_fn.loc54: <specific function> = specific_function %impl.elem0.loc54, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1295. // CHECK:STDOUT: %bound_method.loc54_25.2: <bound method> = bound_method %int_1.loc54, %specific_fn.loc54 [concrete = constants.%bound_method]
  1296. // CHECK:STDOUT: %int.convert_checked.loc54: init %i32 = call %bound_method.loc54_25.2(%int_1.loc54) [concrete = constants.%int_1.5d2]
  1297. // CHECK:STDOUT: %.loc54_25.2: %i32 = value_of_initializer %int.convert_checked.loc54 [concrete = constants.%int_1.5d2]
  1298. // CHECK:STDOUT: %.loc54_25.3: %i32 = converted %int_1.loc54, %.loc54_25.2 [concrete = constants.%int_1.5d2]
  1299. // CHECK:STDOUT: %tuple: %tuple.type.a1c = tuple_value (%.loc54_25.3) [concrete = constants.%tuple]
  1300. // CHECK:STDOUT: %.loc54_25.4: %tuple.type.a1c = converted %.loc54_25.1, %tuple [concrete = constants.%tuple]
  1301. // CHECK:STDOUT: %C.call: init %struct_type.c = call %C.ref(%.loc54_25.4)
  1302. // CHECK:STDOUT: assign file.%c.var, %C.call
  1303. // CHECK:STDOUT: %D.ref: %D.type = name_ref D, imports.%Main.D [concrete = constants.%D]
  1304. // CHECK:STDOUT: %D.call: init %empty_tuple.type = call %D.ref()
  1305. // CHECK:STDOUT: assign file.%d.var, %D.call
  1306. // CHECK:STDOUT: %NS.ref: <namespace> = name_ref NS, imports.%NS [concrete = imports.%NS]
  1307. // CHECK:STDOUT: %E.ref: %E.type = name_ref E, imports.%Main.E [concrete = constants.%E]
  1308. // CHECK:STDOUT: %E.call: init %empty_tuple.type = call %E.ref()
  1309. // CHECK:STDOUT: assign file.%e.var, %E.call
  1310. // CHECK:STDOUT: return
  1311. // CHECK:STDOUT: }
  1312. // CHECK:STDOUT:
  1313. // CHECK:STDOUT: --- unloaded.carbon
  1314. // CHECK:STDOUT:
  1315. // CHECK:STDOUT: imports {
  1316. // CHECK:STDOUT: %Main.A = import_ref Main//api, A, unloaded
  1317. // CHECK:STDOUT: %Main.B = import_ref Main//api, B, unloaded
  1318. // CHECK:STDOUT: %Main.C = import_ref Main//api, C, unloaded
  1319. // CHECK:STDOUT: %Main.D = import_ref Main//api, D, unloaded
  1320. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//api, NS, loaded
  1321. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  1322. // CHECK:STDOUT: .E = %Main.E
  1323. // CHECK:STDOUT: }
  1324. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1325. // CHECK:STDOUT: import Core//prelude
  1326. // CHECK:STDOUT: import Core//prelude/...
  1327. // CHECK:STDOUT: }
  1328. // CHECK:STDOUT: }
  1329. // CHECK:STDOUT:
  1330. // CHECK:STDOUT: file {
  1331. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1332. // CHECK:STDOUT: .A = imports.%Main.A
  1333. // CHECK:STDOUT: .B = imports.%Main.B
  1334. // CHECK:STDOUT: .C = imports.%Main.C
  1335. // CHECK:STDOUT: .D = imports.%Main.D
  1336. // CHECK:STDOUT: .NS = imports.%NS
  1337. // CHECK:STDOUT: .Core = imports.%Core
  1338. // CHECK:STDOUT: }
  1339. // CHECK:STDOUT: %Core.import = import Core
  1340. // CHECK:STDOUT: %default.import = import <none>
  1341. // CHECK:STDOUT: }
  1342. // CHECK:STDOUT:
  1343. // CHECK:STDOUT: --- unloaded_extern.carbon
  1344. // CHECK:STDOUT:
  1345. // CHECK:STDOUT: imports {
  1346. // CHECK:STDOUT: %Main.A = import_ref Main//extern_api, A, unloaded
  1347. // CHECK:STDOUT: %Main.B = import_ref Main//extern_api, B, unloaded
  1348. // CHECK:STDOUT: %Main.C = import_ref Main//extern_api, C, unloaded
  1349. // CHECK:STDOUT: %Main.D = import_ref Main//extern_api, D, unloaded
  1350. // CHECK:STDOUT: %Main.NS: <namespace> = import_ref Main//extern_api, NS, loaded
  1351. // CHECK:STDOUT: %NS: <namespace> = namespace %Main.NS, [concrete] {
  1352. // CHECK:STDOUT: .E = %Main.E
  1353. // CHECK:STDOUT: }
  1354. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1355. // CHECK:STDOUT: import Core//prelude
  1356. // CHECK:STDOUT: import Core//prelude/...
  1357. // CHECK:STDOUT: }
  1358. // CHECK:STDOUT: }
  1359. // CHECK:STDOUT:
  1360. // CHECK:STDOUT: file {
  1361. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1362. // CHECK:STDOUT: .A = imports.%Main.A
  1363. // CHECK:STDOUT: .B = imports.%Main.B
  1364. // CHECK:STDOUT: .C = imports.%Main.C
  1365. // CHECK:STDOUT: .D = imports.%Main.D
  1366. // CHECK:STDOUT: .NS = imports.%NS
  1367. // CHECK:STDOUT: .Core = imports.%Core
  1368. // CHECK:STDOUT: }
  1369. // CHECK:STDOUT: %Core.import = import Core
  1370. // CHECK:STDOUT: %default.import = import <none>
  1371. // CHECK:STDOUT: }
  1372. // CHECK:STDOUT: