function_decl.carbon 231 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801
  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_decl.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_decl.carbon
  10. // --- short_return_function_decl.h
  11. auto foo_short() -> short;
  12. // --- import_short_return_function_decl.carbon
  13. library "[[@TEST_NAME]]";
  14. import Cpp library "short_return_function_decl.h";
  15. fn F() {
  16. let x: i16 = Cpp.foo_short();
  17. }
  18. // --- int_return_function_decl.h
  19. auto foo_int() -> int;
  20. // --- import_int_return_function_decl.carbon
  21. library "[[@TEST_NAME]]";
  22. import Cpp library "int_return_function_decl.h";
  23. fn Carbon_foo(val: i32);
  24. fn F() {
  25. Carbon_foo(Cpp.foo_int());
  26. }
  27. // --- float_return_function_decl.h
  28. auto foo_float() -> float;
  29. // --- fail_todo_import_float_return_function_decl.carbon
  30. library "[[@TEST_NAME]]";
  31. import Cpp library "float_return_function_decl.h";
  32. fn F() {
  33. // CHECK:STDERR: fail_todo_import_float_return_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: return type: float` [SemanticsTodo]
  34. // CHECK:STDERR: Cpp.foo_float();
  35. // CHECK:STDERR: ^~~~~~~~~~~~~
  36. // CHECK:STDERR: fail_todo_import_float_return_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo_float` [InCppNameLookup]
  37. // CHECK:STDERR: Cpp.foo_float();
  38. // CHECK:STDERR: ^~~~~~~~~~~~~
  39. // CHECK:STDERR:
  40. Cpp.foo_float();
  41. }
  42. // --- int_param_function_decl.h
  43. auto foo(int a) -> void;
  44. // --- import_int_param_function_decl.carbon
  45. library "[[@TEST_NAME]]";
  46. import Cpp library "int_param_function_decl.h";
  47. fn F() {
  48. Cpp.foo(1);
  49. }
  50. // --- signed_int_param_function_decl.h
  51. auto foo(signed int a) -> void;
  52. // --- import_signed_int_param_function_decl.carbon
  53. library "[[@TEST_NAME]]";
  54. import Cpp library "signed_int_param_function_decl.h";
  55. fn F() {
  56. Cpp.foo(1);
  57. }
  58. // --- signed_param_function_decl.h
  59. auto foo(signed a) -> void;
  60. // --- import_signed_param_function_decl.carbon
  61. library "[[@TEST_NAME]]";
  62. import Cpp library "signed_param_function_decl.h";
  63. fn F() {
  64. Cpp.foo(1);
  65. }
  66. // --- int32_t_param_function_decl.h
  67. namespace std {
  68. // Mimicking glibc definition for int32_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int32_t
  69. typedef signed int int32_t;
  70. }
  71. auto foo(std::int32_t a) -> void;
  72. // --- import_int32_t_param_function_decl.carbon
  73. library "[[@TEST_NAME]]";
  74. import Cpp library "int32_t_param_function_decl.h";
  75. fn F() {
  76. Cpp.foo(1);
  77. }
  78. // --- multiple_int_params_function_decl.h
  79. auto foo(int a, int b) -> void;
  80. // --- import_multiple_int_params_function_decl.carbon
  81. library "[[@TEST_NAME]]";
  82. import Cpp library "multiple_int_params_function_decl.h";
  83. fn F() {
  84. Cpp.foo(1, 2);
  85. }
  86. // --- multiple_functions_with_int_params.h
  87. auto foo1(int a, int b) -> void;
  88. auto foo2(int c, int b) -> void;
  89. // --- import_multiple_functions_with_int_params.carbon
  90. library "[[@TEST_NAME]]";
  91. import Cpp library "multiple_functions_with_int_params.h";
  92. fn F() {
  93. Cpp.foo1(1, 2);
  94. Cpp.foo2(3, 4);
  95. }
  96. // --- unnamed_int_param_function_decl.h
  97. auto foo(int) -> void;
  98. // --- import_unnamed_int_param_function_decl.carbon
  99. library "[[@TEST_NAME]]";
  100. import Cpp library "unnamed_int_param_function_decl.h";
  101. fn F() {
  102. Cpp.foo(1);
  103. }
  104. // --- int_default_param_function_decl.h
  105. auto foo(int a = 0) -> void;
  106. // --- fail_todo_int_default_param_parameterless_call.carbon
  107. library "[[@TEST_NAME]]";
  108. import Cpp library "int_default_param_function_decl.h";
  109. fn F() {
  110. // CHECK:STDERR: fail_todo_int_default_param_parameterless_call.carbon:[[@LINE+5]]:3: error: 0 arguments passed to function expecting 1 argument [CallArgCountMismatch]
  111. // CHECK:STDERR: Cpp.foo();
  112. // CHECK:STDERR: ^~~~~~~~~
  113. // CHECK:STDERR: fail_todo_int_default_param_parameterless_call.carbon: note: calling function declared here [InCallToEntity]
  114. // CHECK:STDERR:
  115. Cpp.foo();
  116. }
  117. // --- int_max_param_function_decl.h
  118. auto foo(int a) -> void;
  119. // --- import_int_max_param_function_decl.carbon
  120. library "[[@TEST_NAME]]";
  121. import Cpp library "int_max_param_function_decl.h";
  122. fn F() {
  123. Cpp.foo(0x7FFF_FFFF);
  124. }
  125. // --- overflow_int_max_param_function_decl.h
  126. auto foo(int a) -> void;
  127. // --- fail_overflow_int_max_param_function_decl.carbon
  128. library "[[@TEST_NAME]]";
  129. import Cpp library "overflow_int_max_param_function_decl.h";
  130. fn F() {
  131. // CHECK:STDERR: fail_overflow_int_max_param_function_decl.carbon:[[@LINE+5]]:11: error: integer value 2147483648 too large for type `i32` [IntTooLargeForType]
  132. // CHECK:STDERR: Cpp.foo(0x8000_0000);
  133. // CHECK:STDERR: ^~~~~~~~~~~
  134. // CHECK:STDERR: fail_overflow_int_max_param_function_decl.carbon: note: initializing function parameter [InCallToFunctionParam]
  135. // CHECK:STDERR:
  136. Cpp.foo(0x8000_0000);
  137. }
  138. // --- int_min_param_function_decl.h
  139. auto foo(int a) -> void;
  140. // --- import_int_min_param_function_decl.carbon
  141. library "[[@TEST_NAME]]";
  142. import Cpp library "int_min_param_function_decl.h";
  143. fn F() {
  144. Cpp.foo(-0x8000_0000);
  145. }
  146. // --- overflow_int_min_param_function_decl.h
  147. auto foo(int a) -> void;
  148. // --- fail_overflow_int_min_param_function_decl.carbon
  149. library "[[@TEST_NAME]]";
  150. import Cpp library "overflow_int_min_param_function_decl.h";
  151. fn F() {
  152. // CHECK:STDERR: fail_overflow_int_min_param_function_decl.carbon:[[@LINE+5]]:11: error: integer value -2147483649 too large for type `i32` [IntTooLargeForType]
  153. // CHECK:STDERR: Cpp.foo(-0x8000_0001);
  154. // CHECK:STDERR: ^~~~~~~~~~~~
  155. // CHECK:STDERR: fail_overflow_int_min_param_function_decl.carbon: note: initializing function parameter [InCallToFunctionParam]
  156. // CHECK:STDERR:
  157. Cpp.foo(-0x8000_0001);
  158. }
  159. // --- import_int_default_param_sucessful_call_function_decl.carbon
  160. library "[[@TEST_NAME]]";
  161. import Cpp library "int_default_param_function_decl.h";
  162. fn F() {
  163. Cpp.foo(1);
  164. }
  165. // --- int_const_param_function_decl.h
  166. auto foo(const int a) -> void;
  167. // --- import_int_const_param_function_decl.carbon
  168. library "[[@TEST_NAME]]";
  169. import Cpp library "int_const_param_function_decl.h";
  170. fn F() {
  171. Cpp.foo(1);
  172. }
  173. // --- int_ref_param_function_decl.h
  174. auto foo(int& a) -> int;
  175. // --- fail_todo_int_ref_param_function_decl.carbon
  176. library "[[@TEST_NAME]]";
  177. import Cpp library "int_ref_param_function_decl.h";
  178. fn F() {
  179. var a: i32 = 1;
  180. // CHECK:STDERR: fail_todo_int_ref_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: int &` [SemanticsTodo]
  181. // CHECK:STDERR: Cpp.foo(a);
  182. // CHECK:STDERR: ^~~~~~~
  183. // CHECK:STDERR: fail_todo_int_ref_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  184. // CHECK:STDERR: Cpp.foo(a);
  185. // CHECK:STDERR: ^~~~~~~
  186. // CHECK:STDERR:
  187. Cpp.foo(a);
  188. }
  189. // --- int_const_ref_param_function_decl.h
  190. auto foo(const int& a) -> int;
  191. // --- fail_todo_int_const_ref_param_function_decl.carbon
  192. library "[[@TEST_NAME]]";
  193. import Cpp library "int_const_ref_param_function_decl.h";
  194. fn F() {
  195. var a : i32 = 1;
  196. // CHECK:STDERR: fail_todo_int_const_ref_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const int &` [SemanticsTodo]
  197. // CHECK:STDERR: Cpp.foo(a);
  198. // CHECK:STDERR: ^~~~~~~
  199. // CHECK:STDERR: fail_todo_int_const_ref_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  200. // CHECK:STDERR: Cpp.foo(a);
  201. // CHECK:STDERR: ^~~~~~~
  202. // CHECK:STDERR:
  203. Cpp.foo(a);
  204. }
  205. // --- int_pointer_param_function_decl.h
  206. auto foo(int* a) -> void;
  207. // --- fail_todo_int_pointer_param_function_decl.carbon
  208. library "[[@TEST_NAME]]";
  209. import Cpp library "int_pointer_param_function_decl.h";
  210. fn F() {
  211. var a: i32 = 1;
  212. // CHECK:STDERR: fail_todo_int_pointer_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: int *` [SemanticsTodo]
  213. // CHECK:STDERR: Cpp.foo(&a);
  214. // CHECK:STDERR: ^~~~~~~
  215. // CHECK:STDERR: fail_todo_int_pointer_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  216. // CHECK:STDERR: Cpp.foo(&a);
  217. // CHECK:STDERR: ^~~~~~~
  218. // CHECK:STDERR:
  219. Cpp.foo(&a);
  220. }
  221. // --- int_const_pointer_param_function_decl.h
  222. auto foo(const int* a) -> int;
  223. // --- fail_todo_int_const_pointer_param_function_decl.carbon
  224. library "[[@TEST_NAME]]";
  225. import Cpp library "int_const_pointer_param_function_decl.h";
  226. fn F() {
  227. var a : i32 = 1;
  228. // CHECK:STDERR: fail_todo_int_const_pointer_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const int *` [SemanticsTodo]
  229. // CHECK:STDERR: Cpp.foo(&a);
  230. // CHECK:STDERR: ^~~~~~~
  231. // CHECK:STDERR: fail_todo_int_const_pointer_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  232. // CHECK:STDERR: Cpp.foo(&a);
  233. // CHECK:STDERR: ^~~~~~~
  234. // CHECK:STDERR:
  235. Cpp.foo(&a);
  236. }
  237. // --- short_param_function_decl.h
  238. auto foo(short a) -> void;
  239. // --- import_short_param_function_decl.carbon
  240. library "[[@TEST_NAME]]";
  241. import Cpp library "short_param_function_decl.h";
  242. fn F() {
  243. Cpp.foo(1 as i16);
  244. }
  245. // --- short_int_param_function_decl.h
  246. auto foo(short int a) -> void;
  247. // --- import_short_int_param_function_decl.carbon
  248. library "[[@TEST_NAME]]";
  249. import Cpp library "short_int_param_function_decl.h";
  250. fn F() {
  251. Cpp.foo(1 as i16);
  252. }
  253. // --- signed_short_param_function_decl.h
  254. auto foo(signed short a) -> void;
  255. // --- import_signed_short_param_function_decl.carbon
  256. library "[[@TEST_NAME]]";
  257. import Cpp library "signed_short_param_function_decl.h";
  258. fn F() {
  259. Cpp.foo(1 as i16);
  260. }
  261. // --- signed_short_int_param_function_decl.h
  262. auto foo(signed short int a) -> void;
  263. // --- import_signed_short_int_param_function_decl.carbon
  264. library "[[@TEST_NAME]]";
  265. import Cpp library "signed_short_int_param_function_decl.h";
  266. fn F() {
  267. Cpp.foo(1 as i16);
  268. }
  269. // --- int16_t_param_function_decl.h
  270. namespace std {
  271. // Mimicking glibc definition for int16_t: https://codebrowser.dev/glibc/glibc/posix/bits/types.h.html#__int16_t
  272. typedef signed short int int16_t;
  273. } // namespace std
  274. auto foo(std::int16_t a) -> void;
  275. // --- import_int16_t_param_function_decl.carbon
  276. library "[[@TEST_NAME]]";
  277. import Cpp library "int16_t_param_function_decl.h";
  278. fn F() {
  279. Cpp.foo(1 as i16);
  280. }
  281. // --- short_max_param_function_decl.h
  282. auto foo(short a) -> void;
  283. // --- import_short_max_param_function_decl.carbon
  284. library "[[@TEST_NAME]]";
  285. import Cpp library "short_max_param_function_decl.h";
  286. fn F() {
  287. Cpp.foo(0x7FFF);
  288. }
  289. // --- overflow_short_max_param_function_decl.h
  290. auto foo(short a) -> void;
  291. // --- fail_overflow_short_max_param_function_decl.carbon
  292. library "[[@TEST_NAME]]";
  293. import Cpp library "overflow_short_max_param_function_decl.h";
  294. fn F() {
  295. // CHECK:STDERR: fail_overflow_short_max_param_function_decl.carbon:[[@LINE+5]]:11: error: integer value 32768 too large for type `i16` [IntTooLargeForType]
  296. // CHECK:STDERR: Cpp.foo(0x8000);
  297. // CHECK:STDERR: ^~~~~~
  298. // CHECK:STDERR: fail_overflow_short_max_param_function_decl.carbon: note: initializing function parameter [InCallToFunctionParam]
  299. // CHECK:STDERR:
  300. Cpp.foo(0x8000);
  301. }
  302. // --- short_min_param_function_decl.h
  303. auto foo(short a) -> void;
  304. // --- import_short_min_param_function_decl.carbon
  305. library "[[@TEST_NAME]]";
  306. import Cpp library "short_min_param_function_decl.h";
  307. fn F() {
  308. Cpp.foo(-0x8000);
  309. }
  310. // --- overflow_short_min_param_function_decl.h
  311. auto foo(short a) -> void;
  312. // --- fail_overflow_short_min_param_function_decl.carbon
  313. library "[[@TEST_NAME]]";
  314. import Cpp library "overflow_short_min_param_function_decl.h";
  315. fn F() {
  316. // CHECK:STDERR: fail_overflow_short_min_param_function_decl.carbon:[[@LINE+5]]:11: error: integer value -32769 too large for type `i16` [IntTooLargeForType]
  317. // CHECK:STDERR: Cpp.foo(-0x8001);
  318. // CHECK:STDERR: ^~~~~~~
  319. // CHECK:STDERR: fail_overflow_short_min_param_function_decl.carbon: note: initializing function parameter [InCallToFunctionParam]
  320. // CHECK:STDERR:
  321. Cpp.foo(-0x8001);
  322. }
  323. // --- int32_arg_short_param_function_decl.h
  324. auto foo(short a) -> void;
  325. // --- fail_int32_arg_short_param_function_decl.carbon
  326. library "[[@TEST_NAME]]";
  327. import Cpp library "int32_arg_short_param_function_decl.h";
  328. fn F() {
  329. // CHECK:STDERR: fail_int32_arg_short_param_function_decl.carbon:[[@LINE+8]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
  330. // CHECK:STDERR: Cpp.foo(1 as i32);
  331. // CHECK:STDERR: ^~~~~~~~
  332. // CHECK:STDERR: fail_int32_arg_short_param_function_decl.carbon:[[@LINE+5]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote]
  333. // CHECK:STDERR: Cpp.foo(1 as i32);
  334. // CHECK:STDERR: ^~~~~~~~
  335. // CHECK:STDERR: fail_int32_arg_short_param_function_decl.carbon: note: initializing function parameter [InCallToFunctionParam]
  336. // CHECK:STDERR:
  337. Cpp.foo(1 as i32);
  338. }
  339. // --- short_const_param_function_decl.h
  340. auto foo(const short a) -> void;
  341. // --- import_short_const_param_function_decl.carbon
  342. library "[[@TEST_NAME]]";
  343. import Cpp library "short_const_param_function_decl.h";
  344. fn F() {
  345. Cpp.foo(1 as i16);
  346. }
  347. // --- short_ref_param_function_decl.h
  348. auto foo(short& a) -> void;
  349. // --- fail_todo_short_ref_param_function_decl.carbon
  350. library "[[@TEST_NAME]]";
  351. import Cpp library "short_ref_param_function_decl.h";
  352. fn F() {
  353. var a: i16 = 1;
  354. // CHECK:STDERR: fail_todo_short_ref_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short &` [SemanticsTodo]
  355. // CHECK:STDERR: Cpp.foo(a);
  356. // CHECK:STDERR: ^~~~~~~
  357. // CHECK:STDERR: fail_todo_short_ref_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  358. // CHECK:STDERR: Cpp.foo(a);
  359. // CHECK:STDERR: ^~~~~~~
  360. // CHECK:STDERR:
  361. Cpp.foo(a);
  362. }
  363. // --- short_const_ref_param_function_decl.h
  364. auto foo(const short& a) -> void;
  365. // --- fail_todo_short_const_ref_param_function_decl.carbon
  366. library "[[@TEST_NAME]]";
  367. import Cpp library "short_const_ref_param_function_decl.h";
  368. fn F() {
  369. var a: i16 = 1;
  370. // CHECK:STDERR: fail_todo_short_const_ref_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short &` [SemanticsTodo]
  371. // CHECK:STDERR: Cpp.foo(a);
  372. // CHECK:STDERR: ^~~~~~~
  373. // CHECK:STDERR: fail_todo_short_const_ref_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  374. // CHECK:STDERR: Cpp.foo(a);
  375. // CHECK:STDERR: ^~~~~~~
  376. // CHECK:STDERR:
  377. Cpp.foo(a);
  378. }
  379. // --- short_pointer_param_function_decl.h
  380. auto foo(short* a) -> void;
  381. // --- fail_todo_short_pointer_param_function_decl.carbon
  382. library "[[@TEST_NAME]]";
  383. import Cpp library "short_pointer_param_function_decl.h";
  384. fn F() {
  385. var a: i16 = 1;
  386. // CHECK:STDERR: fail_todo_short_pointer_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: short *` [SemanticsTodo]
  387. // CHECK:STDERR: Cpp.foo(&a);
  388. // CHECK:STDERR: ^~~~~~~
  389. // CHECK:STDERR: fail_todo_short_pointer_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  390. // CHECK:STDERR: Cpp.foo(&a);
  391. // CHECK:STDERR: ^~~~~~~
  392. // CHECK:STDERR:
  393. Cpp.foo(&a);
  394. }
  395. // --- short_const_pointer_param_function_decl.h
  396. auto foo(const short* a) -> void;
  397. // --- fail_todo_short_const_pointer_param_function_decl.carbon
  398. library "[[@TEST_NAME]]";
  399. import Cpp library "short_const_pointer_param_function_decl.h";
  400. fn F() {
  401. var a: i16 = 1;
  402. // CHECK:STDERR: fail_todo_short_const_pointer_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: const short *` [SemanticsTodo]
  403. // CHECK:STDERR: Cpp.foo(&a);
  404. // CHECK:STDERR: ^~~~~~~
  405. // CHECK:STDERR: fail_todo_short_const_pointer_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  406. // CHECK:STDERR: Cpp.foo(&a);
  407. // CHECK:STDERR: ^~~~~~~
  408. // CHECK:STDERR:
  409. Cpp.foo(&a);
  410. }
  411. // --- unsupported_primitive_type_param_function_decl.h
  412. auto foo(float a) -> void;
  413. // --- fail_todo_import_unsupported_primitive_type_param_function_decl.carbon
  414. library "[[@TEST_NAME]]";
  415. import Cpp library "unsupported_primitive_type_param_function_decl.h";
  416. fn F() {
  417. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_param_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: float` [SemanticsTodo]
  418. // CHECK:STDERR: Cpp.foo(1.1);
  419. // CHECK:STDERR: ^~~~~~~
  420. // CHECK:STDERR: fail_todo_import_unsupported_primitive_type_param_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  421. // CHECK:STDERR: Cpp.foo(1.1);
  422. // CHECK:STDERR: ^~~~~~~
  423. // CHECK:STDERR:
  424. Cpp.foo(1.1);
  425. }
  426. // --- unsupported_type_among_params_function_decl.h
  427. auto foo(int a, float b) -> void;
  428. // --- fail_import_unsupported_type_among_params_function_decl.carbon
  429. library "[[@TEST_NAME]]";
  430. import Cpp library "unsupported_type_among_params_function_decl.h";
  431. fn F() {
  432. // CHECK:STDERR: fail_import_unsupported_type_among_params_function_decl.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: parameter type: float` [SemanticsTodo]
  433. // CHECK:STDERR: Cpp.foo(1, 2.0);
  434. // CHECK:STDERR: ^~~~~~~
  435. // CHECK:STDERR: fail_import_unsupported_type_among_params_function_decl.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  436. // CHECK:STDERR: Cpp.foo(1, 2.0);
  437. // CHECK:STDERR: ^~~~~~~
  438. // CHECK:STDERR:
  439. Cpp.foo(1, 2.0);
  440. }
  441. // CHECK:STDOUT: --- import_short_return_function_decl.carbon
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: constants {
  444. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  445. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  446. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  447. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  448. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  449. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  450. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  451. // CHECK:STDOUT: %foo_short.type: type = fn_type @foo_short [concrete]
  452. // CHECK:STDOUT: %foo_short: %foo_short.type = struct_value () [concrete]
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: imports {
  456. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  457. // CHECK:STDOUT: .Int = %Core.Int
  458. // CHECK:STDOUT: import Core//prelude
  459. // CHECK:STDOUT: import Core//prelude/...
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  462. // CHECK:STDOUT: .foo_short = @F.%foo_short.decl
  463. // CHECK:STDOUT: import Cpp//...
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: file {
  469. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  470. // CHECK:STDOUT: .Core = imports.%Core
  471. // CHECK:STDOUT: .Cpp = imports.%Cpp
  472. // CHECK:STDOUT: .F = %F.decl
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT: %Core.import = import Core
  475. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  476. // CHECK:STDOUT: import Cpp "short_return_function_decl.h"
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: fn @F() {
  482. // CHECK:STDOUT: !entry:
  483. // CHECK:STDOUT: name_binding_decl {
  484. // CHECK:STDOUT: %x.patt: %pattern_type.2f8 = binding_pattern x [concrete]
  485. // CHECK:STDOUT: }
  486. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  487. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  488. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  489. // CHECK:STDOUT: %foo_short.decl: %foo_short.type = fn_decl @foo_short [concrete = constants.%foo_short] {} {}
  490. // CHECK:STDOUT: %foo_short.ref: %foo_short.type = name_ref foo_short, %foo_short.decl [concrete = constants.%foo_short]
  491. // CHECK:STDOUT: %foo_short.call: init %i16 = call %foo_short.ref()
  492. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16.loc7 [concrete = constants.%i16] {
  493. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  494. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT: %.loc7_30.1: ref %i16 = temporary_storage
  497. // CHECK:STDOUT: %.loc7_30.2: ref %i16 = temporary %.loc7_30.1, %foo_short.call
  498. // CHECK:STDOUT: %x: ref %i16 = bind_name x, %.loc7_30.2
  499. // CHECK:STDOUT: return
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: fn @foo_short();
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: --- import_int_return_function_decl.carbon
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: constants {
  507. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  508. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  509. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  510. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  511. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  512. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  513. // CHECK:STDOUT: %Carbon_foo.type: type = fn_type @Carbon_foo [concrete]
  514. // CHECK:STDOUT: %Carbon_foo: %Carbon_foo.type = struct_value () [concrete]
  515. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  516. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  517. // CHECK:STDOUT: %foo_int.type: type = fn_type @foo_int [concrete]
  518. // CHECK:STDOUT: %foo_int: %foo_int.type = struct_value () [concrete]
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: imports {
  522. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  523. // CHECK:STDOUT: .Int = %Core.Int
  524. // CHECK:STDOUT: import Core//prelude
  525. // CHECK:STDOUT: import Core//prelude/...
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  528. // CHECK:STDOUT: .foo_int = @F.%foo_int.decl
  529. // CHECK:STDOUT: import Cpp//...
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: file {
  535. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  536. // CHECK:STDOUT: .Core = imports.%Core
  537. // CHECK:STDOUT: .Cpp = imports.%Cpp
  538. // CHECK:STDOUT: .Carbon_foo = %Carbon_foo.decl
  539. // CHECK:STDOUT: .F = %F.decl
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT: %Core.import = import Core
  542. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  543. // CHECK:STDOUT: import Cpp "int_return_function_decl.h"
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT: %Carbon_foo.decl: %Carbon_foo.type = fn_decl @Carbon_foo [concrete = constants.%Carbon_foo] {
  546. // CHECK:STDOUT: %val.patt: %pattern_type.7ce = binding_pattern val [concrete]
  547. // CHECK:STDOUT: %val.param_patt: %pattern_type.7ce = value_param_pattern %val.patt, call_param0 [concrete]
  548. // CHECK:STDOUT: } {
  549. // CHECK:STDOUT: %val.param: %i32 = value_param call_param0
  550. // CHECK:STDOUT: %.loc6: type = splice_block %i32 [concrete = constants.%i32] {
  551. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  552. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT: %val: %i32 = bind_name val, %val.param
  555. // CHECK:STDOUT: }
  556. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: fn @Carbon_foo(%val.param: %i32);
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: fn @F() {
  562. // CHECK:STDOUT: !entry:
  563. // CHECK:STDOUT: %Carbon_foo.ref: %Carbon_foo.type = name_ref Carbon_foo, file.%Carbon_foo.decl [concrete = constants.%Carbon_foo]
  564. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  565. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  566. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  567. // CHECK:STDOUT: %foo_int.decl: %foo_int.type = fn_decl @foo_int [concrete = constants.%foo_int] {} {}
  568. // CHECK:STDOUT: %foo_int.ref: %foo_int.type = name_ref foo_int, %foo_int.decl [concrete = constants.%foo_int]
  569. // CHECK:STDOUT: %foo_int.call: init %i32 = call %foo_int.ref()
  570. // CHECK:STDOUT: %.loc9_26.1: %i32 = value_of_initializer %foo_int.call
  571. // CHECK:STDOUT: %.loc9_26.2: %i32 = converted %foo_int.call, %.loc9_26.1
  572. // CHECK:STDOUT: %Carbon_foo.call: init %empty_tuple.type = call %Carbon_foo.ref(%.loc9_26.2)
  573. // CHECK:STDOUT: return
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: fn @foo_int();
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: --- fail_todo_import_float_return_function_decl.carbon
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: constants {
  581. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  582. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  583. // CHECK:STDOUT: }
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: imports {
  586. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  587. // CHECK:STDOUT: import Core//prelude
  588. // CHECK:STDOUT: import Core//prelude/...
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  591. // CHECK:STDOUT: .foo_float = <error>
  592. // CHECK:STDOUT: import Cpp//...
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT: }
  595. // CHECK:STDOUT:
  596. // CHECK:STDOUT: file {
  597. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  598. // CHECK:STDOUT: .Core = imports.%Core
  599. // CHECK:STDOUT: .Cpp = imports.%Cpp
  600. // CHECK:STDOUT: .F = %F.decl
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT: %Core.import = import Core
  603. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  604. // CHECK:STDOUT: import Cpp "float_return_function_decl.h"
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: fn @F() {
  610. // CHECK:STDOUT: !entry:
  611. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  612. // CHECK:STDOUT: %foo_float.ref: <error> = name_ref foo_float, <error> [concrete = <error>]
  613. // CHECK:STDOUT: return
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: --- import_int_param_function_decl.carbon
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: constants {
  619. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  620. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  621. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  622. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  623. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  624. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  625. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  626. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  627. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  628. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  629. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  630. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  631. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  632. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  633. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  634. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  635. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  636. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  637. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  638. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  639. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  640. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  641. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  642. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  643. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  644. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: imports {
  648. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  649. // CHECK:STDOUT: .Int = %Core.Int
  650. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  651. // CHECK:STDOUT: import Core//prelude
  652. // CHECK:STDOUT: import Core//prelude/...
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  655. // CHECK:STDOUT: .foo = @F.%foo.decl
  656. // CHECK:STDOUT: import Cpp//...
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  659. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  660. // 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)]
  661. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT:
  664. // CHECK:STDOUT: file {
  665. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  666. // CHECK:STDOUT: .Core = imports.%Core
  667. // CHECK:STDOUT: .Cpp = imports.%Cpp
  668. // CHECK:STDOUT: .F = %F.decl
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT: %Core.import = import Core
  671. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  672. // CHECK:STDOUT: import Cpp "int_param_function_decl.h"
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: fn @F() {
  678. // CHECK:STDOUT: !entry:
  679. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  680. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  681. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  682. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  683. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  684. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  685. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  686. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  687. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  688. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  689. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  690. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  691. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  692. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  693. // CHECK:STDOUT: return
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: fn @foo();
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: --- import_signed_int_param_function_decl.carbon
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: constants {
  701. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  702. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  703. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  704. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  705. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  706. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  707. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  708. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  709. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  710. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  711. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  712. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  713. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  714. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  715. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  716. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  717. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  718. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  719. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  720. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  721. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  722. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  723. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  724. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  725. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  726. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  727. // CHECK:STDOUT: }
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: imports {
  730. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  731. // CHECK:STDOUT: .Int = %Core.Int
  732. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  733. // CHECK:STDOUT: import Core//prelude
  734. // CHECK:STDOUT: import Core//prelude/...
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  737. // CHECK:STDOUT: .foo = @F.%foo.decl
  738. // CHECK:STDOUT: import Cpp//...
  739. // CHECK:STDOUT: }
  740. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  741. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  742. // 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)]
  743. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: file {
  747. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  748. // CHECK:STDOUT: .Core = imports.%Core
  749. // CHECK:STDOUT: .Cpp = imports.%Cpp
  750. // CHECK:STDOUT: .F = %F.decl
  751. // CHECK:STDOUT: }
  752. // CHECK:STDOUT: %Core.import = import Core
  753. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  754. // CHECK:STDOUT: import Cpp "signed_int_param_function_decl.h"
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  757. // CHECK:STDOUT: }
  758. // CHECK:STDOUT:
  759. // CHECK:STDOUT: fn @F() {
  760. // CHECK:STDOUT: !entry:
  761. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  762. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  763. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  764. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  765. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  766. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  767. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  768. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  769. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  770. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  771. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  772. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  773. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  774. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  775. // CHECK:STDOUT: return
  776. // CHECK:STDOUT: }
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: fn @foo();
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: --- import_signed_param_function_decl.carbon
  781. // CHECK:STDOUT:
  782. // CHECK:STDOUT: constants {
  783. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  784. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  785. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  786. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  787. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  788. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  789. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  790. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  791. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  792. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  793. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  794. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  795. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  796. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  797. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  798. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  799. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  800. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  801. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  802. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  803. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  804. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  805. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  806. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  807. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  808. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  809. // CHECK:STDOUT: }
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: imports {
  812. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  813. // CHECK:STDOUT: .Int = %Core.Int
  814. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  815. // CHECK:STDOUT: import Core//prelude
  816. // CHECK:STDOUT: import Core//prelude/...
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  819. // CHECK:STDOUT: .foo = @F.%foo.decl
  820. // CHECK:STDOUT: import Cpp//...
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  823. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  824. // 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)]
  825. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  826. // CHECK:STDOUT: }
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: file {
  829. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  830. // CHECK:STDOUT: .Core = imports.%Core
  831. // CHECK:STDOUT: .Cpp = imports.%Cpp
  832. // CHECK:STDOUT: .F = %F.decl
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT: %Core.import = import Core
  835. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  836. // CHECK:STDOUT: import Cpp "signed_param_function_decl.h"
  837. // CHECK:STDOUT: }
  838. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: fn @F() {
  842. // CHECK:STDOUT: !entry:
  843. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  844. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  845. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  846. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  847. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  848. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  849. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  850. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  851. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  852. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  853. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  854. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  855. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  856. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  857. // CHECK:STDOUT: return
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: fn @foo();
  861. // CHECK:STDOUT:
  862. // CHECK:STDOUT: --- import_int32_t_param_function_decl.carbon
  863. // CHECK:STDOUT:
  864. // CHECK:STDOUT: constants {
  865. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  866. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  867. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  868. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  869. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  870. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  871. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  872. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  873. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  874. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  875. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  876. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  877. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  878. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  879. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  880. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  881. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  882. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  883. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  884. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  885. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  886. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  887. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  888. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  889. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  890. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: imports {
  894. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  895. // CHECK:STDOUT: .Int = %Core.Int
  896. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  897. // CHECK:STDOUT: import Core//prelude
  898. // CHECK:STDOUT: import Core//prelude/...
  899. // CHECK:STDOUT: }
  900. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  901. // CHECK:STDOUT: .foo = @F.%foo.decl
  902. // CHECK:STDOUT: import Cpp//...
  903. // CHECK:STDOUT: }
  904. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  905. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  906. // 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)]
  907. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: file {
  911. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  912. // CHECK:STDOUT: .Core = imports.%Core
  913. // CHECK:STDOUT: .Cpp = imports.%Cpp
  914. // CHECK:STDOUT: .F = %F.decl
  915. // CHECK:STDOUT: }
  916. // CHECK:STDOUT: %Core.import = import Core
  917. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  918. // CHECK:STDOUT: import Cpp "int32_t_param_function_decl.h"
  919. // CHECK:STDOUT: }
  920. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: fn @F() {
  924. // CHECK:STDOUT: !entry:
  925. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  926. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  927. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  928. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  929. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  930. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  931. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  932. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  933. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  934. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  935. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  936. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  937. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  938. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  939. // CHECK:STDOUT: return
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT:
  942. // CHECK:STDOUT: fn @foo();
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: --- import_multiple_int_params_function_decl.carbon
  945. // CHECK:STDOUT:
  946. // CHECK:STDOUT: constants {
  947. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  948. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  949. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  950. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  951. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  952. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  953. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  954. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  955. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  956. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  957. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  958. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  959. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  960. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  961. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  962. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  963. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  964. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  965. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  966. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  967. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  968. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  969. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  970. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  971. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  972. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  973. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  974. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  975. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  976. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  977. // CHECK:STDOUT: }
  978. // CHECK:STDOUT:
  979. // CHECK:STDOUT: imports {
  980. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  981. // CHECK:STDOUT: .Int = %Core.Int
  982. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  983. // CHECK:STDOUT: import Core//prelude
  984. // CHECK:STDOUT: import Core//prelude/...
  985. // CHECK:STDOUT: }
  986. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  987. // CHECK:STDOUT: .foo = @F.%foo.decl
  988. // CHECK:STDOUT: import Cpp//...
  989. // CHECK:STDOUT: }
  990. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  991. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  992. // 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)]
  993. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  994. // CHECK:STDOUT: }
  995. // CHECK:STDOUT:
  996. // CHECK:STDOUT: file {
  997. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  998. // CHECK:STDOUT: .Core = imports.%Core
  999. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1000. // CHECK:STDOUT: .F = %F.decl
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT: %Core.import = import Core
  1003. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1004. // CHECK:STDOUT: import Cpp "multiple_int_params_function_decl.h"
  1005. // CHECK:STDOUT: }
  1006. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1007. // CHECK:STDOUT: }
  1008. // CHECK:STDOUT:
  1009. // CHECK:STDOUT: fn @F() {
  1010. // CHECK:STDOUT: !entry:
  1011. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1012. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1013. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1014. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1015. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1016. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1017. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1018. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1019. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  1020. // CHECK:STDOUT: %impl.elem0.loc7_11: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1021. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0.loc7_11 [concrete = constants.%Convert.bound.ab5]
  1022. // CHECK:STDOUT: %specific_fn.loc7_11: <specific function> = specific_function %impl.elem0.loc7_11, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1023. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn.loc7_11 [concrete = constants.%bound_method.9a1]
  1024. // CHECK:STDOUT: %int.convert_checked.loc7_11: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  1025. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked.loc7_11 [concrete = constants.%int_1.5d2]
  1026. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  1027. // CHECK:STDOUT: %impl.elem0.loc7_14: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1028. // CHECK:STDOUT: %bound_method.loc7_14.1: <bound method> = bound_method %int_2, %impl.elem0.loc7_14 [concrete = constants.%Convert.bound.ef9]
  1029. // CHECK:STDOUT: %specific_fn.loc7_14: <specific function> = specific_function %impl.elem0.loc7_14, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1030. // CHECK:STDOUT: %bound_method.loc7_14.2: <bound method> = bound_method %int_2, %specific_fn.loc7_14 [concrete = constants.%bound_method.b92]
  1031. // CHECK:STDOUT: %int.convert_checked.loc7_14: init %i32 = call %bound_method.loc7_14.2(%int_2) [concrete = constants.%int_2.ef8]
  1032. // CHECK:STDOUT: %.loc7_14.1: %i32 = value_of_initializer %int.convert_checked.loc7_14 [concrete = constants.%int_2.ef8]
  1033. // CHECK:STDOUT: %.loc7_14.2: %i32 = converted %int_2, %.loc7_14.1 [concrete = constants.%int_2.ef8]
  1034. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2, %.loc7_14.2)
  1035. // CHECK:STDOUT: return
  1036. // CHECK:STDOUT: }
  1037. // CHECK:STDOUT:
  1038. // CHECK:STDOUT: fn @foo();
  1039. // CHECK:STDOUT:
  1040. // CHECK:STDOUT: --- import_multiple_functions_with_int_params.carbon
  1041. // CHECK:STDOUT:
  1042. // CHECK:STDOUT: constants {
  1043. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1044. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1045. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1046. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1047. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1048. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1049. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1050. // CHECK:STDOUT: %foo1.type: type = fn_type @foo1 [concrete]
  1051. // CHECK:STDOUT: %foo1: %foo1.type = struct_value () [concrete]
  1052. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1053. // CHECK:STDOUT: %int_2.ecc: Core.IntLiteral = int_value 2 [concrete]
  1054. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1055. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1056. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1057. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1058. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1059. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1060. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1061. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1062. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1063. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1064. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1065. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1066. // CHECK:STDOUT: %Convert.bound.ab5: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1067. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1068. // CHECK:STDOUT: %bound_method.9a1: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1069. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1070. // CHECK:STDOUT: %Convert.bound.ef9: <bound method> = bound_method %int_2.ecc, %Convert.956 [concrete]
  1071. // CHECK:STDOUT: %bound_method.b92: <bound method> = bound_method %int_2.ecc, %Convert.specific_fn [concrete]
  1072. // CHECK:STDOUT: %int_2.ef8: %i32 = int_value 2 [concrete]
  1073. // CHECK:STDOUT: %foo2.type: type = fn_type @foo2 [concrete]
  1074. // CHECK:STDOUT: %foo2: %foo2.type = struct_value () [concrete]
  1075. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  1076. // CHECK:STDOUT: %int_4.0c1: Core.IntLiteral = int_value 4 [concrete]
  1077. // CHECK:STDOUT: %Convert.bound.b30: <bound method> = bound_method %int_3.1ba, %Convert.956 [concrete]
  1078. // CHECK:STDOUT: %bound_method.047: <bound method> = bound_method %int_3.1ba, %Convert.specific_fn [concrete]
  1079. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  1080. // CHECK:STDOUT: %Convert.bound.ac3: <bound method> = bound_method %int_4.0c1, %Convert.956 [concrete]
  1081. // CHECK:STDOUT: %bound_method.1da: <bound method> = bound_method %int_4.0c1, %Convert.specific_fn [concrete]
  1082. // CHECK:STDOUT: %int_4.940: %i32 = int_value 4 [concrete]
  1083. // CHECK:STDOUT: }
  1084. // CHECK:STDOUT:
  1085. // CHECK:STDOUT: imports {
  1086. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1087. // CHECK:STDOUT: .Int = %Core.Int
  1088. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1089. // CHECK:STDOUT: import Core//prelude
  1090. // CHECK:STDOUT: import Core//prelude/...
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1093. // CHECK:STDOUT: .foo1 = @F.%foo1.decl
  1094. // CHECK:STDOUT: .foo2 = @F.%foo2.decl
  1095. // CHECK:STDOUT: import Cpp//...
  1096. // CHECK:STDOUT: }
  1097. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1098. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1099. // 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)]
  1100. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1101. // CHECK:STDOUT: }
  1102. // CHECK:STDOUT:
  1103. // CHECK:STDOUT: file {
  1104. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1105. // CHECK:STDOUT: .Core = imports.%Core
  1106. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1107. // CHECK:STDOUT: .F = %F.decl
  1108. // CHECK:STDOUT: }
  1109. // CHECK:STDOUT: %Core.import = import Core
  1110. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1111. // CHECK:STDOUT: import Cpp "multiple_functions_with_int_params.h"
  1112. // CHECK:STDOUT: }
  1113. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1114. // CHECK:STDOUT: }
  1115. // CHECK:STDOUT:
  1116. // CHECK:STDOUT: fn @F() {
  1117. // CHECK:STDOUT: !entry:
  1118. // CHECK:STDOUT: %Cpp.ref.loc7: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1119. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1120. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1121. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1122. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1123. // CHECK:STDOUT: %foo1.decl: %foo1.type = fn_decl @foo1 [concrete = constants.%foo1] {} {}
  1124. // CHECK:STDOUT: %foo1.ref: %foo1.type = name_ref foo1, %foo1.decl [concrete = constants.%foo1]
  1125. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1126. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2.ecc]
  1127. // CHECK:STDOUT: %impl.elem0.loc7_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1128. // CHECK:STDOUT: %bound_method.loc7_12.1: <bound method> = bound_method %int_1, %impl.elem0.loc7_12 [concrete = constants.%Convert.bound.ab5]
  1129. // CHECK:STDOUT: %specific_fn.loc7_12: <specific function> = specific_function %impl.elem0.loc7_12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1130. // CHECK:STDOUT: %bound_method.loc7_12.2: <bound method> = bound_method %int_1, %specific_fn.loc7_12 [concrete = constants.%bound_method.9a1]
  1131. // CHECK:STDOUT: %int.convert_checked.loc7_12: init %i32 = call %bound_method.loc7_12.2(%int_1) [concrete = constants.%int_1.5d2]
  1132. // CHECK:STDOUT: %.loc7_12.1: %i32 = value_of_initializer %int.convert_checked.loc7_12 [concrete = constants.%int_1.5d2]
  1133. // CHECK:STDOUT: %.loc7_12.2: %i32 = converted %int_1, %.loc7_12.1 [concrete = constants.%int_1.5d2]
  1134. // CHECK:STDOUT: %impl.elem0.loc7_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1135. // CHECK:STDOUT: %bound_method.loc7_15.1: <bound method> = bound_method %int_2, %impl.elem0.loc7_15 [concrete = constants.%Convert.bound.ef9]
  1136. // CHECK:STDOUT: %specific_fn.loc7_15: <specific function> = specific_function %impl.elem0.loc7_15, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1137. // CHECK:STDOUT: %bound_method.loc7_15.2: <bound method> = bound_method %int_2, %specific_fn.loc7_15 [concrete = constants.%bound_method.b92]
  1138. // CHECK:STDOUT: %int.convert_checked.loc7_15: init %i32 = call %bound_method.loc7_15.2(%int_2) [concrete = constants.%int_2.ef8]
  1139. // CHECK:STDOUT: %.loc7_15.1: %i32 = value_of_initializer %int.convert_checked.loc7_15 [concrete = constants.%int_2.ef8]
  1140. // CHECK:STDOUT: %.loc7_15.2: %i32 = converted %int_2, %.loc7_15.1 [concrete = constants.%int_2.ef8]
  1141. // CHECK:STDOUT: %foo1.call: init %empty_tuple.type = call %foo1.ref(%.loc7_12.2, %.loc7_15.2)
  1142. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1143. // CHECK:STDOUT: %int_32.3: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1144. // CHECK:STDOUT: %i32.3: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1145. // CHECK:STDOUT: %int_32.4: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1146. // CHECK:STDOUT: %i32.4: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1147. // CHECK:STDOUT: %foo2.decl: %foo2.type = fn_decl @foo2 [concrete = constants.%foo2] {} {}
  1148. // CHECK:STDOUT: %foo2.ref: %foo2.type = name_ref foo2, %foo2.decl [concrete = constants.%foo2]
  1149. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  1150. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4.0c1]
  1151. // CHECK:STDOUT: %impl.elem0.loc8_12: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1152. // CHECK:STDOUT: %bound_method.loc8_12.1: <bound method> = bound_method %int_3, %impl.elem0.loc8_12 [concrete = constants.%Convert.bound.b30]
  1153. // CHECK:STDOUT: %specific_fn.loc8_12: <specific function> = specific_function %impl.elem0.loc8_12, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1154. // CHECK:STDOUT: %bound_method.loc8_12.2: <bound method> = bound_method %int_3, %specific_fn.loc8_12 [concrete = constants.%bound_method.047]
  1155. // CHECK:STDOUT: %int.convert_checked.loc8_12: init %i32 = call %bound_method.loc8_12.2(%int_3) [concrete = constants.%int_3.822]
  1156. // CHECK:STDOUT: %.loc8_12.1: %i32 = value_of_initializer %int.convert_checked.loc8_12 [concrete = constants.%int_3.822]
  1157. // CHECK:STDOUT: %.loc8_12.2: %i32 = converted %int_3, %.loc8_12.1 [concrete = constants.%int_3.822]
  1158. // CHECK:STDOUT: %impl.elem0.loc8_15: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1159. // CHECK:STDOUT: %bound_method.loc8_15.1: <bound method> = bound_method %int_4, %impl.elem0.loc8_15 [concrete = constants.%Convert.bound.ac3]
  1160. // CHECK:STDOUT: %specific_fn.loc8_15: <specific function> = specific_function %impl.elem0.loc8_15, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1161. // CHECK:STDOUT: %bound_method.loc8_15.2: <bound method> = bound_method %int_4, %specific_fn.loc8_15 [concrete = constants.%bound_method.1da]
  1162. // CHECK:STDOUT: %int.convert_checked.loc8_15: init %i32 = call %bound_method.loc8_15.2(%int_4) [concrete = constants.%int_4.940]
  1163. // CHECK:STDOUT: %.loc8_15.1: %i32 = value_of_initializer %int.convert_checked.loc8_15 [concrete = constants.%int_4.940]
  1164. // CHECK:STDOUT: %.loc8_15.2: %i32 = converted %int_4, %.loc8_15.1 [concrete = constants.%int_4.940]
  1165. // CHECK:STDOUT: %foo2.call: init %empty_tuple.type = call %foo2.ref(%.loc8_12.2, %.loc8_15.2)
  1166. // CHECK:STDOUT: return
  1167. // CHECK:STDOUT: }
  1168. // CHECK:STDOUT:
  1169. // CHECK:STDOUT: fn @foo1();
  1170. // CHECK:STDOUT:
  1171. // CHECK:STDOUT: fn @foo2();
  1172. // CHECK:STDOUT:
  1173. // CHECK:STDOUT: --- import_unnamed_int_param_function_decl.carbon
  1174. // CHECK:STDOUT:
  1175. // CHECK:STDOUT: constants {
  1176. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1177. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1178. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1179. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1180. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1181. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1182. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1183. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1184. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1185. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1186. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1187. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1188. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1189. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1190. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1191. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1192. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1193. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1194. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1195. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1196. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1197. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1198. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1199. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1200. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1201. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: imports {
  1205. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1206. // CHECK:STDOUT: .Int = %Core.Int
  1207. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1208. // CHECK:STDOUT: import Core//prelude
  1209. // CHECK:STDOUT: import Core//prelude/...
  1210. // CHECK:STDOUT: }
  1211. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1212. // CHECK:STDOUT: .foo = @F.%foo.decl
  1213. // CHECK:STDOUT: import Cpp//...
  1214. // CHECK:STDOUT: }
  1215. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1216. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1217. // 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)]
  1218. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1219. // CHECK:STDOUT: }
  1220. // CHECK:STDOUT:
  1221. // CHECK:STDOUT: file {
  1222. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1223. // CHECK:STDOUT: .Core = imports.%Core
  1224. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1225. // CHECK:STDOUT: .F = %F.decl
  1226. // CHECK:STDOUT: }
  1227. // CHECK:STDOUT: %Core.import = import Core
  1228. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1229. // CHECK:STDOUT: import Cpp "unnamed_int_param_function_decl.h"
  1230. // CHECK:STDOUT: }
  1231. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1232. // CHECK:STDOUT: }
  1233. // CHECK:STDOUT:
  1234. // CHECK:STDOUT: fn @F() {
  1235. // CHECK:STDOUT: !entry:
  1236. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1237. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1238. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1239. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1240. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1241. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1242. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1243. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1244. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1245. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1246. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  1247. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  1248. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  1249. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  1250. // CHECK:STDOUT: return
  1251. // CHECK:STDOUT: }
  1252. // CHECK:STDOUT:
  1253. // CHECK:STDOUT: fn @foo();
  1254. // CHECK:STDOUT:
  1255. // CHECK:STDOUT: --- fail_todo_int_default_param_parameterless_call.carbon
  1256. // CHECK:STDOUT:
  1257. // CHECK:STDOUT: constants {
  1258. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1259. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1260. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1261. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1262. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1263. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1264. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1265. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1266. // CHECK:STDOUT: }
  1267. // CHECK:STDOUT:
  1268. // CHECK:STDOUT: imports {
  1269. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1270. // CHECK:STDOUT: .Int = %Core.Int
  1271. // CHECK:STDOUT: import Core//prelude
  1272. // CHECK:STDOUT: import Core//prelude/...
  1273. // CHECK:STDOUT: }
  1274. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1275. // CHECK:STDOUT: .foo = @F.%foo.decl
  1276. // CHECK:STDOUT: import Cpp//...
  1277. // CHECK:STDOUT: }
  1278. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1279. // CHECK:STDOUT: }
  1280. // CHECK:STDOUT:
  1281. // CHECK:STDOUT: file {
  1282. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1283. // CHECK:STDOUT: .Core = imports.%Core
  1284. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1285. // CHECK:STDOUT: .F = %F.decl
  1286. // CHECK:STDOUT: }
  1287. // CHECK:STDOUT: %Core.import = import Core
  1288. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1289. // CHECK:STDOUT: import Cpp "int_default_param_function_decl.h"
  1290. // CHECK:STDOUT: }
  1291. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1292. // CHECK:STDOUT: }
  1293. // CHECK:STDOUT:
  1294. // CHECK:STDOUT: fn @F() {
  1295. // CHECK:STDOUT: !entry:
  1296. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1297. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1298. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1299. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1300. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1301. // CHECK:STDOUT: return
  1302. // CHECK:STDOUT: }
  1303. // CHECK:STDOUT:
  1304. // CHECK:STDOUT: fn @foo();
  1305. // CHECK:STDOUT:
  1306. // CHECK:STDOUT: --- import_int_max_param_function_decl.carbon
  1307. // CHECK:STDOUT:
  1308. // CHECK:STDOUT: constants {
  1309. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1310. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1311. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1312. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1313. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1314. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1315. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1316. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1317. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1318. // CHECK:STDOUT: %int_2147483647.d89: Core.IntLiteral = int_value 2147483647 [concrete]
  1319. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1320. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1321. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1322. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1323. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1324. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1325. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1326. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1327. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1328. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1329. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1330. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1331. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_2147483647.d89, %Convert.956 [concrete]
  1332. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1333. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2147483647.d89, %Convert.specific_fn [concrete]
  1334. // CHECK:STDOUT: %int_2147483647.a74: %i32 = int_value 2147483647 [concrete]
  1335. // CHECK:STDOUT: }
  1336. // CHECK:STDOUT:
  1337. // CHECK:STDOUT: imports {
  1338. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1339. // CHECK:STDOUT: .Int = %Core.Int
  1340. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1341. // CHECK:STDOUT: import Core//prelude
  1342. // CHECK:STDOUT: import Core//prelude/...
  1343. // CHECK:STDOUT: }
  1344. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1345. // CHECK:STDOUT: .foo = @F.%foo.decl
  1346. // CHECK:STDOUT: import Cpp//...
  1347. // CHECK:STDOUT: }
  1348. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1349. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1350. // 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)]
  1351. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT:
  1354. // CHECK:STDOUT: file {
  1355. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1356. // CHECK:STDOUT: .Core = imports.%Core
  1357. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1358. // CHECK:STDOUT: .F = %F.decl
  1359. // CHECK:STDOUT: }
  1360. // CHECK:STDOUT: %Core.import = import Core
  1361. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1362. // CHECK:STDOUT: import Cpp "int_max_param_function_decl.h"
  1363. // CHECK:STDOUT: }
  1364. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1365. // CHECK:STDOUT: }
  1366. // CHECK:STDOUT:
  1367. // CHECK:STDOUT: fn @F() {
  1368. // CHECK:STDOUT: !entry:
  1369. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1370. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1371. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1372. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1373. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1374. // CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
  1375. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1376. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_2147483647, %impl.elem0 [concrete = constants.%Convert.bound]
  1377. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1378. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_2147483647, %specific_fn [concrete = constants.%bound_method]
  1379. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_2147483647) [concrete = constants.%int_2147483647.a74]
  1380. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2147483647.a74]
  1381. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_2147483647, %.loc7_11.1 [concrete = constants.%int_2147483647.a74]
  1382. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  1383. // CHECK:STDOUT: return
  1384. // CHECK:STDOUT: }
  1385. // CHECK:STDOUT:
  1386. // CHECK:STDOUT: fn @foo();
  1387. // CHECK:STDOUT:
  1388. // CHECK:STDOUT: --- fail_overflow_int_max_param_function_decl.carbon
  1389. // CHECK:STDOUT:
  1390. // CHECK:STDOUT: constants {
  1391. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1392. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1393. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1394. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1395. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1396. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1397. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1398. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1399. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1400. // CHECK:STDOUT: %int_2147483648.1db: Core.IntLiteral = int_value 2147483648 [concrete]
  1401. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1402. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1403. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1404. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1405. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1406. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1407. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1408. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1409. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1410. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1411. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1412. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1413. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_2147483648.1db, %Convert.956 [concrete]
  1414. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1415. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_2147483648.1db, %Convert.specific_fn [concrete]
  1416. // CHECK:STDOUT: %int_2147483648.8df: %i32 = int_value 2147483648 [concrete]
  1417. // CHECK:STDOUT: }
  1418. // CHECK:STDOUT:
  1419. // CHECK:STDOUT: imports {
  1420. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1421. // CHECK:STDOUT: .Int = %Core.Int
  1422. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1423. // CHECK:STDOUT: import Core//prelude
  1424. // CHECK:STDOUT: import Core//prelude/...
  1425. // CHECK:STDOUT: }
  1426. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1427. // CHECK:STDOUT: .foo = @F.%foo.decl
  1428. // CHECK:STDOUT: import Cpp//...
  1429. // CHECK:STDOUT: }
  1430. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1431. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1432. // 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)]
  1433. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1434. // CHECK:STDOUT: }
  1435. // CHECK:STDOUT:
  1436. // CHECK:STDOUT: file {
  1437. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1438. // CHECK:STDOUT: .Core = imports.%Core
  1439. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1440. // CHECK:STDOUT: .F = %F.decl
  1441. // CHECK:STDOUT: }
  1442. // CHECK:STDOUT: %Core.import = import Core
  1443. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1444. // CHECK:STDOUT: import Cpp "overflow_int_max_param_function_decl.h"
  1445. // CHECK:STDOUT: }
  1446. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1447. // CHECK:STDOUT: }
  1448. // CHECK:STDOUT:
  1449. // CHECK:STDOUT: fn @F() {
  1450. // CHECK:STDOUT: !entry:
  1451. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1452. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1453. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1454. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1455. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1456. // CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
  1457. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1458. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_2147483648, %impl.elem0 [concrete = constants.%Convert.bound]
  1459. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1460. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int_2147483648, %specific_fn [concrete = constants.%bound_method]
  1461. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc12_11.2(%int_2147483648) [concrete = constants.%int_2147483648.8df]
  1462. // CHECK:STDOUT: %.loc12_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_2147483648.8df]
  1463. // CHECK:STDOUT: %.loc12_11.2: %i32 = converted %int_2147483648, %.loc12_11.1 [concrete = constants.%int_2147483648.8df]
  1464. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.2)
  1465. // CHECK:STDOUT: return
  1466. // CHECK:STDOUT: }
  1467. // CHECK:STDOUT:
  1468. // CHECK:STDOUT: fn @foo();
  1469. // CHECK:STDOUT:
  1470. // CHECK:STDOUT: --- import_int_min_param_function_decl.carbon
  1471. // CHECK:STDOUT:
  1472. // CHECK:STDOUT: constants {
  1473. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1474. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1475. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1476. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1477. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1478. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1479. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1480. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1481. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1482. // CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete]
  1483. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  1484. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  1485. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  1486. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  1487. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  1488. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  1489. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  1490. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_2147483648, %Op.bba [concrete]
  1491. // CHECK:STDOUT: %int_-2147483648.3b9: Core.IntLiteral = int_value -2147483648 [concrete]
  1492. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1493. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1494. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1495. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1496. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1497. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1498. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1499. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1500. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1501. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1502. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1503. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1504. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-2147483648.3b9, %Convert.956 [concrete]
  1505. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1506. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-2147483648.3b9, %Convert.specific_fn [concrete]
  1507. // CHECK:STDOUT: %int_-2147483648.95c: %i32 = int_value -2147483648 [concrete]
  1508. // CHECK:STDOUT: }
  1509. // CHECK:STDOUT:
  1510. // CHECK:STDOUT: imports {
  1511. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1512. // CHECK:STDOUT: .Int = %Core.Int
  1513. // CHECK:STDOUT: .Negate = %Core.Negate
  1514. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1515. // CHECK:STDOUT: import Core//prelude
  1516. // CHECK:STDOUT: import Core//prelude/...
  1517. // CHECK:STDOUT: }
  1518. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1519. // CHECK:STDOUT: .foo = @F.%foo.decl
  1520. // CHECK:STDOUT: import Cpp//...
  1521. // CHECK:STDOUT: }
  1522. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1523. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  1524. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  1525. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  1526. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1527. // 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)]
  1528. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1529. // CHECK:STDOUT: }
  1530. // CHECK:STDOUT:
  1531. // CHECK:STDOUT: file {
  1532. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1533. // CHECK:STDOUT: .Core = imports.%Core
  1534. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1535. // CHECK:STDOUT: .F = %F.decl
  1536. // CHECK:STDOUT: }
  1537. // CHECK:STDOUT: %Core.import = import Core
  1538. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1539. // CHECK:STDOUT: import Cpp "int_min_param_function_decl.h"
  1540. // CHECK:STDOUT: }
  1541. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1542. // CHECK:STDOUT: }
  1543. // CHECK:STDOUT:
  1544. // CHECK:STDOUT: fn @F() {
  1545. // CHECK:STDOUT: !entry:
  1546. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1547. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1548. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1549. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1550. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1551. // CHECK:STDOUT: %int_2147483648: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648]
  1552. // CHECK:STDOUT: %impl.elem0.loc7_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  1553. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_2147483648, %impl.elem0.loc7_11.1 [concrete = constants.%Op.bound]
  1554. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc7_11.1(%int_2147483648) [concrete = constants.%int_-2147483648.3b9]
  1555. // CHECK:STDOUT: %impl.elem0.loc7_11.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1556. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc7_11.2 [concrete = constants.%Convert.bound]
  1557. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc7_11.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1558. // CHECK:STDOUT: %bound_method.loc7_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  1559. // CHECK:STDOUT: %.loc7_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-2147483648.3b9]
  1560. // CHECK:STDOUT: %.loc7_11.2: Core.IntLiteral = converted %int.snegate, %.loc7_11.1 [concrete = constants.%int_-2147483648.3b9]
  1561. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.3(%.loc7_11.2) [concrete = constants.%int_-2147483648.95c]
  1562. // CHECK:STDOUT: %.loc7_11.3: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_-2147483648.95c]
  1563. // CHECK:STDOUT: %.loc7_11.4: %i32 = converted %int.snegate, %.loc7_11.3 [concrete = constants.%int_-2147483648.95c]
  1564. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.4)
  1565. // CHECK:STDOUT: return
  1566. // CHECK:STDOUT: }
  1567. // CHECK:STDOUT:
  1568. // CHECK:STDOUT: fn @foo();
  1569. // CHECK:STDOUT:
  1570. // CHECK:STDOUT: --- fail_overflow_int_min_param_function_decl.carbon
  1571. // CHECK:STDOUT:
  1572. // CHECK:STDOUT: constants {
  1573. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1574. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1575. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1576. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1577. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1578. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1579. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1580. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1581. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1582. // CHECK:STDOUT: %int_2147483649: Core.IntLiteral = int_value 2147483649 [concrete]
  1583. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  1584. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  1585. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  1586. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  1587. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  1588. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  1589. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  1590. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_2147483649, %Op.bba [concrete]
  1591. // CHECK:STDOUT: %int_-2147483649.df1: Core.IntLiteral = int_value -2147483649 [concrete]
  1592. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1593. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1594. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1595. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1596. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1597. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1598. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1599. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1600. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1601. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1602. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1603. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1604. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-2147483649.df1, %Convert.956 [concrete]
  1605. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1606. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-2147483649.df1, %Convert.specific_fn [concrete]
  1607. // CHECK:STDOUT: %int_-2147483649.74e: %i32 = int_value -2147483649 [concrete]
  1608. // CHECK:STDOUT: }
  1609. // CHECK:STDOUT:
  1610. // CHECK:STDOUT: imports {
  1611. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1612. // CHECK:STDOUT: .Int = %Core.Int
  1613. // CHECK:STDOUT: .Negate = %Core.Negate
  1614. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1615. // CHECK:STDOUT: import Core//prelude
  1616. // CHECK:STDOUT: import Core//prelude/...
  1617. // CHECK:STDOUT: }
  1618. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1619. // CHECK:STDOUT: .foo = @F.%foo.decl
  1620. // CHECK:STDOUT: import Cpp//...
  1621. // CHECK:STDOUT: }
  1622. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1623. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  1624. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  1625. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  1626. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1627. // 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)]
  1628. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1629. // CHECK:STDOUT: }
  1630. // CHECK:STDOUT:
  1631. // CHECK:STDOUT: file {
  1632. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1633. // CHECK:STDOUT: .Core = imports.%Core
  1634. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1635. // CHECK:STDOUT: .F = %F.decl
  1636. // CHECK:STDOUT: }
  1637. // CHECK:STDOUT: %Core.import = import Core
  1638. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1639. // CHECK:STDOUT: import Cpp "overflow_int_min_param_function_decl.h"
  1640. // CHECK:STDOUT: }
  1641. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1642. // CHECK:STDOUT: }
  1643. // CHECK:STDOUT:
  1644. // CHECK:STDOUT: fn @F() {
  1645. // CHECK:STDOUT: !entry:
  1646. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1647. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1648. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1649. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1650. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1651. // CHECK:STDOUT: %int_2147483649: Core.IntLiteral = int_value 2147483649 [concrete = constants.%int_2147483649]
  1652. // CHECK:STDOUT: %impl.elem0.loc12_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  1653. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_2147483649, %impl.elem0.loc12_11.1 [concrete = constants.%Op.bound]
  1654. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc12_11.1(%int_2147483649) [concrete = constants.%int_-2147483649.df1]
  1655. // CHECK:STDOUT: %impl.elem0.loc12_11.2: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1656. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc12_11.2 [concrete = constants.%Convert.bound]
  1657. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc12_11.2, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1658. // CHECK:STDOUT: %bound_method.loc12_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  1659. // CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-2147483649.df1]
  1660. // CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate, %.loc12_11.1 [concrete = constants.%int_-2147483649.df1]
  1661. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc12_11.3(%.loc12_11.2) [concrete = constants.%int_-2147483649.74e]
  1662. // CHECK:STDOUT: %.loc12_11.3: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_-2147483649.74e]
  1663. // CHECK:STDOUT: %.loc12_11.4: %i32 = converted %int.snegate, %.loc12_11.3 [concrete = constants.%int_-2147483649.74e]
  1664. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.4)
  1665. // CHECK:STDOUT: return
  1666. // CHECK:STDOUT: }
  1667. // CHECK:STDOUT:
  1668. // CHECK:STDOUT: fn @foo();
  1669. // CHECK:STDOUT:
  1670. // CHECK:STDOUT: --- import_int_default_param_sucessful_call_function_decl.carbon
  1671. // CHECK:STDOUT:
  1672. // CHECK:STDOUT: constants {
  1673. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1674. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1675. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1676. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1677. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1678. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1679. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1680. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1681. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1682. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1683. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1684. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1685. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1686. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1687. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1688. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1689. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1690. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1691. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1692. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1693. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1694. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1695. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1696. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1697. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1698. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1699. // CHECK:STDOUT: }
  1700. // CHECK:STDOUT:
  1701. // CHECK:STDOUT: imports {
  1702. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1703. // CHECK:STDOUT: .Int = %Core.Int
  1704. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1705. // CHECK:STDOUT: import Core//prelude
  1706. // CHECK:STDOUT: import Core//prelude/...
  1707. // CHECK:STDOUT: }
  1708. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1709. // CHECK:STDOUT: .foo = @F.%foo.decl
  1710. // CHECK:STDOUT: import Cpp//...
  1711. // CHECK:STDOUT: }
  1712. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1713. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1714. // 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)]
  1715. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1716. // CHECK:STDOUT: }
  1717. // CHECK:STDOUT:
  1718. // CHECK:STDOUT: file {
  1719. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1720. // CHECK:STDOUT: .Core = imports.%Core
  1721. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1722. // CHECK:STDOUT: .F = %F.decl
  1723. // CHECK:STDOUT: }
  1724. // CHECK:STDOUT: %Core.import = import Core
  1725. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1726. // CHECK:STDOUT: import Cpp "int_default_param_function_decl.h"
  1727. // CHECK:STDOUT: }
  1728. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1729. // CHECK:STDOUT: }
  1730. // CHECK:STDOUT:
  1731. // CHECK:STDOUT: fn @F() {
  1732. // CHECK:STDOUT: !entry:
  1733. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1734. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1735. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1736. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1737. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1738. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1739. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1740. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1741. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1742. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1743. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  1744. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  1745. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  1746. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  1747. // CHECK:STDOUT: return
  1748. // CHECK:STDOUT: }
  1749. // CHECK:STDOUT:
  1750. // CHECK:STDOUT: fn @foo();
  1751. // CHECK:STDOUT:
  1752. // CHECK:STDOUT: --- import_int_const_param_function_decl.carbon
  1753. // CHECK:STDOUT:
  1754. // CHECK:STDOUT: constants {
  1755. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1756. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1757. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1758. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1759. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1760. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1761. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1762. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1763. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1764. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1765. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1766. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1767. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1768. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1769. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1770. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1771. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1772. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1773. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1774. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1775. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1776. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1777. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1778. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1779. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1780. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1781. // CHECK:STDOUT: }
  1782. // CHECK:STDOUT:
  1783. // CHECK:STDOUT: imports {
  1784. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1785. // CHECK:STDOUT: .Int = %Core.Int
  1786. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1787. // CHECK:STDOUT: import Core//prelude
  1788. // CHECK:STDOUT: import Core//prelude/...
  1789. // CHECK:STDOUT: }
  1790. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1791. // CHECK:STDOUT: .foo = @F.%foo.decl
  1792. // CHECK:STDOUT: import Cpp//...
  1793. // CHECK:STDOUT: }
  1794. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1795. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1796. // 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)]
  1797. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1798. // CHECK:STDOUT: }
  1799. // CHECK:STDOUT:
  1800. // CHECK:STDOUT: file {
  1801. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1802. // CHECK:STDOUT: .Core = imports.%Core
  1803. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1804. // CHECK:STDOUT: .F = %F.decl
  1805. // CHECK:STDOUT: }
  1806. // CHECK:STDOUT: %Core.import = import Core
  1807. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1808. // CHECK:STDOUT: import Cpp "int_const_param_function_decl.h"
  1809. // CHECK:STDOUT: }
  1810. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1811. // CHECK:STDOUT: }
  1812. // CHECK:STDOUT:
  1813. // CHECK:STDOUT: fn @F() {
  1814. // CHECK:STDOUT: !entry:
  1815. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1816. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1817. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1818. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  1819. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  1820. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1821. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1822. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1823. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1824. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1825. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_11.2(%int_1) [concrete = constants.%int_1.5d2]
  1826. // CHECK:STDOUT: %.loc7_11.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  1827. // CHECK:STDOUT: %.loc7_11.2: %i32 = converted %int_1, %.loc7_11.1 [concrete = constants.%int_1.5d2]
  1828. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  1829. // CHECK:STDOUT: return
  1830. // CHECK:STDOUT: }
  1831. // CHECK:STDOUT:
  1832. // CHECK:STDOUT: fn @foo();
  1833. // CHECK:STDOUT:
  1834. // CHECK:STDOUT: --- fail_todo_int_ref_param_function_decl.carbon
  1835. // CHECK:STDOUT:
  1836. // CHECK:STDOUT: constants {
  1837. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1838. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1839. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1840. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1841. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1842. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1843. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  1844. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1845. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1846. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1847. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1848. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1849. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1850. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1851. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1852. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1853. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1854. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1855. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1856. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1857. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1858. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1859. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1860. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1861. // CHECK:STDOUT: }
  1862. // CHECK:STDOUT:
  1863. // CHECK:STDOUT: imports {
  1864. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1865. // CHECK:STDOUT: .Int = %Core.Int
  1866. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1867. // CHECK:STDOUT: import Core//prelude
  1868. // CHECK:STDOUT: import Core//prelude/...
  1869. // CHECK:STDOUT: }
  1870. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1871. // CHECK:STDOUT: .foo = <error>
  1872. // CHECK:STDOUT: import Cpp//...
  1873. // CHECK:STDOUT: }
  1874. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1875. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1876. // 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)]
  1877. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1878. // CHECK:STDOUT: }
  1879. // CHECK:STDOUT:
  1880. // CHECK:STDOUT: file {
  1881. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1882. // CHECK:STDOUT: .Core = imports.%Core
  1883. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1884. // CHECK:STDOUT: .F = %F.decl
  1885. // CHECK:STDOUT: }
  1886. // CHECK:STDOUT: %Core.import = import Core
  1887. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1888. // CHECK:STDOUT: import Cpp "int_ref_param_function_decl.h"
  1889. // CHECK:STDOUT: }
  1890. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1891. // CHECK:STDOUT: }
  1892. // CHECK:STDOUT:
  1893. // CHECK:STDOUT: fn @F() {
  1894. // CHECK:STDOUT: !entry:
  1895. // CHECK:STDOUT: name_binding_decl {
  1896. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  1897. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.7ce = var_pattern %a.patt [concrete]
  1898. // CHECK:STDOUT: }
  1899. // CHECK:STDOUT: %a.var: ref %i32 = var a
  1900. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1901. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1902. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1903. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1904. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1905. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2]
  1906. // CHECK:STDOUT: %.loc7_3.2: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2]
  1907. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  1908. // CHECK:STDOUT: %.loc7_10: type = splice_block %i32 [concrete = constants.%i32] {
  1909. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1910. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1911. // CHECK:STDOUT: }
  1912. // CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
  1913. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1914. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  1915. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  1916. // CHECK:STDOUT: return
  1917. // CHECK:STDOUT: }
  1918. // CHECK:STDOUT:
  1919. // CHECK:STDOUT: --- fail_todo_int_const_ref_param_function_decl.carbon
  1920. // CHECK:STDOUT:
  1921. // CHECK:STDOUT: constants {
  1922. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1923. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1924. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1925. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1926. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1927. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1928. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  1929. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1930. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1931. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1932. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1933. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  1934. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  1935. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  1936. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  1937. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  1938. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  1939. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  1940. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  1941. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  1942. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  1943. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  1944. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  1945. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1946. // CHECK:STDOUT: }
  1947. // CHECK:STDOUT:
  1948. // CHECK:STDOUT: imports {
  1949. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1950. // CHECK:STDOUT: .Int = %Core.Int
  1951. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1952. // CHECK:STDOUT: import Core//prelude
  1953. // CHECK:STDOUT: import Core//prelude/...
  1954. // CHECK:STDOUT: }
  1955. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1956. // CHECK:STDOUT: .foo = <error>
  1957. // CHECK:STDOUT: import Cpp//...
  1958. // CHECK:STDOUT: }
  1959. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  1960. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1961. // 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)]
  1962. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  1963. // CHECK:STDOUT: }
  1964. // CHECK:STDOUT:
  1965. // CHECK:STDOUT: file {
  1966. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1967. // CHECK:STDOUT: .Core = imports.%Core
  1968. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1969. // CHECK:STDOUT: .F = %F.decl
  1970. // CHECK:STDOUT: }
  1971. // CHECK:STDOUT: %Core.import = import Core
  1972. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1973. // CHECK:STDOUT: import Cpp "int_const_ref_param_function_decl.h"
  1974. // CHECK:STDOUT: }
  1975. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1976. // CHECK:STDOUT: }
  1977. // CHECK:STDOUT:
  1978. // CHECK:STDOUT: fn @F() {
  1979. // CHECK:STDOUT: !entry:
  1980. // CHECK:STDOUT: name_binding_decl {
  1981. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  1982. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.7ce = var_pattern %a.patt [concrete]
  1983. // CHECK:STDOUT: }
  1984. // CHECK:STDOUT: %a.var: ref %i32 = var a
  1985. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1986. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  1987. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  1988. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  1989. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  1990. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2]
  1991. // CHECK:STDOUT: %.loc7_3.2: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2]
  1992. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  1993. // CHECK:STDOUT: %.loc7_11: type = splice_block %i32 [concrete = constants.%i32] {
  1994. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1995. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1996. // CHECK:STDOUT: }
  1997. // CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
  1998. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1999. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  2000. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  2001. // CHECK:STDOUT: return
  2002. // CHECK:STDOUT: }
  2003. // CHECK:STDOUT:
  2004. // CHECK:STDOUT: --- fail_todo_int_pointer_param_function_decl.carbon
  2005. // CHECK:STDOUT:
  2006. // CHECK:STDOUT: constants {
  2007. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2008. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2009. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2010. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2011. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2012. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2013. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  2014. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2015. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2016. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2017. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  2018. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  2019. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2020. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2021. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2022. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  2023. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  2024. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  2025. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  2026. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  2027. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  2028. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  2029. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2030. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  2031. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  2032. // CHECK:STDOUT: }
  2033. // CHECK:STDOUT:
  2034. // CHECK:STDOUT: imports {
  2035. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2036. // CHECK:STDOUT: .Int = %Core.Int
  2037. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2038. // CHECK:STDOUT: import Core//prelude
  2039. // CHECK:STDOUT: import Core//prelude/...
  2040. // CHECK:STDOUT: }
  2041. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2042. // CHECK:STDOUT: .foo = <error>
  2043. // CHECK:STDOUT: import Cpp//...
  2044. // CHECK:STDOUT: }
  2045. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2046. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2047. // 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)]
  2048. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2049. // CHECK:STDOUT: }
  2050. // CHECK:STDOUT:
  2051. // CHECK:STDOUT: file {
  2052. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2053. // CHECK:STDOUT: .Core = imports.%Core
  2054. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2055. // CHECK:STDOUT: .F = %F.decl
  2056. // CHECK:STDOUT: }
  2057. // CHECK:STDOUT: %Core.import = import Core
  2058. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2059. // CHECK:STDOUT: import Cpp "int_pointer_param_function_decl.h"
  2060. // CHECK:STDOUT: }
  2061. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2062. // CHECK:STDOUT: }
  2063. // CHECK:STDOUT:
  2064. // CHECK:STDOUT: fn @F() {
  2065. // CHECK:STDOUT: !entry:
  2066. // CHECK:STDOUT: name_binding_decl {
  2067. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  2068. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.7ce = var_pattern %a.patt [concrete]
  2069. // CHECK:STDOUT: }
  2070. // CHECK:STDOUT: %a.var: ref %i32 = var a
  2071. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2072. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  2073. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2074. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  2075. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2076. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2]
  2077. // CHECK:STDOUT: %.loc7_3.2: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2]
  2078. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  2079. // CHECK:STDOUT: %.loc7_10: type = splice_block %i32 [concrete = constants.%i32] {
  2080. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2081. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2082. // CHECK:STDOUT: }
  2083. // CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
  2084. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2085. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  2086. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  2087. // CHECK:STDOUT: %addr: %ptr.235 = addr_of %a.ref
  2088. // CHECK:STDOUT: return
  2089. // CHECK:STDOUT: }
  2090. // CHECK:STDOUT:
  2091. // CHECK:STDOUT: --- fail_todo_int_const_pointer_param_function_decl.carbon
  2092. // CHECK:STDOUT:
  2093. // CHECK:STDOUT: constants {
  2094. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2095. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2096. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2097. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2098. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2099. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2100. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  2101. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2102. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2103. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2104. // CHECK:STDOUT: %ImplicitAs.type.205: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  2105. // CHECK:STDOUT: %Convert.type.1b6: type = fn_type @Convert.1, @ImplicitAs(%i32) [concrete]
  2106. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2107. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2108. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2109. // CHECK:STDOUT: %ImplicitAs.impl_witness.c75: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_32) [concrete]
  2110. // CHECK:STDOUT: %Convert.type.035: type = fn_type @Convert.2, @impl.4f9(%int_32) [concrete]
  2111. // CHECK:STDOUT: %Convert.956: %Convert.type.035 = struct_value () [concrete]
  2112. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.205 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.c75) [concrete]
  2113. // CHECK:STDOUT: %.9c3: type = fn_type_with_self_type %Convert.type.1b6, %ImplicitAs.facet [concrete]
  2114. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.956 [concrete]
  2115. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.956, @Convert.2(%int_32) [concrete]
  2116. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2117. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  2118. // CHECK:STDOUT: %ptr.235: type = ptr_type %i32 [concrete]
  2119. // CHECK:STDOUT: }
  2120. // CHECK:STDOUT:
  2121. // CHECK:STDOUT: imports {
  2122. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2123. // CHECK:STDOUT: .Int = %Core.Int
  2124. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2125. // CHECK:STDOUT: import Core//prelude
  2126. // CHECK:STDOUT: import Core//prelude/...
  2127. // CHECK:STDOUT: }
  2128. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2129. // CHECK:STDOUT: .foo = <error>
  2130. // CHECK:STDOUT: import Cpp//...
  2131. // CHECK:STDOUT: }
  2132. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2133. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2134. // 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)]
  2135. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2136. // CHECK:STDOUT: }
  2137. // CHECK:STDOUT:
  2138. // CHECK:STDOUT: file {
  2139. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2140. // CHECK:STDOUT: .Core = imports.%Core
  2141. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2142. // CHECK:STDOUT: .F = %F.decl
  2143. // CHECK:STDOUT: }
  2144. // CHECK:STDOUT: %Core.import = import Core
  2145. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2146. // CHECK:STDOUT: import Cpp "int_const_pointer_param_function_decl.h"
  2147. // CHECK:STDOUT: }
  2148. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2149. // CHECK:STDOUT: }
  2150. // CHECK:STDOUT:
  2151. // CHECK:STDOUT: fn @F() {
  2152. // CHECK:STDOUT: !entry:
  2153. // CHECK:STDOUT: name_binding_decl {
  2154. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = binding_pattern a [concrete]
  2155. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.7ce = var_pattern %a.patt [concrete]
  2156. // CHECK:STDOUT: }
  2157. // CHECK:STDOUT: %a.var: ref %i32 = var a
  2158. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2159. // CHECK:STDOUT: %impl.elem0: %.9c3 = impl_witness_access constants.%ImplicitAs.impl_witness.c75, element0 [concrete = constants.%Convert.956]
  2160. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2161. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  2162. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2163. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.5d2]
  2164. // CHECK:STDOUT: %.loc7_3.2: init %i32 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.5d2]
  2165. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  2166. // CHECK:STDOUT: %.loc7_11: type = splice_block %i32 [concrete = constants.%i32] {
  2167. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2168. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2169. // CHECK:STDOUT: }
  2170. // CHECK:STDOUT: %a: ref %i32 = bind_name a, %a.var
  2171. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2172. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  2173. // CHECK:STDOUT: %a.ref: ref %i32 = name_ref a, %a
  2174. // CHECK:STDOUT: %addr: %ptr.235 = addr_of %a.ref
  2175. // CHECK:STDOUT: return
  2176. // CHECK:STDOUT: }
  2177. // CHECK:STDOUT:
  2178. // CHECK:STDOUT: --- import_short_param_function_decl.carbon
  2179. // CHECK:STDOUT:
  2180. // CHECK:STDOUT: constants {
  2181. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2182. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2183. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2184. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2185. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2186. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2187. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2188. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2189. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2190. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2191. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2192. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2193. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  2194. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  2195. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2196. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2197. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2198. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  2199. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  2200. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  2201. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  2202. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  2203. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  2204. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  2205. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2206. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  2207. // CHECK:STDOUT: }
  2208. // CHECK:STDOUT:
  2209. // CHECK:STDOUT: imports {
  2210. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2211. // CHECK:STDOUT: .Int = %Core.Int
  2212. // CHECK:STDOUT: .As = %Core.As
  2213. // CHECK:STDOUT: import Core//prelude
  2214. // CHECK:STDOUT: import Core//prelude/...
  2215. // CHECK:STDOUT: }
  2216. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2217. // CHECK:STDOUT: .foo = @F.%foo.decl
  2218. // CHECK:STDOUT: import Cpp//...
  2219. // CHECK:STDOUT: }
  2220. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2221. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  2222. // 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)]
  2223. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  2224. // CHECK:STDOUT: }
  2225. // CHECK:STDOUT:
  2226. // CHECK:STDOUT: file {
  2227. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2228. // CHECK:STDOUT: .Core = imports.%Core
  2229. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2230. // CHECK:STDOUT: .F = %F.decl
  2231. // CHECK:STDOUT: }
  2232. // CHECK:STDOUT: %Core.import = import Core
  2233. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2234. // CHECK:STDOUT: import Cpp "short_param_function_decl.h"
  2235. // CHECK:STDOUT: }
  2236. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2237. // CHECK:STDOUT: }
  2238. // CHECK:STDOUT:
  2239. // CHECK:STDOUT: fn @F() {
  2240. // CHECK:STDOUT: !entry:
  2241. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2242. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2243. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2244. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2245. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2246. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2247. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2248. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2249. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  2250. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2251. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2252. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2253. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  2254. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  2255. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  2256. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  2257. // CHECK:STDOUT: return
  2258. // CHECK:STDOUT: }
  2259. // CHECK:STDOUT:
  2260. // CHECK:STDOUT: fn @foo();
  2261. // CHECK:STDOUT:
  2262. // CHECK:STDOUT: --- import_short_int_param_function_decl.carbon
  2263. // CHECK:STDOUT:
  2264. // CHECK:STDOUT: constants {
  2265. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2266. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2267. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2268. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2269. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2270. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2271. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2272. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2273. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2274. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2275. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2276. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2277. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  2278. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  2279. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2280. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2281. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2282. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  2283. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  2284. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  2285. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  2286. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  2287. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  2288. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  2289. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2290. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  2291. // CHECK:STDOUT: }
  2292. // CHECK:STDOUT:
  2293. // CHECK:STDOUT: imports {
  2294. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2295. // CHECK:STDOUT: .Int = %Core.Int
  2296. // CHECK:STDOUT: .As = %Core.As
  2297. // CHECK:STDOUT: import Core//prelude
  2298. // CHECK:STDOUT: import Core//prelude/...
  2299. // CHECK:STDOUT: }
  2300. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2301. // CHECK:STDOUT: .foo = @F.%foo.decl
  2302. // CHECK:STDOUT: import Cpp//...
  2303. // CHECK:STDOUT: }
  2304. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2305. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  2306. // 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)]
  2307. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  2308. // CHECK:STDOUT: }
  2309. // CHECK:STDOUT:
  2310. // CHECK:STDOUT: file {
  2311. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2312. // CHECK:STDOUT: .Core = imports.%Core
  2313. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2314. // CHECK:STDOUT: .F = %F.decl
  2315. // CHECK:STDOUT: }
  2316. // CHECK:STDOUT: %Core.import = import Core
  2317. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2318. // CHECK:STDOUT: import Cpp "short_int_param_function_decl.h"
  2319. // CHECK:STDOUT: }
  2320. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2321. // CHECK:STDOUT: }
  2322. // CHECK:STDOUT:
  2323. // CHECK:STDOUT: fn @F() {
  2324. // CHECK:STDOUT: !entry:
  2325. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2326. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2327. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2328. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2329. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2330. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2331. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2332. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2333. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  2334. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2335. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2336. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2337. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  2338. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  2339. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  2340. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  2341. // CHECK:STDOUT: return
  2342. // CHECK:STDOUT: }
  2343. // CHECK:STDOUT:
  2344. // CHECK:STDOUT: fn @foo();
  2345. // CHECK:STDOUT:
  2346. // CHECK:STDOUT: --- import_signed_short_param_function_decl.carbon
  2347. // CHECK:STDOUT:
  2348. // CHECK:STDOUT: constants {
  2349. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2350. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2351. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2352. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2353. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2354. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2355. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2356. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2357. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2358. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2359. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2360. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2361. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  2362. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  2363. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2364. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2365. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2366. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  2367. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  2368. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  2369. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  2370. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  2371. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  2372. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  2373. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2374. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  2375. // CHECK:STDOUT: }
  2376. // CHECK:STDOUT:
  2377. // CHECK:STDOUT: imports {
  2378. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2379. // CHECK:STDOUT: .Int = %Core.Int
  2380. // CHECK:STDOUT: .As = %Core.As
  2381. // CHECK:STDOUT: import Core//prelude
  2382. // CHECK:STDOUT: import Core//prelude/...
  2383. // CHECK:STDOUT: }
  2384. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2385. // CHECK:STDOUT: .foo = @F.%foo.decl
  2386. // CHECK:STDOUT: import Cpp//...
  2387. // CHECK:STDOUT: }
  2388. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2389. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  2390. // 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)]
  2391. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  2392. // CHECK:STDOUT: }
  2393. // CHECK:STDOUT:
  2394. // CHECK:STDOUT: file {
  2395. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2396. // CHECK:STDOUT: .Core = imports.%Core
  2397. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2398. // CHECK:STDOUT: .F = %F.decl
  2399. // CHECK:STDOUT: }
  2400. // CHECK:STDOUT: %Core.import = import Core
  2401. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2402. // CHECK:STDOUT: import Cpp "signed_short_param_function_decl.h"
  2403. // CHECK:STDOUT: }
  2404. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2405. // CHECK:STDOUT: }
  2406. // CHECK:STDOUT:
  2407. // CHECK:STDOUT: fn @F() {
  2408. // CHECK:STDOUT: !entry:
  2409. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2410. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2411. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2412. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2413. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2414. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2415. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2416. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2417. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  2418. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2419. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2420. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2421. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  2422. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  2423. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  2424. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  2425. // CHECK:STDOUT: return
  2426. // CHECK:STDOUT: }
  2427. // CHECK:STDOUT:
  2428. // CHECK:STDOUT: fn @foo();
  2429. // CHECK:STDOUT:
  2430. // CHECK:STDOUT: --- import_signed_short_int_param_function_decl.carbon
  2431. // CHECK:STDOUT:
  2432. // CHECK:STDOUT: constants {
  2433. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2434. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2435. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2436. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2437. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2438. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2439. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2440. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2441. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2442. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2443. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2444. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2445. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  2446. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  2447. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2448. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2449. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2450. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  2451. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  2452. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  2453. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  2454. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  2455. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  2456. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  2457. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2458. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  2459. // CHECK:STDOUT: }
  2460. // CHECK:STDOUT:
  2461. // CHECK:STDOUT: imports {
  2462. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2463. // CHECK:STDOUT: .Int = %Core.Int
  2464. // CHECK:STDOUT: .As = %Core.As
  2465. // CHECK:STDOUT: import Core//prelude
  2466. // CHECK:STDOUT: import Core//prelude/...
  2467. // CHECK:STDOUT: }
  2468. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2469. // CHECK:STDOUT: .foo = @F.%foo.decl
  2470. // CHECK:STDOUT: import Cpp//...
  2471. // CHECK:STDOUT: }
  2472. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2473. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  2474. // 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)]
  2475. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  2476. // CHECK:STDOUT: }
  2477. // CHECK:STDOUT:
  2478. // CHECK:STDOUT: file {
  2479. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2480. // CHECK:STDOUT: .Core = imports.%Core
  2481. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2482. // CHECK:STDOUT: .F = %F.decl
  2483. // CHECK:STDOUT: }
  2484. // CHECK:STDOUT: %Core.import = import Core
  2485. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2486. // CHECK:STDOUT: import Cpp "signed_short_int_param_function_decl.h"
  2487. // CHECK:STDOUT: }
  2488. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2489. // CHECK:STDOUT: }
  2490. // CHECK:STDOUT:
  2491. // CHECK:STDOUT: fn @F() {
  2492. // CHECK:STDOUT: !entry:
  2493. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2494. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2495. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2496. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2497. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2498. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2499. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2500. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2501. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  2502. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2503. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2504. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2505. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  2506. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  2507. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  2508. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  2509. // CHECK:STDOUT: return
  2510. // CHECK:STDOUT: }
  2511. // CHECK:STDOUT:
  2512. // CHECK:STDOUT: fn @foo();
  2513. // CHECK:STDOUT:
  2514. // CHECK:STDOUT: --- import_int16_t_param_function_decl.carbon
  2515. // CHECK:STDOUT:
  2516. // CHECK:STDOUT: constants {
  2517. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2518. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2519. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2520. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2521. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2522. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2523. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2524. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2525. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2526. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2527. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2528. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2529. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  2530. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  2531. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2532. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2533. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2534. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  2535. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  2536. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  2537. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  2538. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  2539. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  2540. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  2541. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2542. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  2543. // CHECK:STDOUT: }
  2544. // CHECK:STDOUT:
  2545. // CHECK:STDOUT: imports {
  2546. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2547. // CHECK:STDOUT: .Int = %Core.Int
  2548. // CHECK:STDOUT: .As = %Core.As
  2549. // CHECK:STDOUT: import Core//prelude
  2550. // CHECK:STDOUT: import Core//prelude/...
  2551. // CHECK:STDOUT: }
  2552. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2553. // CHECK:STDOUT: .foo = @F.%foo.decl
  2554. // CHECK:STDOUT: import Cpp//...
  2555. // CHECK:STDOUT: }
  2556. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2557. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  2558. // 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)]
  2559. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  2560. // CHECK:STDOUT: }
  2561. // CHECK:STDOUT:
  2562. // CHECK:STDOUT: file {
  2563. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2564. // CHECK:STDOUT: .Core = imports.%Core
  2565. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2566. // CHECK:STDOUT: .F = %F.decl
  2567. // CHECK:STDOUT: }
  2568. // CHECK:STDOUT: %Core.import = import Core
  2569. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2570. // CHECK:STDOUT: import Cpp "int16_t_param_function_decl.h"
  2571. // CHECK:STDOUT: }
  2572. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2573. // CHECK:STDOUT: }
  2574. // CHECK:STDOUT:
  2575. // CHECK:STDOUT: fn @F() {
  2576. // CHECK:STDOUT: !entry:
  2577. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2578. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2579. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2580. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2581. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2582. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  2583. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2584. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2585. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  2586. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  2587. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2588. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  2589. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  2590. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  2591. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  2592. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  2593. // CHECK:STDOUT: return
  2594. // CHECK:STDOUT: }
  2595. // CHECK:STDOUT:
  2596. // CHECK:STDOUT: fn @foo();
  2597. // CHECK:STDOUT:
  2598. // CHECK:STDOUT: --- import_short_max_param_function_decl.carbon
  2599. // CHECK:STDOUT:
  2600. // CHECK:STDOUT: constants {
  2601. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2602. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2603. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2604. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2605. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2606. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2607. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2608. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2609. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2610. // CHECK:STDOUT: %int_32767.f4b: Core.IntLiteral = int_value 32767 [concrete]
  2611. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2612. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2613. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  2614. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  2615. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2616. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2617. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2618. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  2619. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  2620. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  2621. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  2622. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  2623. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_32767.f4b, %Convert.d0a [concrete]
  2624. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  2625. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_32767.f4b, %Convert.specific_fn [concrete]
  2626. // CHECK:STDOUT: %int_32767.faa: %i16 = int_value 32767 [concrete]
  2627. // CHECK:STDOUT: }
  2628. // CHECK:STDOUT:
  2629. // CHECK:STDOUT: imports {
  2630. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2631. // CHECK:STDOUT: .Int = %Core.Int
  2632. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2633. // CHECK:STDOUT: import Core//prelude
  2634. // CHECK:STDOUT: import Core//prelude/...
  2635. // CHECK:STDOUT: }
  2636. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2637. // CHECK:STDOUT: .foo = @F.%foo.decl
  2638. // CHECK:STDOUT: import Cpp//...
  2639. // CHECK:STDOUT: }
  2640. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2641. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2642. // 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)]
  2643. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2644. // CHECK:STDOUT: }
  2645. // CHECK:STDOUT:
  2646. // CHECK:STDOUT: file {
  2647. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2648. // CHECK:STDOUT: .Core = imports.%Core
  2649. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2650. // CHECK:STDOUT: .F = %F.decl
  2651. // CHECK:STDOUT: }
  2652. // CHECK:STDOUT: %Core.import = import Core
  2653. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2654. // CHECK:STDOUT: import Cpp "short_max_param_function_decl.h"
  2655. // CHECK:STDOUT: }
  2656. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2657. // CHECK:STDOUT: }
  2658. // CHECK:STDOUT:
  2659. // CHECK:STDOUT: fn @F() {
  2660. // CHECK:STDOUT: !entry:
  2661. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2662. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2663. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2664. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2665. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2666. // CHECK:STDOUT: %int_32767: Core.IntLiteral = int_value 32767 [concrete = constants.%int_32767.f4b]
  2667. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  2668. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_32767, %impl.elem0 [concrete = constants.%Convert.bound]
  2669. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2670. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int_32767, %specific_fn [concrete = constants.%bound_method]
  2671. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.2(%int_32767) [concrete = constants.%int_32767.faa]
  2672. // CHECK:STDOUT: %.loc7_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32767.faa]
  2673. // CHECK:STDOUT: %.loc7_11.2: %i16 = converted %int_32767, %.loc7_11.1 [concrete = constants.%int_32767.faa]
  2674. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.2)
  2675. // CHECK:STDOUT: return
  2676. // CHECK:STDOUT: }
  2677. // CHECK:STDOUT:
  2678. // CHECK:STDOUT: fn @foo();
  2679. // CHECK:STDOUT:
  2680. // CHECK:STDOUT: --- fail_overflow_short_max_param_function_decl.carbon
  2681. // CHECK:STDOUT:
  2682. // CHECK:STDOUT: constants {
  2683. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2684. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2685. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2686. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2687. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2688. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2689. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2690. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2691. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2692. // CHECK:STDOUT: %int_32768.4d0: Core.IntLiteral = int_value 32768 [concrete]
  2693. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2694. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2695. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  2696. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  2697. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2698. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2699. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2700. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  2701. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  2702. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  2703. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  2704. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  2705. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_32768.4d0, %Convert.d0a [concrete]
  2706. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  2707. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_32768.4d0, %Convert.specific_fn [concrete]
  2708. // CHECK:STDOUT: %int_32768.e7f: %i16 = int_value 32768 [concrete]
  2709. // CHECK:STDOUT: }
  2710. // CHECK:STDOUT:
  2711. // CHECK:STDOUT: imports {
  2712. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2713. // CHECK:STDOUT: .Int = %Core.Int
  2714. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2715. // CHECK:STDOUT: import Core//prelude
  2716. // CHECK:STDOUT: import Core//prelude/...
  2717. // CHECK:STDOUT: }
  2718. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2719. // CHECK:STDOUT: .foo = @F.%foo.decl
  2720. // CHECK:STDOUT: import Cpp//...
  2721. // CHECK:STDOUT: }
  2722. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2723. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2724. // 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)]
  2725. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2726. // CHECK:STDOUT: }
  2727. // CHECK:STDOUT:
  2728. // CHECK:STDOUT: file {
  2729. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2730. // CHECK:STDOUT: .Core = imports.%Core
  2731. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2732. // CHECK:STDOUT: .F = %F.decl
  2733. // CHECK:STDOUT: }
  2734. // CHECK:STDOUT: %Core.import = import Core
  2735. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2736. // CHECK:STDOUT: import Cpp "overflow_short_max_param_function_decl.h"
  2737. // CHECK:STDOUT: }
  2738. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2739. // CHECK:STDOUT: }
  2740. // CHECK:STDOUT:
  2741. // CHECK:STDOUT: fn @F() {
  2742. // CHECK:STDOUT: !entry:
  2743. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2744. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2745. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2746. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2747. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2748. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768.4d0]
  2749. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  2750. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_32768, %impl.elem0 [concrete = constants.%Convert.bound]
  2751. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2752. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int_32768, %specific_fn [concrete = constants.%bound_method]
  2753. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.2(%int_32768) [concrete = constants.%int_32768.e7f]
  2754. // CHECK:STDOUT: %.loc12_11.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_32768.e7f]
  2755. // CHECK:STDOUT: %.loc12_11.2: %i16 = converted %int_32768, %.loc12_11.1 [concrete = constants.%int_32768.e7f]
  2756. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.2)
  2757. // CHECK:STDOUT: return
  2758. // CHECK:STDOUT: }
  2759. // CHECK:STDOUT:
  2760. // CHECK:STDOUT: fn @foo();
  2761. // CHECK:STDOUT:
  2762. // CHECK:STDOUT: --- import_short_min_param_function_decl.carbon
  2763. // CHECK:STDOUT:
  2764. // CHECK:STDOUT: constants {
  2765. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2766. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2767. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2768. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2769. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2770. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2771. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2772. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2773. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2774. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete]
  2775. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  2776. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  2777. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  2778. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  2779. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  2780. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  2781. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  2782. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_32768, %Op.bba [concrete]
  2783. // CHECK:STDOUT: %int_-32768.882: Core.IntLiteral = int_value -32768 [concrete]
  2784. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2785. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2786. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  2787. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  2788. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2789. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2790. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2791. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  2792. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  2793. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  2794. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  2795. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  2796. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-32768.882, %Convert.d0a [concrete]
  2797. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  2798. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-32768.882, %Convert.specific_fn [concrete]
  2799. // CHECK:STDOUT: %int_-32768.7e5: %i16 = int_value -32768 [concrete]
  2800. // CHECK:STDOUT: }
  2801. // CHECK:STDOUT:
  2802. // CHECK:STDOUT: imports {
  2803. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2804. // CHECK:STDOUT: .Int = %Core.Int
  2805. // CHECK:STDOUT: .Negate = %Core.Negate
  2806. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2807. // CHECK:STDOUT: import Core//prelude
  2808. // CHECK:STDOUT: import Core//prelude/...
  2809. // CHECK:STDOUT: }
  2810. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2811. // CHECK:STDOUT: .foo = @F.%foo.decl
  2812. // CHECK:STDOUT: import Cpp//...
  2813. // CHECK:STDOUT: }
  2814. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2815. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  2816. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  2817. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  2818. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2819. // 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)]
  2820. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2821. // CHECK:STDOUT: }
  2822. // CHECK:STDOUT:
  2823. // CHECK:STDOUT: file {
  2824. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2825. // CHECK:STDOUT: .Core = imports.%Core
  2826. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2827. // CHECK:STDOUT: .F = %F.decl
  2828. // CHECK:STDOUT: }
  2829. // CHECK:STDOUT: %Core.import = import Core
  2830. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2831. // CHECK:STDOUT: import Cpp "short_min_param_function_decl.h"
  2832. // CHECK:STDOUT: }
  2833. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2834. // CHECK:STDOUT: }
  2835. // CHECK:STDOUT:
  2836. // CHECK:STDOUT: fn @F() {
  2837. // CHECK:STDOUT: !entry:
  2838. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2839. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2840. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2841. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2842. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2843. // CHECK:STDOUT: %int_32768: Core.IntLiteral = int_value 32768 [concrete = constants.%int_32768]
  2844. // CHECK:STDOUT: %impl.elem0.loc7_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  2845. // CHECK:STDOUT: %bound_method.loc7_11.1: <bound method> = bound_method %int_32768, %impl.elem0.loc7_11.1 [concrete = constants.%Op.bound]
  2846. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc7_11.1(%int_32768) [concrete = constants.%int_-32768.882]
  2847. // CHECK:STDOUT: %impl.elem0.loc7_11.2: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  2848. // CHECK:STDOUT: %bound_method.loc7_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc7_11.2 [concrete = constants.%Convert.bound]
  2849. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc7_11.2, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2850. // CHECK:STDOUT: %bound_method.loc7_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  2851. // CHECK:STDOUT: %.loc7_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32768.882]
  2852. // CHECK:STDOUT: %.loc7_11.2: Core.IntLiteral = converted %int.snegate, %.loc7_11.1 [concrete = constants.%int_-32768.882]
  2853. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_11.3(%.loc7_11.2) [concrete = constants.%int_-32768.7e5]
  2854. // CHECK:STDOUT: %.loc7_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32768.7e5]
  2855. // CHECK:STDOUT: %.loc7_11.4: %i16 = converted %int.snegate, %.loc7_11.3 [concrete = constants.%int_-32768.7e5]
  2856. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_11.4)
  2857. // CHECK:STDOUT: return
  2858. // CHECK:STDOUT: }
  2859. // CHECK:STDOUT:
  2860. // CHECK:STDOUT: fn @foo();
  2861. // CHECK:STDOUT:
  2862. // CHECK:STDOUT: --- fail_overflow_short_min_param_function_decl.carbon
  2863. // CHECK:STDOUT:
  2864. // CHECK:STDOUT: constants {
  2865. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2866. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2867. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2868. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2869. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2870. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2871. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2872. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2873. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2874. // CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete]
  2875. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  2876. // CHECK:STDOUT: %Op.type.e42: type = fn_type @Op.1 [concrete]
  2877. // CHECK:STDOUT: %Negate.impl_witness.561: <witness> = impl_witness imports.%Negate.impl_witness_table.e09 [concrete]
  2878. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness.561) [concrete]
  2879. // CHECK:STDOUT: %.63a: type = fn_type_with_self_type %Op.type.e42, %Negate.facet [concrete]
  2880. // CHECK:STDOUT: %Op.type.1be: type = fn_type @Op.2 [concrete]
  2881. // CHECK:STDOUT: %Op.bba: %Op.type.1be = struct_value () [concrete]
  2882. // CHECK:STDOUT: %Op.bound: <bound method> = bound_method %int_32769, %Op.bba [concrete]
  2883. // CHECK:STDOUT: %int_-32769.5a5: Core.IntLiteral = int_value -32769 [concrete]
  2884. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2885. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2886. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  2887. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  2888. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2889. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  2890. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  2891. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  2892. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  2893. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  2894. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  2895. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  2896. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_-32769.5a5, %Convert.d0a [concrete]
  2897. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  2898. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-32769.5a5, %Convert.specific_fn [concrete]
  2899. // CHECK:STDOUT: %int_-32769.883: %i16 = int_value -32769 [concrete]
  2900. // CHECK:STDOUT: }
  2901. // CHECK:STDOUT:
  2902. // CHECK:STDOUT: imports {
  2903. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2904. // CHECK:STDOUT: .Int = %Core.Int
  2905. // CHECK:STDOUT: .Negate = %Core.Negate
  2906. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2907. // CHECK:STDOUT: import Core//prelude
  2908. // CHECK:STDOUT: import Core//prelude/...
  2909. // CHECK:STDOUT: }
  2910. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2911. // CHECK:STDOUT: .foo = @F.%foo.decl
  2912. // CHECK:STDOUT: import Cpp//...
  2913. // CHECK:STDOUT: }
  2914. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  2915. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/operators/arithmetic, Negate, loaded [concrete = constants.%Negate.type]
  2916. // CHECK:STDOUT: %Core.import_ref.c15: %Op.type.1be = import_ref Core//prelude/operators/arithmetic, loc94_31, loaded [concrete = constants.%Op.bba]
  2917. // CHECK:STDOUT: %Negate.impl_witness_table.e09 = impl_witness_table (%Core.import_ref.c15), @impl.8cb [concrete]
  2918. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2919. // 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)]
  2920. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  2921. // CHECK:STDOUT: }
  2922. // CHECK:STDOUT:
  2923. // CHECK:STDOUT: file {
  2924. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2925. // CHECK:STDOUT: .Core = imports.%Core
  2926. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2927. // CHECK:STDOUT: .F = %F.decl
  2928. // CHECK:STDOUT: }
  2929. // CHECK:STDOUT: %Core.import = import Core
  2930. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2931. // CHECK:STDOUT: import Cpp "overflow_short_min_param_function_decl.h"
  2932. // CHECK:STDOUT: }
  2933. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2934. // CHECK:STDOUT: }
  2935. // CHECK:STDOUT:
  2936. // CHECK:STDOUT: fn @F() {
  2937. // CHECK:STDOUT: !entry:
  2938. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2939. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  2940. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  2941. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  2942. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  2943. // CHECK:STDOUT: %int_32769: Core.IntLiteral = int_value 32769 [concrete = constants.%int_32769]
  2944. // CHECK:STDOUT: %impl.elem0.loc12_11.1: %.63a = impl_witness_access constants.%Negate.impl_witness.561, element0 [concrete = constants.%Op.bba]
  2945. // CHECK:STDOUT: %bound_method.loc12_11.1: <bound method> = bound_method %int_32769, %impl.elem0.loc12_11.1 [concrete = constants.%Op.bound]
  2946. // CHECK:STDOUT: %int.snegate: init Core.IntLiteral = call %bound_method.loc12_11.1(%int_32769) [concrete = constants.%int_-32769.5a5]
  2947. // CHECK:STDOUT: %impl.elem0.loc12_11.2: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  2948. // CHECK:STDOUT: %bound_method.loc12_11.2: <bound method> = bound_method %int.snegate, %impl.elem0.loc12_11.2 [concrete = constants.%Convert.bound]
  2949. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0.loc12_11.2, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  2950. // CHECK:STDOUT: %bound_method.loc12_11.3: <bound method> = bound_method %int.snegate, %specific_fn [concrete = constants.%bound_method]
  2951. // CHECK:STDOUT: %.loc12_11.1: Core.IntLiteral = value_of_initializer %int.snegate [concrete = constants.%int_-32769.5a5]
  2952. // CHECK:STDOUT: %.loc12_11.2: Core.IntLiteral = converted %int.snegate, %.loc12_11.1 [concrete = constants.%int_-32769.5a5]
  2953. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc12_11.3(%.loc12_11.2) [concrete = constants.%int_-32769.883]
  2954. // CHECK:STDOUT: %.loc12_11.3: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_-32769.883]
  2955. // CHECK:STDOUT: %.loc12_11.4: %i16 = converted %int.snegate, %.loc12_11.3 [concrete = constants.%int_-32769.883]
  2956. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc12_11.4)
  2957. // CHECK:STDOUT: return
  2958. // CHECK:STDOUT: }
  2959. // CHECK:STDOUT:
  2960. // CHECK:STDOUT: fn @foo();
  2961. // CHECK:STDOUT:
  2962. // CHECK:STDOUT: --- fail_int32_arg_short_param_function_decl.carbon
  2963. // CHECK:STDOUT:
  2964. // CHECK:STDOUT: constants {
  2965. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2966. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2967. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2968. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  2969. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2970. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2971. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  2972. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  2973. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  2974. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  2975. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2976. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2977. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  2978. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  2979. // CHECK:STDOUT: %As.type.fd4: type = facet_type <@As, @As(%i32)> [concrete]
  2980. // CHECK:STDOUT: %Convert.type.99b: type = fn_type @Convert.1, @As(%i32) [concrete]
  2981. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  2982. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2983. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2984. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  2985. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  2986. // CHECK:STDOUT: %As.impl_witness.6b4: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_32) [concrete]
  2987. // CHECK:STDOUT: %Convert.type.4fd: type = fn_type @Convert.5, @impl.686(%int_32) [concrete]
  2988. // CHECK:STDOUT: %Convert.197: %Convert.type.4fd = struct_value () [concrete]
  2989. // CHECK:STDOUT: %As.facet: %As.type.fd4 = facet_value Core.IntLiteral, (%As.impl_witness.6b4) [concrete]
  2990. // CHECK:STDOUT: %.982: type = fn_type_with_self_type %Convert.type.99b, %As.facet [concrete]
  2991. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.197 [concrete]
  2992. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.197, @Convert.5(%int_32) [concrete]
  2993. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  2994. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  2995. // CHECK:STDOUT: }
  2996. // CHECK:STDOUT:
  2997. // CHECK:STDOUT: imports {
  2998. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2999. // CHECK:STDOUT: .Int = %Core.Int
  3000. // CHECK:STDOUT: .As = %Core.As
  3001. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3002. // CHECK:STDOUT: import Core//prelude
  3003. // CHECK:STDOUT: import Core//prelude/...
  3004. // CHECK:STDOUT: }
  3005. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3006. // CHECK:STDOUT: .foo = @F.%foo.decl
  3007. // CHECK:STDOUT: import Cpp//...
  3008. // CHECK:STDOUT: }
  3009. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3010. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  3011. // 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)]
  3012. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  3013. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3014. // CHECK:STDOUT: }
  3015. // CHECK:STDOUT:
  3016. // CHECK:STDOUT: file {
  3017. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3018. // CHECK:STDOUT: .Core = imports.%Core
  3019. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3020. // CHECK:STDOUT: .F = %F.decl
  3021. // CHECK:STDOUT: }
  3022. // CHECK:STDOUT: %Core.import = import Core
  3023. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3024. // CHECK:STDOUT: import Cpp "int32_arg_short_param_function_decl.h"
  3025. // CHECK:STDOUT: }
  3026. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3027. // CHECK:STDOUT: }
  3028. // CHECK:STDOUT:
  3029. // CHECK:STDOUT: fn @F() {
  3030. // CHECK:STDOUT: !entry:
  3031. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3032. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3033. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3034. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  3035. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  3036. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3037. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3038. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3039. // CHECK:STDOUT: %impl.elem0: %.982 = impl_witness_access constants.%As.impl_witness.6b4, element0 [concrete = constants.%Convert.197]
  3040. // CHECK:STDOUT: %bound_method.loc15_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3041. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_32) [concrete = constants.%Convert.specific_fn]
  3042. // CHECK:STDOUT: %bound_method.loc15_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3043. // CHECK:STDOUT: %int.convert_checked: init %i32 = call %bound_method.loc15_13.2(%int_1) [concrete = constants.%int_1.5d2]
  3044. // CHECK:STDOUT: %.loc15_13.1: %i32 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.5d2]
  3045. // CHECK:STDOUT: %.loc15_13.2: %i32 = converted %int_1, %.loc15_13.1 [concrete = constants.%int_1.5d2]
  3046. // CHECK:STDOUT: %.loc15_13.3: %i16 = converted %.loc15_13.2, <error> [concrete = <error>]
  3047. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(<error>)
  3048. // CHECK:STDOUT: return
  3049. // CHECK:STDOUT: }
  3050. // CHECK:STDOUT:
  3051. // CHECK:STDOUT: fn @foo();
  3052. // CHECK:STDOUT:
  3053. // CHECK:STDOUT: --- import_short_const_param_function_decl.carbon
  3054. // CHECK:STDOUT:
  3055. // CHECK:STDOUT: constants {
  3056. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3057. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  3058. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3059. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3060. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3061. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3062. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3063. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  3064. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  3065. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3066. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3067. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3068. // CHECK:STDOUT: %As.type.a96: type = facet_type <@As, @As(%i16)> [concrete]
  3069. // CHECK:STDOUT: %Convert.type.be5: type = fn_type @Convert.1, @As(%i16) [concrete]
  3070. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  3071. // CHECK:STDOUT: %Convert.type.062: type = fn_type @Convert.5, @impl.686(%To.c80) [symbolic]
  3072. // CHECK:STDOUT: %Convert.527: %Convert.type.062 = struct_value () [symbolic]
  3073. // CHECK:STDOUT: %As.impl_witness.0ef: <witness> = impl_witness imports.%As.impl_witness_table.eb4, @impl.686(%int_16) [concrete]
  3074. // CHECK:STDOUT: %Convert.type.172: type = fn_type @Convert.5, @impl.686(%int_16) [concrete]
  3075. // CHECK:STDOUT: %Convert.489: %Convert.type.172 = struct_value () [concrete]
  3076. // CHECK:STDOUT: %As.facet: %As.type.a96 = facet_value Core.IntLiteral, (%As.impl_witness.0ef) [concrete]
  3077. // CHECK:STDOUT: %.91d: type = fn_type_with_self_type %Convert.type.be5, %As.facet [concrete]
  3078. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.489 [concrete]
  3079. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.489, @Convert.5(%int_16) [concrete]
  3080. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  3081. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3082. // CHECK:STDOUT: }
  3083. // CHECK:STDOUT:
  3084. // CHECK:STDOUT: imports {
  3085. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3086. // CHECK:STDOUT: .Int = %Core.Int
  3087. // CHECK:STDOUT: .As = %Core.As
  3088. // CHECK:STDOUT: import Core//prelude
  3089. // CHECK:STDOUT: import Core//prelude/...
  3090. // CHECK:STDOUT: }
  3091. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3092. // CHECK:STDOUT: .foo = @F.%foo.decl
  3093. // CHECK:STDOUT: import Cpp//...
  3094. // CHECK:STDOUT: }
  3095. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3096. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/operators/as, As, loaded [concrete = constants.%As.generic]
  3097. // 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)]
  3098. // CHECK:STDOUT: %As.impl_witness_table.eb4 = impl_witness_table (%Core.import_ref.78a), @impl.686 [concrete]
  3099. // CHECK:STDOUT: }
  3100. // CHECK:STDOUT:
  3101. // CHECK:STDOUT: file {
  3102. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3103. // CHECK:STDOUT: .Core = imports.%Core
  3104. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3105. // CHECK:STDOUT: .F = %F.decl
  3106. // CHECK:STDOUT: }
  3107. // CHECK:STDOUT: %Core.import = import Core
  3108. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3109. // CHECK:STDOUT: import Cpp "short_const_param_function_decl.h"
  3110. // CHECK:STDOUT: }
  3111. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3112. // CHECK:STDOUT: }
  3113. // CHECK:STDOUT:
  3114. // CHECK:STDOUT: fn @F() {
  3115. // CHECK:STDOUT: !entry:
  3116. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3117. // CHECK:STDOUT: %int_16.1: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3118. // CHECK:STDOUT: %i16.1: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3119. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  3120. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  3121. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3122. // CHECK:STDOUT: %int_16.loc7: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3123. // CHECK:STDOUT: %i16.loc7: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3124. // CHECK:STDOUT: %impl.elem0: %.91d = impl_witness_access constants.%As.impl_witness.0ef, element0 [concrete = constants.%Convert.489]
  3125. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3126. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.5(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  3127. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3128. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  3129. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %int.convert_checked [concrete = constants.%int_1.f90]
  3130. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  3131. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref(%.loc7_13.2)
  3132. // CHECK:STDOUT: return
  3133. // CHECK:STDOUT: }
  3134. // CHECK:STDOUT:
  3135. // CHECK:STDOUT: fn @foo();
  3136. // CHECK:STDOUT:
  3137. // CHECK:STDOUT: --- fail_todo_short_ref_param_function_decl.carbon
  3138. // CHECK:STDOUT:
  3139. // CHECK:STDOUT: constants {
  3140. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3141. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3142. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3143. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3144. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3145. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3146. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  3147. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3148. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3149. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3150. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  3151. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  3152. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  3153. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  3154. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  3155. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  3156. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  3157. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  3158. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  3159. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  3160. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  3161. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  3162. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  3163. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3164. // CHECK:STDOUT: }
  3165. // CHECK:STDOUT:
  3166. // CHECK:STDOUT: imports {
  3167. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3168. // CHECK:STDOUT: .Int = %Core.Int
  3169. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3170. // CHECK:STDOUT: import Core//prelude
  3171. // CHECK:STDOUT: import Core//prelude/...
  3172. // CHECK:STDOUT: }
  3173. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3174. // CHECK:STDOUT: .foo = <error>
  3175. // CHECK:STDOUT: import Cpp//...
  3176. // CHECK:STDOUT: }
  3177. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3178. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3179. // 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)]
  3180. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  3181. // CHECK:STDOUT: }
  3182. // CHECK:STDOUT:
  3183. // CHECK:STDOUT: file {
  3184. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3185. // CHECK:STDOUT: .Core = imports.%Core
  3186. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3187. // CHECK:STDOUT: .F = %F.decl
  3188. // CHECK:STDOUT: }
  3189. // CHECK:STDOUT: %Core.import = import Core
  3190. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3191. // CHECK:STDOUT: import Cpp "short_ref_param_function_decl.h"
  3192. // CHECK:STDOUT: }
  3193. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3194. // CHECK:STDOUT: }
  3195. // CHECK:STDOUT:
  3196. // CHECK:STDOUT: fn @F() {
  3197. // CHECK:STDOUT: !entry:
  3198. // CHECK:STDOUT: name_binding_decl {
  3199. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  3200. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  3201. // CHECK:STDOUT: }
  3202. // CHECK:STDOUT: %a.var: ref %i16 = var a
  3203. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3204. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  3205. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3206. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  3207. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3208. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  3209. // CHECK:STDOUT: %.loc7_3.2: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  3210. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  3211. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  3212. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3213. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3214. // CHECK:STDOUT: }
  3215. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  3216. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3217. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3218. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  3219. // CHECK:STDOUT: return
  3220. // CHECK:STDOUT: }
  3221. // CHECK:STDOUT:
  3222. // CHECK:STDOUT: --- fail_todo_short_const_ref_param_function_decl.carbon
  3223. // CHECK:STDOUT:
  3224. // CHECK:STDOUT: constants {
  3225. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3226. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3227. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3228. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3229. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3230. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3231. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  3232. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3233. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3234. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3235. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  3236. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  3237. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  3238. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  3239. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  3240. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  3241. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  3242. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  3243. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  3244. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  3245. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  3246. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  3247. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  3248. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3249. // CHECK:STDOUT: }
  3250. // CHECK:STDOUT:
  3251. // CHECK:STDOUT: imports {
  3252. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3253. // CHECK:STDOUT: .Int = %Core.Int
  3254. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3255. // CHECK:STDOUT: import Core//prelude
  3256. // CHECK:STDOUT: import Core//prelude/...
  3257. // CHECK:STDOUT: }
  3258. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3259. // CHECK:STDOUT: .foo = <error>
  3260. // CHECK:STDOUT: import Cpp//...
  3261. // CHECK:STDOUT: }
  3262. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3263. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3264. // 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)]
  3265. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  3266. // CHECK:STDOUT: }
  3267. // CHECK:STDOUT:
  3268. // CHECK:STDOUT: file {
  3269. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3270. // CHECK:STDOUT: .Core = imports.%Core
  3271. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3272. // CHECK:STDOUT: .F = %F.decl
  3273. // CHECK:STDOUT: }
  3274. // CHECK:STDOUT: %Core.import = import Core
  3275. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3276. // CHECK:STDOUT: import Cpp "short_const_ref_param_function_decl.h"
  3277. // CHECK:STDOUT: }
  3278. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3279. // CHECK:STDOUT: }
  3280. // CHECK:STDOUT:
  3281. // CHECK:STDOUT: fn @F() {
  3282. // CHECK:STDOUT: !entry:
  3283. // CHECK:STDOUT: name_binding_decl {
  3284. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  3285. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  3286. // CHECK:STDOUT: }
  3287. // CHECK:STDOUT: %a.var: ref %i16 = var a
  3288. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3289. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  3290. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3291. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  3292. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3293. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  3294. // CHECK:STDOUT: %.loc7_3.2: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  3295. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  3296. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  3297. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3298. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3299. // CHECK:STDOUT: }
  3300. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  3301. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3302. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3303. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  3304. // CHECK:STDOUT: return
  3305. // CHECK:STDOUT: }
  3306. // CHECK:STDOUT:
  3307. // CHECK:STDOUT: --- fail_todo_short_pointer_param_function_decl.carbon
  3308. // CHECK:STDOUT:
  3309. // CHECK:STDOUT: constants {
  3310. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3311. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3312. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3313. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3314. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3315. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3316. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  3317. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3318. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3319. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3320. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  3321. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  3322. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  3323. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  3324. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  3325. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  3326. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  3327. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  3328. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  3329. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  3330. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  3331. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  3332. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  3333. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3334. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  3335. // CHECK:STDOUT: }
  3336. // CHECK:STDOUT:
  3337. // CHECK:STDOUT: imports {
  3338. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3339. // CHECK:STDOUT: .Int = %Core.Int
  3340. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3341. // CHECK:STDOUT: import Core//prelude
  3342. // CHECK:STDOUT: import Core//prelude/...
  3343. // CHECK:STDOUT: }
  3344. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3345. // CHECK:STDOUT: .foo = <error>
  3346. // CHECK:STDOUT: import Cpp//...
  3347. // CHECK:STDOUT: }
  3348. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3349. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3350. // 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)]
  3351. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  3352. // CHECK:STDOUT: }
  3353. // CHECK:STDOUT:
  3354. // CHECK:STDOUT: file {
  3355. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3356. // CHECK:STDOUT: .Core = imports.%Core
  3357. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3358. // CHECK:STDOUT: .F = %F.decl
  3359. // CHECK:STDOUT: }
  3360. // CHECK:STDOUT: %Core.import = import Core
  3361. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3362. // CHECK:STDOUT: import Cpp "short_pointer_param_function_decl.h"
  3363. // CHECK:STDOUT: }
  3364. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3365. // CHECK:STDOUT: }
  3366. // CHECK:STDOUT:
  3367. // CHECK:STDOUT: fn @F() {
  3368. // CHECK:STDOUT: !entry:
  3369. // CHECK:STDOUT: name_binding_decl {
  3370. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  3371. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  3372. // CHECK:STDOUT: }
  3373. // CHECK:STDOUT: %a.var: ref %i16 = var a
  3374. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3375. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  3376. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3377. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  3378. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3379. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  3380. // CHECK:STDOUT: %.loc7_3.2: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  3381. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  3382. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  3383. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3384. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3385. // CHECK:STDOUT: }
  3386. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  3387. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3388. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3389. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  3390. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref
  3391. // CHECK:STDOUT: return
  3392. // CHECK:STDOUT: }
  3393. // CHECK:STDOUT:
  3394. // CHECK:STDOUT: --- fail_todo_short_const_pointer_param_function_decl.carbon
  3395. // CHECK:STDOUT:
  3396. // CHECK:STDOUT: constants {
  3397. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3398. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3399. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3400. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3401. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3402. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3403. // CHECK:STDOUT: %pattern_type.2f8: type = pattern_type %i16 [concrete]
  3404. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3405. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3406. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3407. // CHECK:STDOUT: %ImplicitAs.type.adb: type = facet_type <@ImplicitAs, @ImplicitAs(%i16)> [concrete]
  3408. // CHECK:STDOUT: %Convert.type.fa6: type = fn_type @Convert.1, @ImplicitAs(%i16) [concrete]
  3409. // CHECK:STDOUT: %To.c80: Core.IntLiteral = bind_symbolic_name To, 0 [symbolic]
  3410. // CHECK:STDOUT: %Convert.type.0f9: type = fn_type @Convert.2, @impl.4f9(%To.c80) [symbolic]
  3411. // CHECK:STDOUT: %Convert.f06: %Convert.type.0f9 = struct_value () [symbolic]
  3412. // CHECK:STDOUT: %ImplicitAs.impl_witness.97b: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.a2f, @impl.4f9(%int_16) [concrete]
  3413. // CHECK:STDOUT: %Convert.type.33c: type = fn_type @Convert.2, @impl.4f9(%int_16) [concrete]
  3414. // CHECK:STDOUT: %Convert.d0a: %Convert.type.33c = struct_value () [concrete]
  3415. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.adb = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.97b) [concrete]
  3416. // CHECK:STDOUT: %.236: type = fn_type_with_self_type %Convert.type.fa6, %ImplicitAs.facet [concrete]
  3417. // CHECK:STDOUT: %Convert.bound: <bound method> = bound_method %int_1.5b8, %Convert.d0a [concrete]
  3418. // CHECK:STDOUT: %Convert.specific_fn: <specific function> = specific_function %Convert.d0a, @Convert.2(%int_16) [concrete]
  3419. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Convert.specific_fn [concrete]
  3420. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3421. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  3422. // CHECK:STDOUT: }
  3423. // CHECK:STDOUT:
  3424. // CHECK:STDOUT: imports {
  3425. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3426. // CHECK:STDOUT: .Int = %Core.Int
  3427. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3428. // CHECK:STDOUT: import Core//prelude
  3429. // CHECK:STDOUT: import Core//prelude/...
  3430. // CHECK:STDOUT: }
  3431. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3432. // CHECK:STDOUT: .foo = <error>
  3433. // CHECK:STDOUT: import Cpp//...
  3434. // CHECK:STDOUT: }
  3435. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3436. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/operators/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3437. // 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)]
  3438. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.a2f = impl_witness_table (%Core.import_ref.a5b), @impl.4f9 [concrete]
  3439. // CHECK:STDOUT: }
  3440. // CHECK:STDOUT:
  3441. // CHECK:STDOUT: file {
  3442. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3443. // CHECK:STDOUT: .Core = imports.%Core
  3444. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3445. // CHECK:STDOUT: .F = %F.decl
  3446. // CHECK:STDOUT: }
  3447. // CHECK:STDOUT: %Core.import = import Core
  3448. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3449. // CHECK:STDOUT: import Cpp "short_const_pointer_param_function_decl.h"
  3450. // CHECK:STDOUT: }
  3451. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3452. // CHECK:STDOUT: }
  3453. // CHECK:STDOUT:
  3454. // CHECK:STDOUT: fn @F() {
  3455. // CHECK:STDOUT: !entry:
  3456. // CHECK:STDOUT: name_binding_decl {
  3457. // CHECK:STDOUT: %a.patt: %pattern_type.2f8 = binding_pattern a [concrete]
  3458. // CHECK:STDOUT: %.loc7_3.1: %pattern_type.2f8 = var_pattern %a.patt [concrete]
  3459. // CHECK:STDOUT: }
  3460. // CHECK:STDOUT: %a.var: ref %i16 = var a
  3461. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3462. // CHECK:STDOUT: %impl.elem0: %.236 = impl_witness_access constants.%ImplicitAs.impl_witness.97b, element0 [concrete = constants.%Convert.d0a]
  3463. // CHECK:STDOUT: %bound_method.loc7_3.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Convert.bound]
  3464. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Convert.2(constants.%int_16) [concrete = constants.%Convert.specific_fn]
  3465. // CHECK:STDOUT: %bound_method.loc7_3.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3466. // CHECK:STDOUT: %int.convert_checked: init %i16 = call %bound_method.loc7_3.2(%int_1) [concrete = constants.%int_1.f90]
  3467. // CHECK:STDOUT: %.loc7_3.2: init %i16 = converted %int_1, %int.convert_checked [concrete = constants.%int_1.f90]
  3468. // CHECK:STDOUT: assign %a.var, %.loc7_3.2
  3469. // CHECK:STDOUT: %.loc7_10: type = splice_block %i16 [concrete = constants.%i16] {
  3470. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3471. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3472. // CHECK:STDOUT: }
  3473. // CHECK:STDOUT: %a: ref %i16 = bind_name a, %a.var
  3474. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3475. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3476. // CHECK:STDOUT: %a.ref: ref %i16 = name_ref a, %a
  3477. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %a.ref
  3478. // CHECK:STDOUT: return
  3479. // CHECK:STDOUT: }
  3480. // CHECK:STDOUT:
  3481. // CHECK:STDOUT: --- fail_todo_import_unsupported_primitive_type_param_function_decl.carbon
  3482. // CHECK:STDOUT:
  3483. // CHECK:STDOUT: constants {
  3484. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3485. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3486. // CHECK:STDOUT: %float: f64 = float_literal 1.1000000000000001 [concrete]
  3487. // CHECK:STDOUT: }
  3488. // CHECK:STDOUT:
  3489. // CHECK:STDOUT: imports {
  3490. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3491. // CHECK:STDOUT: import Core//prelude
  3492. // CHECK:STDOUT: import Core//prelude/...
  3493. // CHECK:STDOUT: }
  3494. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3495. // CHECK:STDOUT: .foo = <error>
  3496. // CHECK:STDOUT: import Cpp//...
  3497. // CHECK:STDOUT: }
  3498. // CHECK:STDOUT: }
  3499. // CHECK:STDOUT:
  3500. // CHECK:STDOUT: file {
  3501. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3502. // CHECK:STDOUT: .Core = imports.%Core
  3503. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3504. // CHECK:STDOUT: .F = %F.decl
  3505. // CHECK:STDOUT: }
  3506. // CHECK:STDOUT: %Core.import = import Core
  3507. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3508. // CHECK:STDOUT: import Cpp "unsupported_primitive_type_param_function_decl.h"
  3509. // CHECK:STDOUT: }
  3510. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3511. // CHECK:STDOUT: }
  3512. // CHECK:STDOUT:
  3513. // CHECK:STDOUT: fn @F() {
  3514. // CHECK:STDOUT: !entry:
  3515. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3516. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3517. // CHECK:STDOUT: %float: f64 = float_literal 1.1000000000000001 [concrete = constants.%float]
  3518. // CHECK:STDOUT: return
  3519. // CHECK:STDOUT: }
  3520. // CHECK:STDOUT:
  3521. // CHECK:STDOUT: --- fail_import_unsupported_type_among_params_function_decl.carbon
  3522. // CHECK:STDOUT:
  3523. // CHECK:STDOUT: constants {
  3524. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3525. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3526. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  3527. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3528. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3529. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  3530. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  3531. // CHECK:STDOUT: %float: f64 = float_literal 2 [concrete]
  3532. // CHECK:STDOUT: }
  3533. // CHECK:STDOUT:
  3534. // CHECK:STDOUT: imports {
  3535. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3536. // CHECK:STDOUT: .Int = %Core.Int
  3537. // CHECK:STDOUT: import Core//prelude
  3538. // CHECK:STDOUT: import Core//prelude/...
  3539. // CHECK:STDOUT: }
  3540. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3541. // CHECK:STDOUT: .foo = <error>
  3542. // CHECK:STDOUT: import Cpp//...
  3543. // CHECK:STDOUT: }
  3544. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/types/int, Int, loaded [concrete = constants.%Int.generic]
  3545. // CHECK:STDOUT: }
  3546. // CHECK:STDOUT:
  3547. // CHECK:STDOUT: file {
  3548. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3549. // CHECK:STDOUT: .Core = imports.%Core
  3550. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3551. // CHECK:STDOUT: .F = %F.decl
  3552. // CHECK:STDOUT: }
  3553. // CHECK:STDOUT: %Core.import = import Core
  3554. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3555. // CHECK:STDOUT: import Cpp "unsupported_type_among_params_function_decl.h"
  3556. // CHECK:STDOUT: }
  3557. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3558. // CHECK:STDOUT: }
  3559. // CHECK:STDOUT:
  3560. // CHECK:STDOUT: fn @F() {
  3561. // CHECK:STDOUT: !entry:
  3562. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3563. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3564. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3565. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  3566. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  3567. // CHECK:STDOUT: %float: f64 = float_literal 2 [concrete = constants.%float]
  3568. // CHECK:STDOUT: return
  3569. // CHECK:STDOUT: }
  3570. // CHECK:STDOUT: