param_int32.carbon 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/int.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/param_int32.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/param_int32.carbon
  12. // ============================================================================
  13. // int
  14. // ============================================================================
  15. // --- int.h
  16. auto foo(int a) -> void;
  17. // --- import_int.carbon
  18. library "[[@TEST_NAME]]";
  19. import Cpp library "int.h";
  20. fn F() {
  21. Cpp.foo(1);
  22. }
  23. // --- import_int_max.carbon
  24. library "[[@TEST_NAME]]";
  25. import Cpp library "int.h";
  26. fn F() {
  27. //@dump-sem-ir-begin
  28. Cpp.foo(0x7FFF_FFFF);
  29. //@dump-sem-ir-end
  30. }
  31. // --- fail_import_int_overflow_max.carbon
  32. library "[[@TEST_NAME]]";
  33. import Cpp library "int.h";
  34. fn F() {
  35. // CHECK:STDERR: fail_import_int_overflow_max.carbon:[[@LINE+5]]:11: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
  36. // CHECK:STDERR: Cpp.foo(0x8000_0000);
  37. // CHECK:STDERR: ^~~~~~~~~~~
  38. // CHECK:STDERR: fail_import_int_overflow_max.carbon: note: initializing function parameter [InCallToFunctionParam]
  39. // CHECK:STDERR:
  40. Cpp.foo(0x8000_0000);
  41. }
  42. // --- import_int_min.carbon
  43. library "[[@TEST_NAME]]";
  44. import Cpp library "int.h";
  45. fn F() {
  46. //@dump-sem-ir-begin
  47. Cpp.foo(-0x8000_0000);
  48. //@dump-sem-ir-end
  49. }
  50. // --- fail_import_int_overflow_min.carbon
  51. library "[[@TEST_NAME]]";
  52. import Cpp library "int.h";
  53. fn F() {
  54. // CHECK:STDERR: fail_import_int_overflow_min.carbon:[[@LINE+5]]:11: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType]
  55. // CHECK:STDERR: Cpp.foo(-0x8000_0001);
  56. // CHECK:STDERR: ^~~~~~~~~~~~
  57. // CHECK:STDERR: fail_import_int_overflow_min.carbon: note: initializing function parameter [InCallToFunctionParam]
  58. // CHECK:STDERR:
  59. Cpp.foo(-0x8000_0001);
  60. }
  61. // ============================================================================
  62. // signed int
  63. // ============================================================================
  64. // --- signed_int.h
  65. auto foo(signed int a) -> void;
  66. // --- import_signed_int.carbon
  67. library "[[@TEST_NAME]]";
  68. import Cpp library "signed_int.h";
  69. fn F() {
  70. //@dump-sem-ir-begin
  71. Cpp.foo(1);
  72. //@dump-sem-ir-end
  73. }
  74. // ============================================================================
  75. // signed
  76. // ============================================================================
  77. // --- signed.h
  78. auto foo(signed a) -> void;
  79. // --- import_signed.carbon
  80. library "[[@TEST_NAME]]";
  81. import Cpp library "signed.h";
  82. fn F() {
  83. //@dump-sem-ir-begin
  84. Cpp.foo(1);
  85. //@dump-sem-ir-end
  86. }
  87. // ============================================================================
  88. // typedef for int
  89. // ============================================================================
  90. // --- int32_t.h
  91. namespace std {
  92. // Mimicking glibc definition for int32_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int32_t
  93. typedef signed int int32_t;
  94. }
  95. auto foo(std::int32_t a) -> void;
  96. // --- import_int32_t.carbon
  97. library "[[@TEST_NAME]]";
  98. import Cpp library "int32_t.h";
  99. fn F() {
  100. //@dump-sem-ir-begin
  101. Cpp.foo(1);
  102. //@dump-sem-ir-end
  103. }
  104. // ============================================================================
  105. // ints
  106. // ============================================================================
  107. // --- ints.h
  108. auto foo(int a, int b) -> void;
  109. // --- import_ints.carbon
  110. library "[[@TEST_NAME]]";
  111. import Cpp library "ints.h";
  112. fn F() {
  113. //@dump-sem-ir-begin
  114. Cpp.foo(1, 2);
  115. //@dump-sem-ir-end
  116. }
  117. // ============================================================================
  118. // Multiple ints
  119. // ============================================================================
  120. // --- multiple_ints.h
  121. auto foo1(int a, int b) -> void;
  122. auto foo2(int c, int b) -> void;
  123. // --- import_multiple_ints.carbon
  124. library "[[@TEST_NAME]]";
  125. import Cpp library "multiple_ints.h";
  126. fn F() {
  127. //@dump-sem-ir-begin
  128. Cpp.foo1(1, 2);
  129. Cpp.foo2(3, 4);
  130. //@dump-sem-ir-end
  131. }
  132. // ============================================================================
  133. // Unnamed int
  134. // ============================================================================
  135. // --- unnamed_int.h
  136. auto foo(int) -> void;
  137. // --- import_unnamed_int.carbon
  138. library "[[@TEST_NAME]]";
  139. import Cpp library "unnamed_int.h";
  140. fn F() {
  141. //@dump-sem-ir-begin
  142. Cpp.foo(1);
  143. //@dump-sem-ir-end
  144. }
  145. // ============================================================================
  146. // int default
  147. // ============================================================================
  148. // --- int_default.h
  149. auto foo(int a = 0) -> void;
  150. // --- fail_todo_import_int_default_parameterless_call.carbon
  151. library "[[@TEST_NAME]]";
  152. import Cpp library "int_default.h";
  153. fn F() {
  154. //@dump-sem-ir-begin
  155. // CHECK:STDERR: fail_todo_import_int_default_parameterless_call.carbon:[[@LINE+5]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch]
  156. // CHECK:STDERR: Cpp.foo();
  157. // CHECK:STDERR: ^~~~~~~~~
  158. // CHECK:STDERR: fail_todo_import_int_default_parameterless_call.carbon: note: calling function declared here [InCallToEntity]
  159. // CHECK:STDERR:
  160. Cpp.foo();
  161. //@dump-sem-ir-end
  162. }
  163. // --- import_int_default_sucessful_call.carbon
  164. library "[[@TEST_NAME]]";
  165. import Cpp library "int_default.h";
  166. fn F() {
  167. //@dump-sem-ir-begin
  168. Cpp.foo(1);
  169. //@dump-sem-ir-end
  170. }
  171. // ============================================================================
  172. // const int
  173. // ============================================================================
  174. // --- const_int.h
  175. auto foo(const int a) -> void;
  176. // --- import_const_int.carbon
  177. library "[[@TEST_NAME]]";
  178. import Cpp library "const_int.h";
  179. fn F() {
  180. //@dump-sem-ir-begin
  181. Cpp.foo(1);
  182. //@dump-sem-ir-end
  183. }
  184. // ============================================================================
  185. // int reference
  186. // ============================================================================
  187. // --- int_ref.h
  188. auto foo(int& a) -> int;
  189. // --- fail_todo_import_int_ref.carbon
  190. library "[[@TEST_NAME]]";
  191. import Cpp library "int_ref.h";
  192. fn F() {
  193. var a: i32 = 1;
  194. //@dump-sem-ir-begin
  195. // CHECK:STDERR: fail_todo_import_int_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: int &` [SemanticsTodo]
  196. // CHECK:STDERR: Cpp.foo(a);
  197. // CHECK:STDERR: ^~~~~~~
  198. // CHECK:STDERR: fail_todo_import_int_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  199. // CHECK:STDERR: Cpp.foo(a);
  200. // CHECK:STDERR: ^~~~~~~
  201. // CHECK:STDERR:
  202. Cpp.foo(a);
  203. //@dump-sem-ir-end
  204. }
  205. // ============================================================================
  206. // const int reference
  207. // ============================================================================
  208. // --- const_int_ref.h
  209. auto foo(const int& a) -> int;
  210. // --- fail_todo_import_const_int_ref.carbon
  211. library "[[@TEST_NAME]]";
  212. import Cpp library "const_int_ref.h";
  213. fn F() {
  214. var a : i32 = 1;
  215. //@dump-sem-ir-begin
  216. // CHECK:STDERR: fail_todo_import_const_int_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const int &` [SemanticsTodo]
  217. // CHECK:STDERR: Cpp.foo(a);
  218. // CHECK:STDERR: ^~~~~~~
  219. // CHECK:STDERR: fail_todo_import_const_int_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  220. // CHECK:STDERR: Cpp.foo(a);
  221. // CHECK:STDERR: ^~~~~~~
  222. // CHECK:STDERR:
  223. Cpp.foo(a);
  224. //@dump-sem-ir-end
  225. }
  226. // ============================================================================
  227. // int pointer
  228. // ============================================================================
  229. // --- int_pointer.h
  230. auto foo(int* _Nonnull a) -> void;
  231. // --- import_int_pointer.carbon
  232. library "[[@TEST_NAME]]";
  233. import Cpp library "int_pointer.h";
  234. fn F() {
  235. var a: i32 = 1;
  236. //@dump-sem-ir-begin
  237. Cpp.foo(&a);
  238. //@dump-sem-ir-end
  239. }
  240. // ============================================================================
  241. // const int pointer
  242. // ============================================================================
  243. // --- const_int_pointer.h
  244. auto foo(const int* _Nonnull a) -> int;
  245. // --- import_const_int_pointer.carbon
  246. library "[[@TEST_NAME]]";
  247. import Cpp library "const_int_pointer.h";
  248. fn F() {
  249. var a : i32 = 1;
  250. //@dump-sem-ir-begin
  251. Cpp.foo(&a);
  252. //@dump-sem-ir-end
  253. }
  254. // CHECK:STDOUT: --- import_int_max.carbon
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: constants {
  257. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  258. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  259. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  260. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  261. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  262. // CHECK:STDOUT: %int_2147483647.d89: Core.IntLiteral = int_value 2147483647 [concrete]
  263. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  264. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  265. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  266. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  267. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  268. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  269. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  270. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  271. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  272. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  273. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_2147483647.d89, %Convert.956 [concrete]
  274. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  275. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2147483647.d89, %Convert.specific_fn [concrete]
  276. // CHECK:STDOUT: %int_2147483647.a74: %i32 = int_value 2147483647 [concrete]
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: imports {
  280. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  281. // CHECK:STDOUT: .foo = %foo.decl
  282. // CHECK:STDOUT: import Cpp//...
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  285. // CHECK:STDOUT: <elided>
  286. // CHECK:STDOUT: } {
  287. // CHECK:STDOUT: <elided>
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  290. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT:
  293. // CHECK:STDOUT: fn @F() {
  294. // CHECK:STDOUT: !entry:
  295. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  296. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  297. // CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
  298. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  299. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_2147483647, %impl.elem0 [concrete = constants.%Convert.bound]
  300. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  301. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_2147483647, %specific_fn [concrete = constants.%bound_method]
  302. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_2147483647) [concrete = constants.%int_2147483647.a74]
  303. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2147483647.a74]
  304. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_2147483647, %.loc8_11.1 [concrete = constants.%int_2147483647.a74]
  305. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  306. // CHECK:STDOUT: <elided>
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: --- import_int_min.carbon
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: constants {
  312. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  313. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  314. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  315. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  316. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  317. // CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete]
  318. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  319. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  320. // CHECK:STDOUT: %Negate.impl_witness.973: <witness> = impl_witness imports.%Negate.impl_witness_table.b22 [concrete]
  321. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.973) [concrete]
  322. // CHECK:STDOUT: %.d3d: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  323. // CHECK:STDOUT: %Op.type.18a: type = fn_type @Op.2 [concrete]
  324. // CHECK:STDOUT: %Op.99f: %Op.type.18a = struct_value () [concrete]
  325. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_2147483648, %Op.99f [concrete]
  326. // CHECK:STDOUT: %int_-2147483648.3b9: Core.IntLiteral = int_value -2147483648 [concrete]
  327. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  328. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  329. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  330. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  331. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  332. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  333. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  334. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  335. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  336. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  337. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-2147483648.3b9, %Convert.956 [concrete]
  338. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  339. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-2147483648.3b9, %Convert.specific_fn [concrete]
  340. // CHECK:STDOUT: %int_-2147483648.95c: %i32 = int_value -2147483648 [concrete]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: imports {
  344. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  345. // CHECK:STDOUT: .foo = %foo.decl
  346. // CHECK:STDOUT: import Cpp//...
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  349. // CHECK:STDOUT: <elided>
  350. // CHECK:STDOUT: } {
  351. // CHECK:STDOUT: <elided>
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT: %Core.import_ref.abd = import_ref Core//prelude/parts/int_literal, loc13_50, unloaded
  354. // CHECK:STDOUT: %Core.import_ref.5e6: %Op.type.18a = import_ref Core//prelude/parts/int_literal, loc14_31, loaded [concrete = constants.%Op.99f]
  355. // CHECK:STDOUT: %Negate.impl_witness_table.b22 = impl_witness_table (%Core.import_ref.abd, %Core.import_ref.5e6), @impl.0ef [concrete]
  356. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  357. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: fn @F() {
  361. // CHECK:STDOUT: !entry:
  362. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  363. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  364. // CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648]
  365. // CHECK:STDOUT: %impl.elem1: %.d3d = impl_witness_access constants.%Negate.impl_witness.973, element1 [concrete = constants.%Op.99f]
  366. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_2147483648, %impl.elem1 [concrete = constants.%Op.bound]
  367. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc8_11.1(%int_2147483648) [concrete = constants.%int_-2147483648.3b9]
  368. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  369. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int.snegate, %impl.elem0 [concrete = constants.%Convert.bound]
  370. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  371. // CHECK:STDOUT: %bound_method.loc8_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  372. // CHECK:STDOUT: %.loc8_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-2147483648.3b9]
  373. // CHECK:STDOUT: %.loc8_11.2: Core.IntLiteral = converted %int.snegate, %.loc8_11.1 [concrete = constants.%int_-2147483648.3b9]
  374. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.3(%.loc8_11.2) [concrete = constants.%int_-2147483648.95c]
  375. // CHECK:STDOUT: %.loc8_11.3: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_-2147483648.95c]
  376. // CHECK:STDOUT: %.loc8_11.4: %i32 = converted %int.snegate, %.loc8_11.3 [concrete = constants.%int_-2147483648.95c]
  377. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.4)
  378. // CHECK:STDOUT: <elided>
  379. // CHECK:STDOUT: }
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: --- import_signed_int.carbon
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: constants {
  384. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  385. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  386. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  387. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  388. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  389. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  390. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  391. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  392. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  393. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  394. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  395. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  396. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  397. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  398. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  399. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  400. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  401. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  402. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  403. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: imports {
  407. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  408. // CHECK:STDOUT: .foo = %foo.decl
  409. // CHECK:STDOUT: import Cpp//...
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  412. // CHECK:STDOUT: <elided>
  413. // CHECK:STDOUT: } {
  414. // CHECK:STDOUT: <elided>
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  417. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT:
  420. // CHECK:STDOUT: fn @F() {
  421. // CHECK:STDOUT: !entry:
  422. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  423. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  424. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  425. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  426. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  427. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  428. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  429. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  430. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  431. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  432. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  433. // CHECK:STDOUT: <elided>
  434. // CHECK:STDOUT: }
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT: --- import_signed.carbon
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: constants {
  439. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  440. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  441. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  442. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  443. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  444. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  445. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  446. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  447. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  448. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  449. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  450. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  451. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  452. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  453. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  454. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  455. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  456. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  457. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  458. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  459. // CHECK:STDOUT: }
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: imports {
  462. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  463. // CHECK:STDOUT: .foo = %foo.decl
  464. // CHECK:STDOUT: import Cpp//...
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  467. // CHECK:STDOUT: <elided>
  468. // CHECK:STDOUT: } {
  469. // CHECK:STDOUT: <elided>
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  472. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: fn @F() {
  476. // CHECK:STDOUT: !entry:
  477. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  478. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  479. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  480. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  481. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  482. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  483. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  484. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  485. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  486. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  487. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  488. // CHECK:STDOUT: <elided>
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: --- import_int32_t.carbon
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: constants {
  494. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  495. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  496. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  497. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  498. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  499. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  500. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  501. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  502. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  503. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  504. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  505. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  506. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  507. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  508. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  509. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  510. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  511. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  512. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  513. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  514. // CHECK:STDOUT: }
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: imports {
  517. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  518. // CHECK:STDOUT: .foo = %foo.decl
  519. // CHECK:STDOUT: import Cpp//...
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  522. // CHECK:STDOUT: <elided>
  523. // CHECK:STDOUT: } {
  524. // CHECK:STDOUT: <elided>
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  527. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: fn @F() {
  531. // CHECK:STDOUT: !entry:
  532. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  533. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  534. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  535. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  536. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  537. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  538. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  539. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  540. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  541. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  542. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  543. // CHECK:STDOUT: <elided>
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: --- import_ints.carbon
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: constants {
  549. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  550. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  551. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  552. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  553. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  554. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  555. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  556. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  557. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  558. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  559. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  560. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  561. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  562. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  563. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  564. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  565. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  566. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  567. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  568. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  569. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  570. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  571. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  572. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: imports {
  576. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  577. // CHECK:STDOUT: .foo = %foo.decl
  578. // CHECK:STDOUT: import Cpp//...
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  581. // CHECK:STDOUT: <elided>
  582. // CHECK:STDOUT: } {
  583. // CHECK:STDOUT: <elided>
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  586. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  587. // CHECK:STDOUT: }
  588. // CHECK:STDOUT:
  589. // CHECK:STDOUT: fn @F() {
  590. // CHECK:STDOUT: !entry:
  591. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  592. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  593. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  594. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  595. // CHECK:STDOUT: %impl.elem0.loc8_11: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  596. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0.loc8_11 [concrete = constants.%Convert.bound.ab5]
  597. // CHECK:STDOUT: %specific_fn.loc8_11: <specific function> = specific_function %impl.elem0.loc8_11, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  598. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn.loc8_11 [concrete = constants.%bound_method.9a1]
  599. // CHECK:STDOUT: %int.convert_checked.loc8_11: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  600. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked.loc8_11 [concrete = constants.%int_1.5d2]
  601. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  602. // CHECK:STDOUT: %impl.elem0.loc8_14: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  603. // CHECK:STDOUT: %bound_method.loc8_14.1: <bound method> = bound_method %int_2, %impl.elem0.loc8_14 [concrete = constants.%Convert.bound.ef9]
  604. // CHECK:STDOUT: %specific_fn.loc8_14: <specific function> = specific_function %impl.elem0.loc8_14, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  605. // CHECK:STDOUT: %bound_method.loc8_14.2: <bound method> = bound_method %int_2, %specific_fn.loc8_14 [concrete = constants.%bound_method.b92]
  606. // CHECK:STDOUT: %int.convert_checked.loc8_14: init %i32 = call %bound_method.loc8_14.2(%int_2) [concrete = constants.%int_2.ef8]
  607. // CHECK:STDOUT: %.loc8_14.1: %i32 = value_of_initializer %int.convert_checked.loc8_14 [concrete = constants.%int_2.ef8]
  608. // CHECK:STDOUT: %.loc8_14.2: %i32 = converted %int_2, %.loc8_14.1 [concrete = constants.%int_2.ef8]
  609. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2, %.loc8_14.2)
  610. // CHECK:STDOUT: <elided>
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: --- import_multiple_ints.carbon
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: constants {
  616. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  617. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  618. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  619. // CHECK:STDOUT: %foo1.type: type = fn_type @foo1 [concrete]
  620. // CHECK:STDOUT: %foo1: %foo1.type = struct_value () [concrete]
  621. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  622. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  623. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  624. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  625. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  626. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  627. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  628. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  629. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  630. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  631. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  632. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  633. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  634. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  635. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  636. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  637. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  638. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  639. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  640. // CHECK:STDOUT: %foo2.type: type = fn_type @foo2 [concrete]
  641. // CHECK:STDOUT: %foo2: %foo2.type = struct_value () [concrete]
  642. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  643. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  644. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [concrete]
  645. // CHECK:STDOUT: %bound_method.047: <bound method> = bound_method %int_3.1ba, %Convert.specific_fn [concrete]
  646. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  647. // CHECK:STDOUT: %Convert.bound.ac3: <bound method> = bound_method %int_4.0c1, %Convert.956 [concrete]
  648. // CHECK:STDOUT: %bound_method.1da: <bound method> = bound_method %int_4.0c1, %Convert.specific_fn [concrete]
  649. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete]
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: imports {
  653. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  654. // CHECK:STDOUT: .foo1 = %foo1.decl
  655. // CHECK:STDOUT: .foo2 = %foo2.decl
  656. // CHECK:STDOUT: import Cpp//...
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %foo1.decl: %foo1.type = fn_decl @foo1 [concrete = constants.%foo1] {
  659. // CHECK:STDOUT: <elided>
  660. // CHECK:STDOUT: } {
  661. // CHECK:STDOUT: <elided>
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  664. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  665. // CHECK:STDOUT: %foo2.decl: %foo2.type = fn_decl @foo2 [concrete = constants.%foo2] {
  666. // CHECK:STDOUT: <elided>
  667. // CHECK:STDOUT: } {
  668. // CHECK:STDOUT: <elided>
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT: }
  671. // CHECK:STDOUT:
  672. // CHECK:STDOUT: fn @F() {
  673. // CHECK:STDOUT: !entry:
  674. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  675. // CHECK:STDOUT: %foo1.ref: %foo1.type = name_ref foo1, imports.%foo1.decl [concrete = constants.%foo1]
  676. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  677. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  678. // CHECK:STDOUT: %impl.elem0.loc8_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  679. // CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %int_1, %impl.elem0.loc8_12 [concrete = constants.%Convert.bound.ab5]
  680. // CHECK:STDOUT: %specific_fn.loc8_12: <specific function> = specific_function %impl.elem0.loc8_12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  681. // CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %int_1, %specific_fn.loc8_12 [concrete = constants.%bound_method.9a1]
  682. // CHECK:STDOUT: %int.convert_checked.loc8_12: init %i32 = call %bound_method.loc8_12.2(%int_1) [concrete = constants.%int_1.5d2]
  683. // CHECK:STDOUT: %.loc8_12.1: %i32 = value_of_initializer %int.convert_checked.loc8_12 [concrete = constants.%int_1.5d2]
  684. // CHECK:STDOUT: %.loc8_12.2: %i32 = converted %int_1, %.loc8_12.1 [concrete = constants.%int_1.5d2]
  685. // CHECK:STDOUT: %impl.elem0.loc8_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  686. // CHECK:STDOUT: %bound_method.loc8_15.1: <bound method> = bound_method %int_2, %impl.elem0.loc8_15 [concrete = constants.%Convert.bound.ef9]
  687. // CHECK:STDOUT: %specific_fn.loc8_15: <specific function> = specific_function %impl.elem0.loc8_15, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  688. // CHECK:STDOUT: %bound_method.loc8_15.2: <bound method> = bound_method %int_2, %specific_fn.loc8_15 [concrete = constants.%bound_method.b92]
  689. // CHECK:STDOUT: %int.convert_checked.loc8_15: init %i32 = call %bound_method.loc8_15.2(%int_2) [concrete = constants.%int_2.ef8]
  690. // CHECK:STDOUT: %.loc8_15.1: %i32 = value_of_initializer %int.convert_checked.loc8_15 [concrete = constants.%int_2.ef8]
  691. // CHECK:STDOUT: %.loc8_15.2: %i32 = converted %int_2, %.loc8_15.1 [concrete = constants.%int_2.ef8]
  692. // CHECK:STDOUT: %foo1.call: init %empty_tuple.type = call %foo1.ref(%.loc8_12.2, %.loc8_15.2)
  693. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  694. // CHECK:STDOUT: %foo2.ref: %foo2.type = name_ref foo2, imports.%foo2.decl [concrete = constants.%foo2]
  695. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  696. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  697. // CHECK:STDOUT: %impl.elem0.loc9_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  698. // CHECK:STDOUT: %bound_method.loc9_12.1: <bound method> = bound_method %int_3, %impl.elem0.loc9_12 [concrete = constants.%Convert.bound.b30]
  699. // CHECK:STDOUT: %specific_fn.loc9_12: <specific function> = specific_function %impl.elem0.loc9_12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  700. // CHECK:STDOUT: %bound_method.loc9_12.2: <bound method> = bound_method %int_3, %specific_fn.loc9_12 [concrete = constants.%bound_method.047]
  701. // CHECK:STDOUT: %int.convert_checked.loc9_12: init %i32 = call %bound_method.loc9_12.2(%int_3) [concrete = constants.%int_3.822]
  702. // CHECK:STDOUT: %.loc9_12.1: %i32 = value_of_initializer %int.convert_checked.loc9_12 [concrete = constants.%int_3.822]
  703. // CHECK:STDOUT: %.loc9_12.2: %i32 = converted %int_3, %.loc9_12.1 [concrete = constants.%int_3.822]
  704. // CHECK:STDOUT: %impl.elem0.loc9_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  705. // CHECK:STDOUT: %bound_method.loc9_15.1: <bound method> = bound_method %int_4, %impl.elem0.loc9_15 [concrete = constants.%Convert.bound.ac3]
  706. // CHECK:STDOUT: %specific_fn.loc9_15: <specific function> = specific_function %impl.elem0.loc9_15, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  707. // CHECK:STDOUT: %bound_method.loc9_15.2: <bound method> = bound_method %int_4, %specific_fn.loc9_15 [concrete = constants.%bound_method.1da]
  708. // CHECK:STDOUT: %int.convert_checked.loc9_15: init %i32 = call %bound_method.loc9_15.2(%int_4) [concrete = constants.%int_4.940]
  709. // CHECK:STDOUT: %.loc9_15.1: %i32 = value_of_initializer %int.convert_checked.loc9_15 [concrete = constants.%int_4.940]
  710. // CHECK:STDOUT: %.loc9_15.2: %i32 = converted %int_4, %.loc9_15.1 [concrete = constants.%int_4.940]
  711. // CHECK:STDOUT: %foo2.call: init %empty_tuple.type = call %foo2.ref(%.loc9_12.2, %.loc9_15.2)
  712. // CHECK:STDOUT: <elided>
  713. // CHECK:STDOUT: }
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: --- import_unnamed_int.carbon
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: constants {
  718. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  719. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  720. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  721. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  722. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  723. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  724. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  725. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  726. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  727. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  728. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  729. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  730. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  731. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  732. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  733. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  734. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  735. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  736. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  737. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  738. // CHECK:STDOUT: }
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: imports {
  741. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  742. // CHECK:STDOUT: .foo = %foo.decl
  743. // CHECK:STDOUT: import Cpp//...
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  746. // CHECK:STDOUT: <elided>
  747. // CHECK:STDOUT: } {
  748. // CHECK:STDOUT: <elided>
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  751. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: fn @F() {
  755. // CHECK:STDOUT: !entry:
  756. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  757. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  758. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  759. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  760. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  761. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  762. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  763. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  764. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  765. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  766. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  767. // CHECK:STDOUT: <elided>
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT:
  770. // CHECK:STDOUT: --- fail_todo_import_int_default_parameterless_call.carbon
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: constants {
  773. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  774. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT:
  777. // CHECK:STDOUT: imports {
  778. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  779. // CHECK:STDOUT: .foo = %foo.decl
  780. // CHECK:STDOUT: import Cpp//...
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  783. // CHECK:STDOUT: <elided>
  784. // CHECK:STDOUT: } {
  785. // CHECK:STDOUT: <elided>
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT:
  789. // CHECK:STDOUT: fn @F() {
  790. // CHECK:STDOUT: !entry:
  791. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  792. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  793. // CHECK:STDOUT: <elided>
  794. // CHECK:STDOUT: }
  795. // CHECK:STDOUT:
  796. // CHECK:STDOUT: --- import_int_default_sucessful_call.carbon
  797. // CHECK:STDOUT:
  798. // CHECK:STDOUT: constants {
  799. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  800. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  801. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  802. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  803. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  804. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  805. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  806. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  807. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  808. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  809. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  810. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  811. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  812. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  813. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  814. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  815. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  816. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  817. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  818. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  819. // CHECK:STDOUT: }
  820. // CHECK:STDOUT:
  821. // CHECK:STDOUT: imports {
  822. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  823. // CHECK:STDOUT: .foo = %foo.decl
  824. // CHECK:STDOUT: import Cpp//...
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  827. // CHECK:STDOUT: <elided>
  828. // CHECK:STDOUT: } {
  829. // CHECK:STDOUT: <elided>
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  832. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: fn @F() {
  836. // CHECK:STDOUT: !entry:
  837. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  838. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  839. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  840. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  841. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  842. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  843. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  844. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  845. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  846. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  847. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  848. // CHECK:STDOUT: <elided>
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: --- import_const_int.carbon
  852. // CHECK:STDOUT:
  853. // CHECK:STDOUT: constants {
  854. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  855. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  856. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  857. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  858. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  859. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  860. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  861. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  862. // CHECK:STDOUT: %To: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  863. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To) [symbolic]
  864. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  865. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  866. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  867. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  868. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  869. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  870. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  871. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  872. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  873. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  874. // CHECK:STDOUT: }
  875. // CHECK:STDOUT:
  876. // CHECK:STDOUT: imports {
  877. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  878. // CHECK:STDOUT: .foo = %foo.decl
  879. // CHECK:STDOUT: import Cpp//...
  880. // CHECK:STDOUT: }
  881. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  882. // CHECK:STDOUT: <elided>
  883. // CHECK:STDOUT: } {
  884. // CHECK:STDOUT: <elided>
  885. // CHECK:STDOUT: }
  886. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/parts/int, loc16_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  887. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: fn @F() {
  891. // CHECK:STDOUT: !entry:
  892. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  893. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  894. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  895. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  896. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  897. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  898. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  899. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc8_11.2(%int_1) [concrete = constants.%int_1.5d2]
  900. // CHECK:STDOUT: %.loc8_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  901. // CHECK:STDOUT: %.loc8_11.2: %i32 = converted %int_1, %.loc8_11.1 [concrete = constants.%int_1.5d2]
  902. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc8_11.2)
  903. // CHECK:STDOUT: <elided>
  904. // CHECK:STDOUT: }
  905. // CHECK:STDOUT:
  906. // CHECK:STDOUT: --- fail_todo_import_int_ref.carbon
  907. // CHECK:STDOUT:
  908. // CHECK:STDOUT: constants {
  909. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  910. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  911. // CHECK:STDOUT: }
  912. // CHECK:STDOUT:
  913. // CHECK:STDOUT: imports {
  914. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  915. // CHECK:STDOUT: .foo = <error>
  916. // CHECK:STDOUT: import Cpp//...
  917. // CHECK:STDOUT: }
  918. // CHECK:STDOUT: }
  919. // CHECK:STDOUT:
  920. // CHECK:STDOUT: fn @F() {
  921. // CHECK:STDOUT: !entry:
  922. // CHECK:STDOUT: <elided>
  923. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  924. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  925. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  926. // CHECK:STDOUT: <elided>
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: --- fail_todo_import_const_int_ref.carbon
  930. // CHECK:STDOUT:
  931. // CHECK:STDOUT: constants {
  932. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  933. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  934. // CHECK:STDOUT: }
  935. // CHECK:STDOUT:
  936. // CHECK:STDOUT: imports {
  937. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  938. // CHECK:STDOUT: .foo = <error>
  939. // CHECK:STDOUT: import Cpp//...
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT: }
  942. // CHECK:STDOUT:
  943. // CHECK:STDOUT: fn @F() {
  944. // CHECK:STDOUT: !entry:
  945. // CHECK:STDOUT: <elided>
  946. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  947. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  948. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  949. // CHECK:STDOUT: <elided>
  950. // CHECK:STDOUT: }
  951. // CHECK:STDOUT:
  952. // CHECK:STDOUT: --- import_int_pointer.carbon
  953. // CHECK:STDOUT:
  954. // CHECK:STDOUT: constants {
  955. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  956. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  957. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  958. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  959. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  960. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  961. // CHECK:STDOUT: }
  962. // CHECK:STDOUT:
  963. // CHECK:STDOUT: imports {
  964. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  965. // CHECK:STDOUT: .foo = %foo.decl
  966. // CHECK:STDOUT: import Cpp//...
  967. // CHECK:STDOUT: }
  968. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  969. // CHECK:STDOUT: <elided>
  970. // CHECK:STDOUT: } {
  971. // CHECK:STDOUT: <elided>
  972. // CHECK:STDOUT: }
  973. // CHECK:STDOUT: }
  974. // CHECK:STDOUT:
  975. // CHECK:STDOUT: fn @F() {
  976. // CHECK:STDOUT: !entry:
  977. // CHECK:STDOUT: <elided>
  978. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  979. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  980. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  981. // CHECK:STDOUT: %addr.loc9: %ptr.235 = addr_of %a.ref
  982. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%addr.loc9)
  983. // CHECK:STDOUT: <elided>
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT:
  986. // CHECK:STDOUT: --- import_const_int_pointer.carbon
  987. // CHECK:STDOUT:
  988. // CHECK:STDOUT: constants {
  989. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  990. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  991. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  992. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  993. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  994. // CHECK:STDOUT: }
  995. // CHECK:STDOUT:
  996. // CHECK:STDOUT: imports {
  997. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  998. // CHECK:STDOUT: .foo = %foo.decl
  999. // CHECK:STDOUT: import Cpp//...
  1000. // CHECK:STDOUT: }
  1001. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1002. // CHECK:STDOUT: <elided>
  1003. // CHECK:STDOUT: } {
  1004. // CHECK:STDOUT: <elided>
  1005. // CHECK:STDOUT: }
  1006. // CHECK:STDOUT: }
  1007. // CHECK:STDOUT:
  1008. // CHECK:STDOUT: fn @F() {
  1009. // CHECK:STDOUT: !entry:
  1010. // CHECK:STDOUT: <elided>
  1011. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1012. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, imports.%foo.decl [concrete = constants.%foo]
  1013. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  1014. // CHECK:STDOUT: %addr.loc9: %ptr.235 = addr_of %a.ref
  1015. // CHECK:STDOUT: %foo.call: init %i32 = call %foo.ref(%addr.loc9)
  1016. // CHECK:STDOUT: <elided>
  1017. // CHECK:STDOUT: }
  1018. // CHECK:STDOUT: