function_param_int16.carbon 98 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598
  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/interop/cpp/function_param_int16.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function_param_int16.carbon
  10. // ============================================================================
  11. // short
  12. // ============================================================================
  13. // --- short.h
  14. auto foo(short a) -> void;
  15. // --- import_short.carbon
  16. library "[[@TEST_NAME]]";
  17. import Cpp library "short.h";
  18. fn F() {
  19. Cpp.foo(1 as i16);
  20. }
  21. // --- import_short_max.carbon
  22. library "[[@TEST_NAME]]";
  23. import Cpp library "short.h";
  24. fn F() {
  25. Cpp.foo(0x7FFF);
  26. }
  27. // --- fail_import_short_overflow_max.carbon
  28. library "[[@TEST_NAME]]";
  29. import Cpp library "short.h";
  30. fn F() {
  31. // CHECK:STDERR: fail_import_short_overflow_max.carbon:[[@LINE+5]]:11: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
  32. // CHECK:STDERR: Cpp.foo(0x8000);
  33. // CHECK:STDERR: ^~~~~~
  34. // CHECK:STDERR: fail_import_short_overflow_max.carbon: note: initializing function parameter [InCallToFunctionParam]
  35. // CHECK:STDERR:
  36. Cpp.foo(0x8000);
  37. }
  38. // --- import_short_min.carbon
  39. library "[[@TEST_NAME]]";
  40. import Cpp library "short.h";
  41. fn F() {
  42. Cpp.foo(-0x8000);
  43. }
  44. // --- fail_import_short_overflow_min.carbon
  45. library "[[@TEST_NAME]]";
  46. import Cpp library "short.h";
  47. fn F() {
  48. // CHECK:STDERR: fail_import_short_overflow_min.carbon:[[@LINE+5]]:11: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
  49. // CHECK:STDERR: Cpp.foo(-0x8001);
  50. // CHECK:STDERR: ^~~~~~~
  51. // CHECK:STDERR: fail_import_short_overflow_min.carbon: note: initializing function parameter [InCallToFunctionParam]
  52. // CHECK:STDERR:
  53. Cpp.foo(-0x8001);
  54. }
  55. // --- fail_import_short_int32_arg.carbon
  56. library "[[@TEST_NAME]]";
  57. import Cpp library "short.h";
  58. fn F() {
  59. // CHECK:STDERR: fail_import_short_int32_arg.carbon:[[@LINE+8]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
  60. // CHECK:STDERR: Cpp.foo(1 as i32);
  61. // CHECK:STDERR: ^~~~~~~~
  62. // CHECK:STDERR: fail_import_short_int32_arg.carbon:[[@LINE+5]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote]
  63. // CHECK:STDERR: Cpp.foo(1 as i32);
  64. // CHECK:STDERR: ^~~~~~~~
  65. // CHECK:STDERR: fail_import_short_int32_arg.carbon: note: initializing function parameter [InCallToFunctionParam]
  66. // CHECK:STDERR:
  67. Cpp.foo(1 as i32);
  68. }
  69. // ============================================================================
  70. // short int
  71. // ============================================================================
  72. // --- short_int.h
  73. auto foo(short int a) -> void;
  74. // --- import_short_int.carbon
  75. library "[[@TEST_NAME]]";
  76. import Cpp library "short_int.h";
  77. fn F() {
  78. Cpp.foo(1 as i16);
  79. }
  80. // ============================================================================
  81. // signed short
  82. // ============================================================================
  83. // --- signed_short.h
  84. auto foo(signed short a) -> void;
  85. // --- import_signed_short.carbon
  86. library "[[@TEST_NAME]]";
  87. import Cpp library "signed_short.h";
  88. fn F() {
  89. Cpp.foo(1 as i16);
  90. }
  91. // ============================================================================
  92. // signed short int
  93. // ============================================================================
  94. // --- signed_short_int.h
  95. auto foo(signed short int a) -> void;
  96. // --- import_signed_short_int.carbon
  97. library "[[@TEST_NAME]]";
  98. import Cpp library "signed_short_int.h";
  99. fn F() {
  100. Cpp.foo(1 as i16);
  101. }
  102. // ============================================================================
  103. // int16_t
  104. // ============================================================================
  105. // --- int16_t.h
  106. namespace std {
  107. // Mimicking glibc definition for int16_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int16_t
  108. typedef signed short int int16_t;
  109. } // namespace std
  110. auto foo(std::int16_t a) -> void;
  111. // --- import_int16_t.carbon
  112. library "[[@TEST_NAME]]";
  113. import Cpp library "int16_t.h";
  114. fn F() {
  115. Cpp.foo(1 as i16);
  116. }
  117. // ============================================================================
  118. // const short
  119. // ============================================================================
  120. // --- const_short.h
  121. auto foo(const short a) -> void;
  122. // --- import_const_short.carbon
  123. library "[[@TEST_NAME]]";
  124. import Cpp library "const_short.h";
  125. fn F() {
  126. Cpp.foo(1 as i16);
  127. }
  128. // ============================================================================
  129. // short reference
  130. // ============================================================================
  131. // --- short_ref.h
  132. auto foo(short& a) -> void;
  133. // --- fail_todo_import_short_ref.carbon
  134. library "[[@TEST_NAME]]";
  135. import Cpp library "short_ref.h";
  136. fn F() {
  137. var a: i16 = 1;
  138. // CHECK:STDERR: fail_todo_import_short_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short &` [SemanticsTodo]
  139. // CHECK:STDERR: Cpp.foo(a);
  140. // CHECK:STDERR: ^~~~~~~
  141. // CHECK:STDERR: fail_todo_import_short_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  142. // CHECK:STDERR: Cpp.foo(a);
  143. // CHECK:STDERR: ^~~~~~~
  144. // CHECK:STDERR:
  145. Cpp.foo(a);
  146. }
  147. // ============================================================================
  148. // const short reference
  149. // ============================================================================
  150. // --- const_short_ref.h
  151. auto foo(const short& a) -> void;
  152. // --- fail_todo_import_const_short_ref.carbon
  153. library "[[@TEST_NAME]]";
  154. import Cpp library "const_short_ref.h";
  155. fn F() {
  156. var a: i16 = 1;
  157. // CHECK:STDERR: fail_todo_import_const_short_ref.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short &` [SemanticsTodo]
  158. // CHECK:STDERR: Cpp.foo(a);
  159. // CHECK:STDERR: ^~~~~~~
  160. // CHECK:STDERR: fail_todo_import_const_short_ref.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  161. // CHECK:STDERR: Cpp.foo(a);
  162. // CHECK:STDERR: ^~~~~~~
  163. // CHECK:STDERR:
  164. Cpp.foo(a);
  165. }
  166. // ============================================================================
  167. // short pointer
  168. // ============================================================================
  169. // --- short_pointer.h
  170. auto foo(short* a) -> void;
  171. // --- fail_todo_import_short_pointer.carbon
  172. library "[[@TEST_NAME]]";
  173. import Cpp library "short_pointer.h";
  174. fn F() {
  175. var a: i16 = 1;
  176. // CHECK:STDERR: fail_todo_import_short_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short *` [SemanticsTodo]
  177. // CHECK:STDERR: Cpp.foo(&a);
  178. // CHECK:STDERR: ^~~~~~~
  179. // CHECK:STDERR: fail_todo_import_short_pointer.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  180. // CHECK:STDERR: Cpp.foo(&a);
  181. // CHECK:STDERR: ^~~~~~~
  182. // CHECK:STDERR:
  183. Cpp.foo(&a);
  184. }
  185. // ============================================================================
  186. // const short pointer
  187. // ============================================================================
  188. // --- const_short_pointer.h
  189. auto foo(const short* a) -> void;
  190. // --- fail_todo_import_const_short_pointer.carbon
  191. library "[[@TEST_NAME]]";
  192. import Cpp library "const_short_pointer.h";
  193. fn F() {
  194. var a: i16 = 1;
  195. // CHECK:STDERR: fail_todo_import_const_short_pointer.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short *` [SemanticsTodo]
  196. // CHECK:STDERR: Cpp.foo(&a);
  197. // CHECK:STDERR: ^~~~~~~
  198. // CHECK:STDERR: fail_todo_import_const_short_pointer.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. }
  204. // CHECK:STDOUT: --- import_short.carbon
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: constants {
  207. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  208. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  209. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  210. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  211. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  212. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  213. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  214. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  215. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  216. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  217. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  218. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  219. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  220. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  221. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  222. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  223. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  224. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  225. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  226. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  227. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  228. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  229. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  230. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  231. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  232. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: imports {
  236. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  237. // CHECK:STDOUT: .Int = %Core.Int
  238. // CHECK:STDOUT: .As = %Core.As
  239. // CHECK:STDOUT: import Core//prelude
  240. // CHECK:STDOUT: import Core//prelude/...
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  243. // CHECK:STDOUT: .foo = @F.%foo.decl
  244. // CHECK:STDOUT: import Cpp//...
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  247. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  248. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  249. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: file {
  253. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  254. // CHECK:STDOUT: .Core = imports.%Core
  255. // CHECK:STDOUT: .Cpp = imports.%Cpp
  256. // CHECK:STDOUT: .F = %F.decl
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT: %Core.import = import Core
  259. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  260. // CHECK:STDOUT: import Cpp "short.h"
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  263. // CHECK:STDOUT: }
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: fn @F() {
  266. // CHECK:STDOUT: !entry:
  267. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  268. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  269. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  270. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  271. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  272. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  273. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  274. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  275. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  276. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  277. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  278. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  279. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  280. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  281. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  282. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  283. // CHECK:STDOUT: return
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: fn @foo();
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: --- import_short_max.carbon
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: constants {
  291. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  292. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  293. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  294. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  295. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  296. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  297. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  298. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  299. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  300. // CHECK:STDOUT: %int_32767.f4b: Core.IntLiteral = int_value 32767 [concrete]
  301. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  302. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  303. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  304. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  305. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  306. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  307. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  308. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  309. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  310. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  311. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  312. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  313. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_32767.f4b, %Convert.d0a [concrete]
  314. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  315. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_32767.f4b, %Convert.specific_fn [concrete]
  316. // CHECK:STDOUT: %int_32767.faa: %i16 = int_value 32767 [concrete]
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: imports {
  320. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  321. // CHECK:STDOUT: .Int = %Core.Int
  322. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  323. // CHECK:STDOUT: import Core//prelude
  324. // CHECK:STDOUT: import Core//prelude/...
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  327. // CHECK:STDOUT: .foo = @F.%foo.decl
  328. // CHECK:STDOUT: import Cpp//...
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  331. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  332. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  333. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: file {
  337. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  338. // CHECK:STDOUT: .Core = imports.%Core
  339. // CHECK:STDOUT: .Cpp = imports.%Cpp
  340. // CHECK:STDOUT: .F = %F.decl
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %Core.import = import Core
  343. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  344. // CHECK:STDOUT: import Cpp "short.h"
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: fn @F() {
  350. // CHECK:STDOUT: !entry:
  351. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  352. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  353. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  354. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  355. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  356. // CHECK:STDOUT: %int_32767: Core.IntLiteral = int_value 32767 [concrete = constants.%int_32767.f4b]
  357. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  358. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_32767, %impl.elem0 [concrete = constants.%Convert.bound]
  359. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  360. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_32767, %specific_fn [concrete = constants.%bound_method]
  361. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.2(%int_32767) [concrete = constants.%int_32767.faa]
  362. // CHECK:STDOUT: %.loc7_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32767.faa]
  363. // CHECK:STDOUT: %.loc7_11.2: %i16 = converted %int_32767, %.loc7_11.1 [concrete = constants.%int_32767.faa]
  364. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  365. // CHECK:STDOUT: return
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: fn @foo();
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: --- fail_import_short_overflow_max.carbon
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: constants {
  373. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  374. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  375. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  376. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  377. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  378. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  379. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  380. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  381. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  382. // CHECK:STDOUT: %int_32768.4d0: Core.IntLiteral = int_value 32768 [concrete]
  383. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  384. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  385. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  386. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  387. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  388. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  389. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  390. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  391. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  392. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  393. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  394. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  395. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_32768.4d0, %Convert.d0a [concrete]
  396. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  397. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_32768.4d0, %Convert.specific_fn [concrete]
  398. // CHECK:STDOUT: %int_32768.e7f: %i16 = int_value 32768 [concrete]
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: imports {
  402. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  403. // CHECK:STDOUT: .Int = %Core.Int
  404. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  405. // CHECK:STDOUT: import Core//prelude
  406. // CHECK:STDOUT: import Core//prelude/...
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  409. // CHECK:STDOUT: .foo = @F.%foo.decl
  410. // CHECK:STDOUT: import Cpp//...
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  413. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  414. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  415. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: file {
  419. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  420. // CHECK:STDOUT: .Core = imports.%Core
  421. // CHECK:STDOUT: .Cpp = imports.%Cpp
  422. // CHECK:STDOUT: .F = %F.decl
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: %Core.import = import Core
  425. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  426. // CHECK:STDOUT: import Cpp "short.h"
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: fn @F() {
  432. // CHECK:STDOUT: !entry:
  433. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  434. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  435. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  436. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  437. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  438. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768.4d0]
  439. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  440. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_32768, %impl.elem0 [concrete = constants.%Convert.bound]
  441. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  442. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int_32768, %specific_fn [concrete = constants.%bound_method]
  443. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.2(%int_32768) [concrete = constants.%int_32768.e7f]
  444. // CHECK:STDOUT: %.loc12_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32768.e7f]
  445. // CHECK:STDOUT: %.loc12_11.2: %i16 = converted %int_32768, %.loc12_11.1 [concrete = constants.%int_32768.e7f]
  446. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.2)
  447. // CHECK:STDOUT: return
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: fn @foo();
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: --- import_short_min.carbon
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: constants {
  455. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  456. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  457. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  458. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  459. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  460. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  461. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  462. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  463. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  464. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete]
  465. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  466. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  467. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  468. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  469. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  470. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  471. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  472. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_32768, %Op.bba [concrete]
  473. // CHECK:STDOUT: %int_-32768.882: Core.IntLiteral = int_value -32768 [concrete]
  474. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  475. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  476. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  477. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  478. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  479. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  480. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  481. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  482. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  483. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  484. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  485. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  486. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-32768.882, %Convert.d0a [concrete]
  487. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  488. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-32768.882, %Convert.specific_fn [concrete]
  489. // CHECK:STDOUT: %int_-32768.7e5: %i16 = int_value -32768 [concrete]
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: imports {
  493. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  494. // CHECK:STDOUT: .Int = %Core.Int
  495. // CHECK:STDOUT: .Negate = %Core.Negate
  496. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  497. // CHECK:STDOUT: import Core//prelude
  498. // CHECK:STDOUT: import Core//prelude/...
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  501. // CHECK:STDOUT: .foo = @F.%foo.decl
  502. // CHECK:STDOUT: import Cpp//...
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  505. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  506. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  507. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  508. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  509. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  510. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: file {
  514. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  515. // CHECK:STDOUT: .Core = imports.%Core
  516. // CHECK:STDOUT: .Cpp = imports.%Cpp
  517. // CHECK:STDOUT: .F = %F.decl
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT: %Core.import = import Core
  520. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  521. // CHECK:STDOUT: import Cpp "short.h"
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  524. // CHECK:STDOUT: }
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: fn @F() {
  527. // CHECK:STDOUT: !entry:
  528. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  529. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  530. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  531. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  532. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  533. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768]
  534. // CHECK:STDOUT: %impl.elem0.loc7_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  535. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_32768, %impl.elem0.loc7_11.1 [concrete = constants.%Op.bound]
  536. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc7_11.1(%int_32768) [concrete = constants.%int_-32768.882]
  537. // CHECK:STDOUT: %impl.elem0.loc7_11.2: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  538. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc7_11.2 [concrete = constants.%Convert.bound]
  539. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc7_11.2, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  540. // CHECK:STDOUT: %bound_method.loc7_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  541. // CHECK:STDOUT: %.loc7_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32768.882]
  542. // CHECK:STDOUT: %.loc7_11.2: Core.IntLiteral = converted %int.snegate, %.loc7_11.1 [concrete = constants.%int_-32768.882]
  543. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.3(%.loc7_11.2) [concrete = constants.%int_-32768.7e5]
  544. // CHECK:STDOUT: %.loc7_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32768.7e5]
  545. // CHECK:STDOUT: %.loc7_11.4: %i16 = converted %int.snegate, %.loc7_11.3 [concrete = constants.%int_-32768.7e5]
  546. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.4)
  547. // CHECK:STDOUT: return
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: fn @foo();
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: --- fail_import_short_overflow_min.carbon
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: constants {
  555. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  556. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  557. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  558. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  559. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  560. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  561. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  562. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  563. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  564. // CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete]
  565. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  566. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  567. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  568. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  569. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  570. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  571. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  572. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_32769, %Op.bba [concrete]
  573. // CHECK:STDOUT: %int_-32769.5a5: Core.IntLiteral = int_value -32769 [concrete]
  574. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  575. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  576. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  577. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  578. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  579. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  580. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  581. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  582. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  583. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  584. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  585. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  586. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-32769.5a5, %Convert.d0a [concrete]
  587. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  588. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-32769.5a5, %Convert.specific_fn [concrete]
  589. // CHECK:STDOUT: %int_-32769.883: %i16 = int_value -32769 [concrete]
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: imports {
  593. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  594. // CHECK:STDOUT: .Int = %Core.Int
  595. // CHECK:STDOUT: .Negate = %Core.Negate
  596. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  597. // CHECK:STDOUT: import Core//prelude
  598. // CHECK:STDOUT: import Core//prelude/...
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  601. // CHECK:STDOUT: .foo = @F.%foo.decl
  602. // CHECK:STDOUT: import Cpp//...
  603. // CHECK:STDOUT: }
  604. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  605. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  606. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  607. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  608. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  609. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  610. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  611. // CHECK:STDOUT: }
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: file {
  614. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  615. // CHECK:STDOUT: .Core = imports.%Core
  616. // CHECK:STDOUT: .Cpp = imports.%Cpp
  617. // CHECK:STDOUT: .F = %F.decl
  618. // CHECK:STDOUT: }
  619. // CHECK:STDOUT: %Core.import = import Core
  620. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  621. // CHECK:STDOUT: import Cpp "short.h"
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: fn @F() {
  627. // CHECK:STDOUT: !entry:
  628. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  629. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  630. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  631. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  632. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  633. // CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete = constants.%int_32769]
  634. // CHECK:STDOUT: %impl.elem0.loc12_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  635. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_32769, %impl.elem0.loc12_11.1 [concrete = constants.%Op.bound]
  636. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc12_11.1(%int_32769) [concrete = constants.%int_-32769.5a5]
  637. // CHECK:STDOUT: %impl.elem0.loc12_11.2: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  638. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc12_11.2 [concrete = constants.%Convert.bound]
  639. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc12_11.2, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  640. // CHECK:STDOUT: %bound_method.loc12_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  641. // CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32769.5a5]
  642. // CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate, %.loc12_11.1 [concrete = constants.%int_-32769.5a5]
  643. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.3(%.loc12_11.2) [concrete = constants.%int_-32769.883]
  644. // CHECK:STDOUT: %.loc12_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32769.883]
  645. // CHECK:STDOUT: %.loc12_11.4: %i16 = converted %int.snegate, %.loc12_11.3 [concrete = constants.%int_-32769.883]
  646. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.4)
  647. // CHECK:STDOUT: return
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: fn @foo();
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: --- fail_import_short_int32_arg.carbon
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: constants {
  655. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  656. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  657. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  658. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  659. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  660. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  661. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  662. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  663. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  664. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  665. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  666. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  667. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  668. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  669. // CHECK:STDOUT: %As.type.fd4: type = facet_type <@As, @As(%i32)> [concrete]
  670. // CHECK:STDOUT: %Convert.type.99b: type = fn_type @Convert.1, @As(%i32) [concrete]
  671. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  672. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  673. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  674. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  675. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  676. // CHECK:STDOUT: %As.impl_witness.6b4: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_32) [concrete]
  677. // CHECK:STDOUT: %Convert.type.4fd: type = fn_type @Convert.5, @impl.686(%int_32) [concrete]
  678. // CHECK:STDOUT: %Convert.197: %Convert.type.4fd = struct_value () [concrete]
  679. // CHECK:STDOUT: %As.facet: %As.type.fd4 = facet_value Core.IntLiteral, (%As.impl_witness.6b4) [concrete]
  680. // CHECK:STDOUT: %.982: type = fn_type_with_self_type %Convert.type.99b, %As.facet [concrete]
  681. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.197 [concrete]
  682. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.197, @Convert.5(%int_32) [concrete]
  683. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  684. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: imports {
  688. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  689. // CHECK:STDOUT: .Int = %Core.Int
  690. // CHECK:STDOUT: .As = %Core.As
  691. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  692. // CHECK:STDOUT: import Core//prelude
  693. // CHECK:STDOUT: import Core//prelude/...
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  696. // CHECK:STDOUT: .foo = @F.%foo.decl
  697. // CHECK:STDOUT: import Cpp//...
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  700. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  701. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  702. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  703. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: file {
  707. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  708. // CHECK:STDOUT: .Core = imports.%Core
  709. // CHECK:STDOUT: .Cpp = imports.%Cpp
  710. // CHECK:STDOUT: .F = %F.decl
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT: %Core.import = import Core
  713. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  714. // CHECK:STDOUT: import Cpp "short.h"
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  717. // CHECK:STDOUT: }
  718. // CHECK:STDOUT:
  719. // CHECK:STDOUT: fn @F() {
  720. // CHECK:STDOUT: !entry:
  721. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  722. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  723. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  724. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  725. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  726. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  727. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  728. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  729. // CHECK:STDOUT: %impl.elem0: %.982 = impl_witness_access constants.%As.impl_witness.6b4, element0 [concrete = constants.%Convert.197]
  730. // CHECK:STDOUT: %bound_method.loc15_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  731. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  732. // CHECK:STDOUT: %bound_method.loc15_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  733. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc15_13.2(%int_1) [concrete = constants.%int_1.5d2]
  734. // CHECK:STDOUT: %.loc15_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  735. // CHECK:STDOUT: %.loc15_13.2: %i32 = converted %int_1, %.loc15_13.1 [concrete = constants.%int_1.5d2]
  736. // CHECK:STDOUT: %.loc15_13.3: %i16 = converted %.loc15_13.2, <error> [concrete = <error>]
  737. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(<error>)
  738. // CHECK:STDOUT: return
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT:
  741. // CHECK:STDOUT: fn @foo();
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: --- import_short_int.carbon
  744. // CHECK:STDOUT:
  745. // CHECK:STDOUT: constants {
  746. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  747. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  748. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  749. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  750. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  751. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  752. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  753. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  754. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  755. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  756. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  757. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  758. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  759. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  760. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  761. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  762. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  763. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  764. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  765. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  766. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  767. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  768. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  769. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  770. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  771. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: imports {
  775. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  776. // CHECK:STDOUT: .Int = %Core.Int
  777. // CHECK:STDOUT: .As = %Core.As
  778. // CHECK:STDOUT: import Core//prelude
  779. // CHECK:STDOUT: import Core//prelude/...
  780. // CHECK:STDOUT: }
  781. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  782. // CHECK:STDOUT: .foo = @F.%foo.decl
  783. // CHECK:STDOUT: import Cpp//...
  784. // CHECK:STDOUT: }
  785. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  786. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  787. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  788. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: file {
  792. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  793. // CHECK:STDOUT: .Core = imports.%Core
  794. // CHECK:STDOUT: .Cpp = imports.%Cpp
  795. // CHECK:STDOUT: .F = %F.decl
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT: %Core.import = import Core
  798. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  799. // CHECK:STDOUT: import Cpp "short_int.h"
  800. // CHECK:STDOUT: }
  801. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  802. // CHECK:STDOUT: }
  803. // CHECK:STDOUT:
  804. // CHECK:STDOUT: fn @F() {
  805. // CHECK:STDOUT: !entry:
  806. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  807. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  808. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  809. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  810. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  811. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  812. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  813. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  814. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  815. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  816. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  817. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  818. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  819. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  820. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  821. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  822. // CHECK:STDOUT: return
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: fn @foo();
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: --- import_signed_short.carbon
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: constants {
  830. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  831. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  832. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  833. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  834. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  835. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  836. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  837. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  838. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  839. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  840. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  841. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  842. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  843. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  844. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  845. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  846. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  847. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  848. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  849. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  850. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  851. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  852. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  853. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  854. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  855. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  856. // CHECK:STDOUT: }
  857. // CHECK:STDOUT:
  858. // CHECK:STDOUT: imports {
  859. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  860. // CHECK:STDOUT: .Int = %Core.Int
  861. // CHECK:STDOUT: .As = %Core.As
  862. // CHECK:STDOUT: import Core//prelude
  863. // CHECK:STDOUT: import Core//prelude/...
  864. // CHECK:STDOUT: }
  865. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  866. // CHECK:STDOUT: .foo = @F.%foo.decl
  867. // CHECK:STDOUT: import Cpp//...
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  870. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  871. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  872. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: file {
  876. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  877. // CHECK:STDOUT: .Core = imports.%Core
  878. // CHECK:STDOUT: .Cpp = imports.%Cpp
  879. // CHECK:STDOUT: .F = %F.decl
  880. // CHECK:STDOUT: }
  881. // CHECK:STDOUT: %Core.import = import Core
  882. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  883. // CHECK:STDOUT: import Cpp "signed_short.h"
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  886. // CHECK:STDOUT: }
  887. // CHECK:STDOUT:
  888. // CHECK:STDOUT: fn @F() {
  889. // CHECK:STDOUT: !entry:
  890. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  891. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  892. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  893. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  894. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  895. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  896. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  897. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  898. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  899. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  900. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  901. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  902. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  903. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  904. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  905. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  906. // CHECK:STDOUT: return
  907. // CHECK:STDOUT: }
  908. // CHECK:STDOUT:
  909. // CHECK:STDOUT: fn @foo();
  910. // CHECK:STDOUT:
  911. // CHECK:STDOUT: --- import_signed_short_int.carbon
  912. // CHECK:STDOUT:
  913. // CHECK:STDOUT: constants {
  914. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  915. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  916. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  917. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  918. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  919. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  920. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  921. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  922. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  923. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  924. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  925. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  926. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  927. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  928. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  929. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  930. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  931. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  932. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  933. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  934. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  935. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  936. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  937. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  938. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  939. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: imports {
  943. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  944. // CHECK:STDOUT: .Int = %Core.Int
  945. // CHECK:STDOUT: .As = %Core.As
  946. // CHECK:STDOUT: import Core//prelude
  947. // CHECK:STDOUT: import Core//prelude/...
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  950. // CHECK:STDOUT: .foo = @F.%foo.decl
  951. // CHECK:STDOUT: import Cpp//...
  952. // CHECK:STDOUT: }
  953. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  954. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  955. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  956. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: file {
  960. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  961. // CHECK:STDOUT: .Core = imports.%Core
  962. // CHECK:STDOUT: .Cpp = imports.%Cpp
  963. // CHECK:STDOUT: .F = %F.decl
  964. // CHECK:STDOUT: }
  965. // CHECK:STDOUT: %Core.import = import Core
  966. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  967. // CHECK:STDOUT: import Cpp "signed_short_int.h"
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  970. // CHECK:STDOUT: }
  971. // CHECK:STDOUT:
  972. // CHECK:STDOUT: fn @F() {
  973. // CHECK:STDOUT: !entry:
  974. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  975. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  976. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  977. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  978. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  979. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  980. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  981. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  982. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  983. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  984. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  985. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  986. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  987. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  988. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  989. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  990. // CHECK:STDOUT: return
  991. // CHECK:STDOUT: }
  992. // CHECK:STDOUT:
  993. // CHECK:STDOUT: fn @foo();
  994. // CHECK:STDOUT:
  995. // CHECK:STDOUT: --- import_int16_t.carbon
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: constants {
  998. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  999. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1000. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1001. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1002. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1003. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1004. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1005. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1006. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1007. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1008. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  1009. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  1010. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  1011. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  1012. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1013. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  1014. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  1015. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  1016. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  1017. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  1018. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  1019. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  1020. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  1021. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  1022. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1023. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1024. // CHECK:STDOUT: }
  1025. // CHECK:STDOUT:
  1026. // CHECK:STDOUT: imports {
  1027. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1028. // CHECK:STDOUT: .Int = %Core.Int
  1029. // CHECK:STDOUT: .As = %Core.As
  1030. // CHECK:STDOUT: import Core//prelude
  1031. // CHECK:STDOUT: import Core//prelude/...
  1032. // CHECK:STDOUT: }
  1033. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1034. // CHECK:STDOUT: .foo = @F.%foo.decl
  1035. // CHECK:STDOUT: import Cpp//...
  1036. // CHECK:STDOUT: }
  1037. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1038. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  1039. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  1040. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  1041. // CHECK:STDOUT: }
  1042. // CHECK:STDOUT:
  1043. // CHECK:STDOUT: file {
  1044. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1045. // CHECK:STDOUT: .Core = imports.%Core
  1046. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1047. // CHECK:STDOUT: .F = %F.decl
  1048. // CHECK:STDOUT: }
  1049. // CHECK:STDOUT: %Core.import = import Core
  1050. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1051. // CHECK:STDOUT: import Cpp "int16_t.h"
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1054. // CHECK:STDOUT: }
  1055. // CHECK:STDOUT:
  1056. // CHECK:STDOUT: fn @F() {
  1057. // CHECK:STDOUT: !entry:
  1058. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1059. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1060. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1061. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1062. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1063. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1064. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1065. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1066. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  1067. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1068. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1069. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1070. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  1071. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  1072. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  1073. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  1074. // CHECK:STDOUT: return
  1075. // CHECK:STDOUT: }
  1076. // CHECK:STDOUT:
  1077. // CHECK:STDOUT: fn @foo();
  1078. // CHECK:STDOUT:
  1079. // CHECK:STDOUT: --- import_const_short.carbon
  1080. // CHECK:STDOUT:
  1081. // CHECK:STDOUT: constants {
  1082. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1083. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1084. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1085. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1086. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1087. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1088. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1089. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1090. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1091. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1092. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  1093. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  1094. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  1095. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  1096. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1097. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  1098. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  1099. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  1100. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  1101. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  1102. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  1103. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  1104. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  1105. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  1106. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1107. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT:
  1110. // CHECK:STDOUT: imports {
  1111. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1112. // CHECK:STDOUT: .Int = %Core.Int
  1113. // CHECK:STDOUT: .As = %Core.As
  1114. // CHECK:STDOUT: import Core//prelude
  1115. // CHECK:STDOUT: import Core//prelude/...
  1116. // CHECK:STDOUT: }
  1117. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1118. // CHECK:STDOUT: .foo = @F.%foo.decl
  1119. // CHECK:STDOUT: import Cpp//...
  1120. // CHECK:STDOUT: }
  1121. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1122. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  1123. // CHECK:STDOUT: %Core.import_ref.78a: @impl.686.%Convert.type (%Convert.type.062) = import_ref Core//prelude/types/int, loc28_39, loaded [symbolic = @impl.686.%Convert (constants.%Convert.527)]
  1124. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  1125. // CHECK:STDOUT: }
  1126. // CHECK:STDOUT:
  1127. // CHECK:STDOUT: file {
  1128. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1129. // CHECK:STDOUT: .Core = imports.%Core
  1130. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1131. // CHECK:STDOUT: .F = %F.decl
  1132. // CHECK:STDOUT: }
  1133. // CHECK:STDOUT: %Core.import = import Core
  1134. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1135. // CHECK:STDOUT: import Cpp "const_short.h"
  1136. // CHECK:STDOUT: }
  1137. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1138. // CHECK:STDOUT: }
  1139. // CHECK:STDOUT:
  1140. // CHECK:STDOUT: fn @F() {
  1141. // CHECK:STDOUT: !entry:
  1142. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1143. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1144. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1145. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1146. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1147. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1148. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1149. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1150. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  1151. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1152. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1153. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1154. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  1155. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  1156. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  1157. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  1158. // CHECK:STDOUT: return
  1159. // CHECK:STDOUT: }
  1160. // CHECK:STDOUT:
  1161. // CHECK:STDOUT: fn @foo();
  1162. // CHECK:STDOUT:
  1163. // CHECK:STDOUT: --- fail_todo_import_short_ref.carbon
  1164. // CHECK:STDOUT:
  1165. // CHECK:STDOUT: constants {
  1166. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1167. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1168. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1169. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1170. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1171. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1172. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  1173. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1174. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1175. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1176. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  1177. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  1178. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1179. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1180. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1181. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  1182. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  1183. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  1184. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  1185. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  1186. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  1187. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  1188. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1189. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1190. // CHECK:STDOUT: }
  1191. // CHECK:STDOUT:
  1192. // CHECK:STDOUT: imports {
  1193. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1194. // CHECK:STDOUT: .Int = %Core.Int
  1195. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1196. // CHECK:STDOUT: import Core//prelude
  1197. // CHECK:STDOUT: import Core//prelude/...
  1198. // CHECK:STDOUT: }
  1199. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1200. // CHECK:STDOUT: .foo = <error>
  1201. // CHECK:STDOUT: import Cpp//...
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1204. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1205. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  1206. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1207. // CHECK:STDOUT: }
  1208. // CHECK:STDOUT:
  1209. // CHECK:STDOUT: file {
  1210. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1211. // CHECK:STDOUT: .Core = imports.%Core
  1212. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1213. // CHECK:STDOUT: .F = %F.decl
  1214. // CHECK:STDOUT: }
  1215. // CHECK:STDOUT: %Core.import = import Core
  1216. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1217. // CHECK:STDOUT: import Cpp "short_ref.h"
  1218. // CHECK:STDOUT: }
  1219. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1220. // CHECK:STDOUT: }
  1221. // CHECK:STDOUT:
  1222. // CHECK:STDOUT: fn @F() {
  1223. // CHECK:STDOUT: !entry:
  1224. // CHECK:STDOUT: name_binding_decl {
  1225. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  1226. // CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  1227. // CHECK:STDOUT: }
  1228. // CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt
  1229. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1230. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  1231. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1232. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1233. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1234. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  1235. // CHECK:STDOUT: %.loc7_3: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  1236. // CHECK:STDOUT: assign %a.var, %.loc7_3
  1237. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  1238. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1239. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1240. // CHECK:STDOUT: }
  1241. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  1242. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1243. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  1244. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  1245. // CHECK:STDOUT: return
  1246. // CHECK:STDOUT: }
  1247. // CHECK:STDOUT:
  1248. // CHECK:STDOUT: --- fail_todo_import_const_short_ref.carbon
  1249. // CHECK:STDOUT:
  1250. // CHECK:STDOUT: constants {
  1251. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1252. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1253. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1254. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1255. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1256. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1257. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  1258. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1259. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1260. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1261. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  1262. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  1263. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1264. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1265. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1266. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  1267. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  1268. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  1269. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  1270. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  1271. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  1272. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  1273. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1274. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1275. // CHECK:STDOUT: }
  1276. // CHECK:STDOUT:
  1277. // CHECK:STDOUT: imports {
  1278. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1279. // CHECK:STDOUT: .Int = %Core.Int
  1280. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1281. // CHECK:STDOUT: import Core//prelude
  1282. // CHECK:STDOUT: import Core//prelude/...
  1283. // CHECK:STDOUT: }
  1284. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1285. // CHECK:STDOUT: .foo = <error>
  1286. // CHECK:STDOUT: import Cpp//...
  1287. // CHECK:STDOUT: }
  1288. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1289. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1290. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  1291. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1292. // CHECK:STDOUT: }
  1293. // CHECK:STDOUT:
  1294. // CHECK:STDOUT: file {
  1295. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1296. // CHECK:STDOUT: .Core = imports.%Core
  1297. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1298. // CHECK:STDOUT: .F = %F.decl
  1299. // CHECK:STDOUT: }
  1300. // CHECK:STDOUT: %Core.import = import Core
  1301. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1302. // CHECK:STDOUT: import Cpp "const_short_ref.h"
  1303. // CHECK:STDOUT: }
  1304. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1305. // CHECK:STDOUT: }
  1306. // CHECK:STDOUT:
  1307. // CHECK:STDOUT: fn @F() {
  1308. // CHECK:STDOUT: !entry:
  1309. // CHECK:STDOUT: name_binding_decl {
  1310. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  1311. // CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  1312. // CHECK:STDOUT: }
  1313. // CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt
  1314. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1315. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  1316. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1317. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1318. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1319. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  1320. // CHECK:STDOUT: %.loc7_3: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  1321. // CHECK:STDOUT: assign %a.var, %.loc7_3
  1322. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  1323. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1324. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1325. // CHECK:STDOUT: }
  1326. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  1327. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1328. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  1329. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  1330. // CHECK:STDOUT: return
  1331. // CHECK:STDOUT: }
  1332. // CHECK:STDOUT:
  1333. // CHECK:STDOUT: --- fail_todo_import_short_pointer.carbon
  1334. // CHECK:STDOUT:
  1335. // CHECK:STDOUT: constants {
  1336. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1337. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1338. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1339. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1340. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1341. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1342. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  1343. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1344. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1345. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1346. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  1347. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  1348. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1349. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1350. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1351. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  1352. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  1353. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  1354. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  1355. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  1356. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  1357. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  1358. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1359. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1360. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  1361. // CHECK:STDOUT: }
  1362. // CHECK:STDOUT:
  1363. // CHECK:STDOUT: imports {
  1364. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1365. // CHECK:STDOUT: .Int = %Core.Int
  1366. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1367. // CHECK:STDOUT: import Core//prelude
  1368. // CHECK:STDOUT: import Core//prelude/...
  1369. // CHECK:STDOUT: }
  1370. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1371. // CHECK:STDOUT: .foo = <error>
  1372. // CHECK:STDOUT: import Cpp//...
  1373. // CHECK:STDOUT: }
  1374. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1375. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1376. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  1377. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1378. // CHECK:STDOUT: }
  1379. // CHECK:STDOUT:
  1380. // CHECK:STDOUT: file {
  1381. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1382. // CHECK:STDOUT: .Core = imports.%Core
  1383. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1384. // CHECK:STDOUT: .F = %F.decl
  1385. // CHECK:STDOUT: }
  1386. // CHECK:STDOUT: %Core.import = import Core
  1387. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1388. // CHECK:STDOUT: import Cpp "short_pointer.h"
  1389. // CHECK:STDOUT: }
  1390. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1391. // CHECK:STDOUT: }
  1392. // CHECK:STDOUT:
  1393. // CHECK:STDOUT: fn @F() {
  1394. // CHECK:STDOUT: !entry:
  1395. // CHECK:STDOUT: name_binding_decl {
  1396. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  1397. // CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  1398. // CHECK:STDOUT: }
  1399. // CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt
  1400. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1401. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  1402. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1403. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1404. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1405. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  1406. // CHECK:STDOUT: %.loc7_3: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  1407. // CHECK:STDOUT: assign %a.var, %.loc7_3
  1408. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  1409. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1410. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1411. // CHECK:STDOUT: }
  1412. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  1413. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1414. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  1415. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  1416. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref
  1417. // CHECK:STDOUT: return
  1418. // CHECK:STDOUT: }
  1419. // CHECK:STDOUT:
  1420. // CHECK:STDOUT: --- fail_todo_import_const_short_pointer.carbon
  1421. // CHECK:STDOUT:
  1422. // CHECK:STDOUT: constants {
  1423. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1424. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1425. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  1426. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1427. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1428. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  1429. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  1430. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1431. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1432. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1433. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  1434. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  1435. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1436. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1437. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1438. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  1439. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  1440. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  1441. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  1442. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  1443. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  1444. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  1445. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1446. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  1447. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  1448. // CHECK:STDOUT: }
  1449. // CHECK:STDOUT:
  1450. // CHECK:STDOUT: imports {
  1451. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1452. // CHECK:STDOUT: .Int = %Core.Int
  1453. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1454. // CHECK:STDOUT: import Core//prelude
  1455. // CHECK:STDOUT: import Core//prelude/...
  1456. // CHECK:STDOUT: }
  1457. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1458. // CHECK:STDOUT: .foo = <error>
  1459. // CHECK:STDOUT: import Cpp//...
  1460. // CHECK:STDOUT: }
  1461. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1462. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1463. // CHECK:STDOUT: %Core.import_ref.a5b: @impl.4f9.%Convert.type (%Convert.type.0f9) = import_ref Core//prelude/types/int, loc19_39, loaded [symbolic = @impl.4f9.%Convert (constants.%Convert.f06)]
  1464. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1465. // CHECK:STDOUT: }
  1466. // CHECK:STDOUT:
  1467. // CHECK:STDOUT: file {
  1468. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1469. // CHECK:STDOUT: .Core = imports.%Core
  1470. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1471. // CHECK:STDOUT: .F = %F.decl
  1472. // CHECK:STDOUT: }
  1473. // CHECK:STDOUT: %Core.import = import Core
  1474. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1475. // CHECK:STDOUT: import Cpp "const_short_pointer.h"
  1476. // CHECK:STDOUT: }
  1477. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1478. // CHECK:STDOUT: }
  1479. // CHECK:STDOUT:
  1480. // CHECK:STDOUT: fn @F() {
  1481. // CHECK:STDOUT: !entry:
  1482. // CHECK:STDOUT: name_binding_decl {
  1483. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  1484. // CHECK:STDOUT: %a.var_patt: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  1485. // CHECK:STDOUT: }
  1486. // CHECK:STDOUT: %a.var: ref %i16 = var %a.var_patt
  1487. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1488. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  1489. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1490. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  1491. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1492. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  1493. // CHECK:STDOUT: %.loc7_3: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  1494. // CHECK:STDOUT: assign %a.var, %.loc7_3
  1495. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  1496. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  1497. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  1498. // CHECK:STDOUT: }
  1499. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  1500. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1501. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  1502. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  1503. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref
  1504. // CHECK:STDOUT: return
  1505. // CHECK:STDOUT: }
  1506. // CHECK:STDOUT: