import.carbon 66 KB

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