overloads.carbon 294 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/primitives.carbon
  6. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  7. //
  8. // AUTOUPDATE
  9. // TIP: To test this file alone, run:
  10. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/overloads.carbon
  11. // TIP: To dump output, run:
  12. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/overloads.carbon
  13. // ============================================================================
  14. // Overloaded sets tests
  15. // ============================================================================
  16. // --- multiple_functions_no_overloads.h
  17. auto foo(short a) -> void;
  18. auto bar(short a) -> void;
  19. // --- import_multiple_functions_no_overloads.carbon
  20. library "[[@TEST_NAME]]";
  21. import Cpp library "multiple_functions_no_overloads.h";
  22. fn F() {
  23. Cpp.bar(1 as i16);
  24. }
  25. // --- overloaded_functions.h
  26. auto foo(short a) -> void;
  27. auto foo(int a) -> void;
  28. // --- import_overloaded_functions.carbon
  29. library "[[@TEST_NAME]]";
  30. import Cpp library "overloaded_functions.h";
  31. fn F() {
  32. Cpp.foo(1 as i32);
  33. }
  34. // --- both_overloaded_functions_called.h
  35. auto foo(short a) -> void;
  36. auto foo(int a) -> void;
  37. // --- import_both_overloaded_functions_called.carbon
  38. library "[[@TEST_NAME]]";
  39. import Cpp library "both_overloaded_functions_called.h";
  40. fn F() {
  41. Cpp.foo(1 as i32);
  42. Cpp.foo(1 as i16);
  43. }
  44. // --- multiple_overloaded_sets.h
  45. auto foo(short a) -> void;
  46. auto foo(int a) -> void;
  47. auto bar(long a) -> void;
  48. auto bar(int a) -> void;
  49. // --- import_multiple_overloaded_sets.carbon
  50. library "[[@TEST_NAME]]";
  51. import Cpp library "multiple_overloaded_sets.h";
  52. fn F() {
  53. Cpp.foo(1 as i32);
  54. Cpp.bar(1 as i32);
  55. }
  56. // ============================================================================
  57. // Call args tests
  58. // ============================================================================
  59. // --- int_literal.h
  60. auto foo(int a) -> int;
  61. auto foo(unsigned int a) -> unsigned int;
  62. auto foo(long a) -> long;
  63. auto foo(unsigned long a) -> unsigned long;
  64. auto foo(long long a) -> long long;
  65. auto foo(unsigned long long a) -> unsigned long long;
  66. auto foo(__int128 a) -> __int128;
  67. auto foo(unsigned __int128 a) -> unsigned __int128;
  68. // --- import_int_literal.carbon
  69. library "[[@TEST_NAME]]";
  70. import Cpp library "int_literal.h";
  71. fn F() {
  72. // i32_max
  73. let a: i32 = Cpp.foo(2147483647);
  74. // i32_max + 1
  75. // It could fit to unsigned int, but only signed integers are considered, so assigned to long.
  76. // Decimal, hexadecimal and binary integer literals are treated the same when assigning a C++ type.
  77. let b: i64 = Cpp.foo(2147483648);
  78. let b_hexa: i64 = Cpp.foo(0x8000_0000);
  79. let b_binary: i64 = Cpp.foo(0b1000_0000_0000_0000_0000_0000_0000_0000);
  80. // i64_max
  81. let c: i64 = Cpp.foo(9223372036854775807);
  82. // i64_max + 1
  83. // Could fit to unsigned long, but only signed integers are considered, so fitted to _int128.
  84. let d: i128 = Cpp.foo(9223372036854775808);
  85. // u64_max
  86. let e: i128 = Cpp.foo(18446744073709551615);
  87. // u64_max + 1
  88. let f: i128 = Cpp.foo(18446744073709551616);
  89. // i128_max
  90. let g: i128 = Cpp.foo(170141183460469231731687303715884105727);
  91. }
  92. // --- fail_import_large_int_literal.carbon
  93. library "[[@TEST_NAME]]";
  94. import Cpp library "int_literal.h";
  95. fn F() {
  96. // TODO: get rid of the second error message here.
  97. // i128_max + 1
  98. // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+8]]:25: error: integer value 170141183460469231731687303715884105728 too large to fit in a signed C++ integer type; requires 129 bits, but max is 128 [IntTooLargeForCppType]
  99. // CHECK:STDERR: let h: i128 = Cpp.foo(170141183460469231731687303715884105728);
  100. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101. // CHECK:STDERR:
  102. // CHECK:STDERR: fail_import_large_int_literal.carbon:[[@LINE+4]]:25: error: call argument of type `Core.IntLiteral` is not supported [CppCallArgTypeNotSupported]
  103. // CHECK:STDERR: let h: i128 = Cpp.foo(170141183460469231731687303715884105728);
  104. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. // CHECK:STDERR:
  106. let h: i128 = Cpp.foo(170141183460469231731687303715884105728);
  107. }
  108. // --- negative_int_literal.h
  109. auto foo(long a) -> void;
  110. auto foo(int a) -> void;
  111. // --- import_negative_int_literal.carbon
  112. library "[[@TEST_NAME]]";
  113. import Cpp library "negative_int_literal.h";
  114. fn F() {
  115. // selects `auto foo(int a) -> void;`
  116. Cpp.foo(-1);
  117. }
  118. // --- negative_literal_passed_to_unsigned.h
  119. auto foo(unsigned int a) -> void;
  120. // --- fail_import_negative_literal_passed_to_unsigned.carbon
  121. library "[[@TEST_NAME]]";
  122. import Cpp library "negative_literal_passed_to_unsigned.h";
  123. fn F() {
  124. // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE+8]]:11: error: negative integer value -1 converted to unsigned type `u32` [NegativeIntInUnsignedType]
  125. // CHECK:STDERR: Cpp.foo(-1);
  126. // CHECK:STDERR: ^~
  127. // CHECK:STDERR: fail_import_negative_literal_passed_to_unsigned.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  128. // CHECK:STDERR: ./negative_literal_passed_to_unsigned.h:2:23: note: initializing function parameter [InCallToFunctionParam]
  129. // CHECK:STDERR: auto foo(unsigned int a) -> void;
  130. // CHECK:STDERR: ^
  131. // CHECK:STDERR:
  132. Cpp.foo(-1);
  133. }
  134. // --- floating_point_literal.h
  135. auto foo(float a) -> float;
  136. auto foo(double a) -> double;
  137. // --- import_floating_point_literal.carbon
  138. library "[[@TEST_NAME]]";
  139. import Cpp library "floating_point_literal.h";
  140. fn F() {
  141. let d: f64 = Cpp.foo(1.0);
  142. }
  143. // --- fail_import_large_floating_point_literal.carbon
  144. library "[[@TEST_NAME]]";
  145. import Cpp library "floating_point_literal.h";
  146. fn F() {
  147. // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE+8]]:11: error: value 18*10^307 too large for floating-point type `f64` [FloatLiteralTooLargeForType]
  148. // CHECK:STDERR: Cpp.foo(1.8e+308);
  149. // CHECK:STDERR: ^~~~~~~~
  150. // CHECK:STDERR: fail_import_large_floating_point_literal.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  151. // CHECK:STDERR: ./floating_point_literal.h:3:17: note: initializing function parameter [InCallToFunctionParam]
  152. // CHECK:STDERR: auto foo(double a) -> double;
  153. // CHECK:STDERR: ^
  154. // CHECK:STDERR:
  155. Cpp.foo(1.8e+308);
  156. }
  157. // --- struct_init.h
  158. struct NoFields {};
  159. auto PassNoFields(NoFields s) -> void;
  160. struct ThreeFields {
  161. int a, b, c;
  162. };
  163. auto PassThreeFields(ThreeFields t) -> void;
  164. // --- struct_init.carbon
  165. library "[[@TEST_NAME]]";
  166. import Cpp library "struct_init.h";
  167. fn MakeEmpty() -> {};
  168. fn Empty(value: {}, ref reference: {}) {
  169. Cpp.PassNoFields({});
  170. Cpp.PassNoFields(value);
  171. Cpp.PassNoFields(reference);
  172. Cpp.PassNoFields(MakeEmpty());
  173. }
  174. // --- fail_todo_struct_init_nonempty.carbon
  175. library "[[@TEST_NAME]]";
  176. import Cpp library "struct_init.h";
  177. fn MakeThreeFields() -> {.a: i32, .b: i32, .c: i32};
  178. fn ThreeFields(value: {.a: i32, .b: i32, .c: i32}, ref reference: {.a: i32, .b: i32, .c: i32}) {
  179. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  180. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  181. // CHECK:STDERR: ` [SemanticsTodo]
  182. // CHECK:STDERR: Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
  183. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  184. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
  185. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  186. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  187. // CHECK:STDERR: ^
  188. // CHECK:STDERR:
  189. Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3});
  190. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  191. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  192. // CHECK:STDERR: ` [SemanticsTodo]
  193. // CHECK:STDERR: Cpp.PassThreeFields(value);
  194. // CHECK:STDERR: ^~~~~
  195. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-22]]:10: in file included here [InCppInclude]
  196. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  197. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  198. // CHECK:STDERR: ^
  199. // CHECK:STDERR:
  200. Cpp.PassThreeFields(value);
  201. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  202. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  203. // CHECK:STDERR: ` [SemanticsTodo]
  204. // CHECK:STDERR: Cpp.PassThreeFields(reference);
  205. // CHECK:STDERR: ^~~~~~~~~
  206. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-34]]:10: in file included here [InCppInclude]
  207. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  208. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  209. // CHECK:STDERR: ^
  210. // CHECK:STDERR:
  211. Cpp.PassThreeFields(reference);
  212. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  213. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  214. // CHECK:STDERR: ` [SemanticsTodo]
  215. // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields());
  216. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  217. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-46]]:10: in file included here [InCppInclude]
  218. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  219. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  220. // CHECK:STDERR: ^
  221. // CHECK:STDERR:
  222. Cpp.PassThreeFields(MakeThreeFields());
  223. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  224. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  225. // CHECK:STDERR: ` [SemanticsTodo]
  226. // CHECK:STDERR: Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3});
  227. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  228. // CHECK:STDERR: fail_todo_struct_init_nonempty.carbon:[[@LINE-58]]:10: in file included here [InCppInclude]
  229. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  230. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  231. // CHECK:STDERR: ^
  232. // CHECK:STDERR:
  233. Cpp.PassThreeFields({.b = 1, .c = 2, .a = 3});
  234. }
  235. // --- fail_struct_init_field_mismatch.carbon
  236. library "[[@TEST_NAME]]";
  237. import Cpp library "struct_init.h";
  238. fn F() {
  239. // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+8]]:55: error: no matching function for call to 'PassThreeFields' [CppInteropParseError]
  240. // CHECK:STDERR: 15 | Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4});
  241. // CHECK:STDERR: | ^
  242. // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  243. // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNote]
  244. // CHECK:STDERR: 10 | auto PassThreeFields(ThreeFields t) -> void;
  245. // CHECK:STDERR: | ^ ~~~~~~~~~~~~~
  246. // CHECK:STDERR:
  247. Cpp.PassThreeFields({.a = 1, .b = 2, .c = 3, .d = 4});
  248. // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE+8]]:47: error: no matching function for call to 'PassThreeFields' [CppInteropParseError]
  249. // CHECK:STDERR: 25 | Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3});
  250. // CHECK:STDERR: | ^
  251. // CHECK:STDERR: fail_struct_init_field_mismatch.carbon:[[@LINE-16]]:10: in file included here [InCppInclude]
  252. // CHECK:STDERR: ./struct_init.h:10:6: note: candidate function not viable: cannot convert initializer list argument to 'ThreeFields' [CppInteropParseNote]
  253. // CHECK:STDERR: 10 | auto PassThreeFields(ThreeFields t) -> void;
  254. // CHECK:STDERR: | ^ ~~~~~~~~~~~~~
  255. // CHECK:STDERR:
  256. Cpp.PassThreeFields({.a = 1, .x = 2, .c = 3});
  257. }
  258. // --- fail_struct_init_unsupported_field_name.carbon
  259. library "[[@TEST_NAME]]";
  260. import Cpp library "struct_init.h";
  261. fn F() {
  262. // CHECK:STDERR: fail_struct_init_unsupported_field_name.carbon:[[@LINE+4]]:23: error: field name `base` cannot be mapped into C++ [CppCallFieldNameNotSupported]
  263. // CHECK:STDERR: Cpp.PassThreeFields({.base = 1});
  264. // CHECK:STDERR: ^~~~~~~~~~~
  265. // CHECK:STDERR:
  266. Cpp.PassThreeFields({.base = 1});
  267. }
  268. // --- fail_struct_init_from_tuple.carbon
  269. library "[[@TEST_NAME]]";
  270. import Cpp library "struct_init.h";
  271. // TODO: Struct init from an undesignated list is allowed in C++, but not in
  272. // Carbon. Should we allow it when initializing a C++ class type?
  273. fn MakeEmpty() -> ();
  274. fn Empty(value: (), ref reference: ()) {
  275. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:20: error: semantics TODO: `Unsupported initialization sequence:
  276. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct NoFields]
  277. // CHECK:STDERR: ` [SemanticsTodo]
  278. // CHECK:STDERR: Cpp.PassNoFields(());
  279. // CHECK:STDERR: ^~
  280. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-13]]:10: in file included here [InCppInclude]
  281. // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
  282. // CHECK:STDERR: auto PassNoFields(NoFields s) -> void;
  283. // CHECK:STDERR: ^
  284. // CHECK:STDERR:
  285. Cpp.PassNoFields(());
  286. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:20: error: semantics TODO: `Unsupported initialization sequence:
  287. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct NoFields]
  288. // CHECK:STDERR: ` [SemanticsTodo]
  289. // CHECK:STDERR: Cpp.PassNoFields(value);
  290. // CHECK:STDERR: ^~~~~
  291. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-25]]:10: in file included here [InCppInclude]
  292. // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
  293. // CHECK:STDERR: auto PassNoFields(NoFields s) -> void;
  294. // CHECK:STDERR: ^
  295. // CHECK:STDERR:
  296. Cpp.PassNoFields(value);
  297. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:20: error: semantics TODO: `Unsupported initialization sequence:
  298. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct NoFields]
  299. // CHECK:STDERR: ` [SemanticsTodo]
  300. // CHECK:STDERR: Cpp.PassNoFields(reference);
  301. // CHECK:STDERR: ^~~~~~~~~
  302. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-37]]:10: in file included here [InCppInclude]
  303. // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
  304. // CHECK:STDERR: auto PassNoFields(NoFields s) -> void;
  305. // CHECK:STDERR: ^
  306. // CHECK:STDERR:
  307. Cpp.PassNoFields(reference);
  308. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:20: error: semantics TODO: `Unsupported initialization sequence:
  309. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct NoFields]
  310. // CHECK:STDERR: ` [SemanticsTodo]
  311. // CHECK:STDERR: Cpp.PassNoFields(MakeEmpty());
  312. // CHECK:STDERR: ^~~~~~~~~~~
  313. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-49]]:10: in file included here [InCppInclude]
  314. // CHECK:STDERR: ./struct_init.h:4:28: note: initializing function parameter [InCallToFunctionParam]
  315. // CHECK:STDERR: auto PassNoFields(NoFields s) -> void;
  316. // CHECK:STDERR: ^
  317. // CHECK:STDERR:
  318. Cpp.PassNoFields(MakeEmpty());
  319. }
  320. fn MakeThreeFields() -> (i32, i32, i32);
  321. fn ThreeFields(value: (i32, i32, i32), ref reference: (i32, i32, i32)) {
  322. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  323. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  324. // CHECK:STDERR: ` [SemanticsTodo]
  325. // CHECK:STDERR: Cpp.PassThreeFields((1, 2, 3));
  326. // CHECK:STDERR: ^~~~~~~~~
  327. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-65]]:10: in file included here [InCppInclude]
  328. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  329. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  330. // CHECK:STDERR: ^
  331. // CHECK:STDERR:
  332. Cpp.PassThreeFields((1, 2, 3));
  333. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  334. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  335. // CHECK:STDERR: ` [SemanticsTodo]
  336. // CHECK:STDERR: Cpp.PassThreeFields(value);
  337. // CHECK:STDERR: ^~~~~
  338. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-77]]:10: in file included here [InCppInclude]
  339. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  340. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  341. // CHECK:STDERR: ^
  342. // CHECK:STDERR:
  343. Cpp.PassThreeFields(value);
  344. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  345. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  346. // CHECK:STDERR: ` [SemanticsTodo]
  347. // CHECK:STDERR: Cpp.PassThreeFields(reference);
  348. // CHECK:STDERR: ^~~~~~~~~
  349. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-89]]:10: in file included here [InCppInclude]
  350. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  351. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  352. // CHECK:STDERR: ^
  353. // CHECK:STDERR:
  354. Cpp.PassThreeFields(reference);
  355. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE+10]]:23: error: semantics TODO: `Unsupported initialization sequence:
  356. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct ThreeFields]
  357. // CHECK:STDERR: ` [SemanticsTodo]
  358. // CHECK:STDERR: Cpp.PassThreeFields(MakeThreeFields());
  359. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  360. // CHECK:STDERR: fail_struct_init_from_tuple.carbon:[[@LINE-101]]:10: in file included here [InCppInclude]
  361. // CHECK:STDERR: ./struct_init.h:10:34: note: initializing function parameter [InCallToFunctionParam]
  362. // CHECK:STDERR: auto PassThreeFields(ThreeFields t) -> void;
  363. // CHECK:STDERR: ^
  364. // CHECK:STDERR:
  365. Cpp.PassThreeFields(MakeThreeFields());
  366. }
  367. // --- int_from_struct.h
  368. auto PassInt(int n) -> void;
  369. struct S {};
  370. auto PassOverloaded(int n) -> void;
  371. auto PassOverloaded(S n) -> void;
  372. // --- fail_int_from_struct.carbon
  373. library "[[@TEST_NAME]]";
  374. import Cpp library "int_from_struct.h";
  375. fn F() {
  376. // C++ permits `{}` to be used to initialize an int, but Carbon does not.
  377. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+11]]:15: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure]
  378. // CHECK:STDERR: Cpp.PassInt({});
  379. // CHECK:STDERR: ^~
  380. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  381. // CHECK:STDERR: Cpp.PassInt({});
  382. // CHECK:STDERR: ^~
  383. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-11]]:10: in file included here [InCppInclude]
  384. // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam]
  385. // CHECK:STDERR: auto PassInt(int n) -> void;
  386. // CHECK:STDERR: ^
  387. // CHECK:STDERR:
  388. Cpp.PassInt({});
  389. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+11]]:15: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure]
  390. // CHECK:STDERR: Cpp.PassInt(());
  391. // CHECK:STDERR: ^~
  392. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE+8]]:15: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  393. // CHECK:STDERR: Cpp.PassInt(());
  394. // CHECK:STDERR: ^~
  395. // CHECK:STDERR: fail_int_from_struct.carbon:[[@LINE-24]]:10: in file included here [InCppInclude]
  396. // CHECK:STDERR: ./int_from_struct.h:2:18: note: initializing function parameter [InCallToFunctionParam]
  397. // CHECK:STDERR: auto PassInt(int n) -> void;
  398. // CHECK:STDERR: ^
  399. // CHECK:STDERR:
  400. Cpp.PassInt(());
  401. }
  402. // --- fail_int_from_struct_overloaded.carbon
  403. library "[[@TEST_NAME]]";
  404. import Cpp library "int_from_struct.h";
  405. fn F() {
  406. // C++ overload resolution prefers to convert `{}` to `int` rather than to an
  407. // empty struct. So that's the overload we pick, even though we can't call it.
  408. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `{}` to `i32` [ConversionFailure]
  409. // CHECK:STDERR: Cpp.PassOverloaded({});
  410. // CHECK:STDERR: ^~
  411. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `{}` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  412. // CHECK:STDERR: Cpp.PassOverloaded({});
  413. // CHECK:STDERR: ^~
  414. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-12]]:10: in file included here [InCppInclude]
  415. // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam]
  416. // CHECK:STDERR: auto PassOverloaded(int n) -> void;
  417. // CHECK:STDERR: ^
  418. // CHECK:STDERR:
  419. Cpp.PassOverloaded({});
  420. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+11]]:22: error: cannot implicitly convert expression of type `()` to `i32` [ConversionFailure]
  421. // CHECK:STDERR: Cpp.PassOverloaded(());
  422. // CHECK:STDERR: ^~
  423. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE+8]]:22: note: type `()` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  424. // CHECK:STDERR: Cpp.PassOverloaded(());
  425. // CHECK:STDERR: ^~
  426. // CHECK:STDERR: fail_int_from_struct_overloaded.carbon:[[@LINE-25]]:10: in file included here [InCppInclude]
  427. // CHECK:STDERR: ./int_from_struct.h:6:25: note: initializing function parameter [InCallToFunctionParam]
  428. // CHECK:STDERR: auto PassOverloaded(int n) -> void;
  429. // CHECK:STDERR: ^
  430. // CHECK:STDERR:
  431. Cpp.PassOverloaded(());
  432. }
  433. // --- nested_structs.h
  434. struct A {
  435. int x, y;
  436. };
  437. struct B {
  438. A a;
  439. int n;
  440. };
  441. void TakeB(B);
  442. // --- fail_pass_nested_structs_inner_field_mismatch.carbon
  443. library "[[@TEST_NAME]]";
  444. import Cpp library "nested_structs.h";
  445. fn F() {
  446. // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE+8]]:44: error: no matching function for call to 'TakeB' [CppInteropParseError]
  447. // CHECK:STDERR: 15 | Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3});
  448. // CHECK:STDERR: | ^
  449. // CHECK:STDERR: fail_pass_nested_structs_inner_field_mismatch.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  450. // CHECK:STDERR: ./nested_structs.h:11:6: note: candidate function not viable: cannot convert initializer list argument to 'B' [CppInteropParseNote]
  451. // CHECK:STDERR: 11 | void TakeB(B);
  452. // CHECK:STDERR: | ^ ~
  453. // CHECK:STDERR:
  454. Cpp.TakeB({.a = {.x = 1, .z = 2}, .n = 3});
  455. }
  456. // --- fail_todo_pass_nested_structs.carbon
  457. library "[[@TEST_NAME]]";
  458. import Cpp library "nested_structs.h";
  459. fn F() {
  460. // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE+10]]:13: error: semantics TODO: `Unsupported initialization sequence:
  461. // CHECK:STDERR: Normal sequence: list aggregate initialization [struct B]
  462. // CHECK:STDERR: ` [SemanticsTodo]
  463. // CHECK:STDERR: Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3});
  464. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  465. // CHECK:STDERR: fail_todo_pass_nested_structs.carbon:[[@LINE-8]]:10: in file included here [InCppInclude]
  466. // CHECK:STDERR: ./nested_structs.h:11:13: note: initializing function parameter [InCallToFunctionParam]
  467. // CHECK:STDERR: void TakeB(B);
  468. // CHECK:STDERR: ^
  469. // CHECK:STDERR:
  470. Cpp.TakeB({.a = {.x = 1, .y = 2}, .n = 3});
  471. }
  472. // ============================================================================
  473. // Overload rejected on Carbon side
  474. // ============================================================================
  475. // --- upsizing_rejected.h
  476. auto foo(int a) -> void;
  477. // --- fail_import_upsizing_rejected.carbon
  478. library "[[@TEST_NAME]]";
  479. import Cpp library "upsizing_rejected.h";
  480. fn F() {
  481. // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i16` to `i32` [ConversionFailure]
  482. // CHECK:STDERR: Cpp.foo(1 as i16);
  483. // CHECK:STDERR: ^~~~~~~~
  484. // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i16` does not implement interface `Core.ImplicitAs(i32)` [MissingImplInMemberAccessNote]
  485. // CHECK:STDERR: Cpp.foo(1 as i16);
  486. // CHECK:STDERR: ^~~~~~~~
  487. // CHECK:STDERR: fail_import_upsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude]
  488. // CHECK:STDERR: ./upsizing_rejected.h:2:14: note: initializing function parameter [InCallToFunctionParam]
  489. // CHECK:STDERR: auto foo(int a) -> void;
  490. // CHECK:STDERR: ^
  491. // CHECK:STDERR:
  492. Cpp.foo(1 as i16);
  493. }
  494. // --- downsizing_rejected.h
  495. auto foo(short a) -> void;
  496. // --- fail_import_downsizing_rejected.carbon
  497. library "[[@TEST_NAME]]";
  498. import Cpp library "downsizing_rejected.h";
  499. fn F() {
  500. // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+11]]:11: error: cannot implicitly convert expression of type `i32` to `i16` [ConversionFailure]
  501. // CHECK:STDERR: Cpp.foo(1 as i32);
  502. // CHECK:STDERR: ^~~~~~~~
  503. // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE+8]]:11: note: type `i32` does not implement interface `Core.ImplicitAs(i16)` [MissingImplInMemberAccessNote]
  504. // CHECK:STDERR: Cpp.foo(1 as i32);
  505. // CHECK:STDERR: ^~~~~~~~
  506. // CHECK:STDERR: fail_import_downsizing_rejected.carbon:[[@LINE-9]]:10: in file included here [InCppInclude]
  507. // CHECK:STDERR: ./downsizing_rejected.h:2:16: note: initializing function parameter [InCallToFunctionParam]
  508. // CHECK:STDERR: auto foo(short a) -> void;
  509. // CHECK:STDERR: ^
  510. // CHECK:STDERR:
  511. Cpp.foo(1 as i32);
  512. }
  513. // ============================================================================
  514. // No viable function found
  515. // ============================================================================
  516. // --- no_viable_function.h
  517. auto foo(short a, int b) -> void;
  518. // --- fail_import_no_viable_function.carbon
  519. library "[[@TEST_NAME]]";
  520. import Cpp library "no_viable_function.h";
  521. fn F() {
  522. // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE+8]]:19: error: no matching function for call to 'foo' [CppInteropParseError]
  523. // CHECK:STDERR: 15 | Cpp.foo(1 as i64);
  524. // CHECK:STDERR: | ^
  525. // CHECK:STDERR: fail_import_no_viable_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  526. // CHECK:STDERR: ./no_viable_function.h:2:6: note: candidate function not viable: requires 2 arguments, but 1 was provided [CppInteropParseNote]
  527. // CHECK:STDERR: 2 | auto foo(short a, int b) -> void;
  528. // CHECK:STDERR: | ^ ~~~~~~~~~~~~~~
  529. // CHECK:STDERR:
  530. Cpp.foo(1 as i64);
  531. }
  532. // ============================================================================
  533. // Ambiguous overload found
  534. // ============================================================================
  535. // --- ambiguous_overload.h
  536. auto foo(short a) -> void;
  537. auto foo(int a) -> void;
  538. // --- fail_import_ambiguous_overload.carbon
  539. library "[[@TEST_NAME]]";
  540. import Cpp library "ambiguous_overload.h";
  541. fn F() {
  542. // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE+12]]:19: error: call to 'foo' is ambiguous [CppInteropParseError]
  543. // CHECK:STDERR: 19 | Cpp.foo(1 as i64);
  544. // CHECK:STDERR: | ^
  545. // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  546. // CHECK:STDERR: ./ambiguous_overload.h:2:6: note: candidate function [CppInteropParseNote]
  547. // CHECK:STDERR: 2 | auto foo(short a) -> void;
  548. // CHECK:STDERR: | ^
  549. // CHECK:STDERR: fail_import_ambiguous_overload.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
  550. // CHECK:STDERR: ./ambiguous_overload.h:3:6: note: candidate function [CppInteropParseNote]
  551. // CHECK:STDERR: 3 | auto foo(int a) -> void;
  552. // CHECK:STDERR: | ^
  553. // CHECK:STDERR:
  554. Cpp.foo(1 as i64);
  555. }
  556. // ============================================================================
  557. // Deleted function found
  558. // ============================================================================
  559. // --- deleted_function.h
  560. auto foo(short a) -> void;
  561. auto foo(int a) -> void = delete;
  562. // --- fail_import_deleted_function.carbon
  563. library "[[@TEST_NAME]]";
  564. import Cpp library "deleted_function.h";
  565. fn F() {
  566. // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE+12]]:19: error: call to deleted function 'foo' [CppInteropParseError]
  567. // CHECK:STDERR: 19 | Cpp.foo(1 as i32);
  568. // CHECK:STDERR: | ^
  569. // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  570. // CHECK:STDERR: ./deleted_function.h:3:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
  571. // CHECK:STDERR: 3 | auto foo(int a) -> void = delete;
  572. // CHECK:STDERR: | ^
  573. // CHECK:STDERR: fail_import_deleted_function.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
  574. // CHECK:STDERR: ./deleted_function.h:2:6: note: candidate function [CppInteropParseNote]
  575. // CHECK:STDERR: 2 | auto foo(short a) -> void;
  576. // CHECK:STDERR: | ^
  577. // CHECK:STDERR:
  578. Cpp.foo(1 as i32);
  579. }
  580. // --- fail_missing_impl.carbon
  581. library "[[@TEST_NAME]]";
  582. import Cpp inline '''
  583. void foo();
  584. void foo(int);
  585. ''';
  586. interface I {}
  587. fn EchoValue[ValueT:! I](value:! ValueT) {}
  588. fn F() {
  589. // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE+7]]:3: error: cannot convert type `<type of Cpp.foo>` into type implementing `I` [ConversionFailureTypeToFacet]
  590. // CHECK:STDERR: EchoValue(Cpp.foo);
  591. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  592. // CHECK:STDERR: fail_missing_impl.carbon:[[@LINE-6]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  593. // CHECK:STDERR: fn EchoValue[ValueT:! I](value:! ValueT) {}
  594. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  595. // CHECK:STDERR:
  596. EchoValue(Cpp.foo);
  597. }
  598. // CHECK:STDOUT: --- import_multiple_functions_no_overloads.carbon
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: constants {
  601. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  602. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  603. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  604. // CHECK:STDOUT: %bar.cpp_overload_set.type: type = cpp_overload_set_type @bar.cpp_overload_set [concrete]
  605. // CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete]
  606. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  607. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  608. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  609. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  610. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  611. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  612. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  613. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  614. // CHECK:STDOUT: %As.type.359: type = facet_type <@As, @As(%i16)> [concrete]
  615. // CHECK:STDOUT: %As.Convert.type.be5: type = fn_type @As.Convert, @As(%i16) [concrete]
  616. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  617. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  618. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  619. // CHECK:STDOUT: %As.impl_witness.b61: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  620. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.c60: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  621. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.a42: %Core.IntLiteral.as.As.impl.Convert.type.c60 = struct_value () [concrete]
  622. // CHECK:STDOUT: %As.facet: %As.type.359 = facet_value Core.IntLiteral, (%As.impl_witness.b61) [concrete]
  623. // CHECK:STDOUT: %.240: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet [concrete]
  624. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.a42 [concrete]
  625. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.a42, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
  626. // CHECK:STDOUT: %bound_method.4da: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  627. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  628. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  629. // CHECK:STDOUT: %pattern_type.54c: type = pattern_type %ptr.251 [concrete]
  630. // CHECK:STDOUT: %bar__carbon_thunk.type: type = fn_type @bar__carbon_thunk [concrete]
  631. // CHECK:STDOUT: %bar__carbon_thunk: %bar__carbon_thunk.type = struct_value () [concrete]
  632. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  633. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  634. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  635. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  636. // CHECK:STDOUT: %Copy.impl_witness.e99: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_16) [concrete]
  637. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.97f: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_16) [concrete]
  638. // CHECK:STDOUT: %Int.as.Copy.impl.Op.0da: %Int.as.Copy.impl.Op.type.97f = struct_value () [concrete]
  639. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i16, (%Copy.impl_witness.e99) [concrete]
  640. // CHECK:STDOUT: %.03d: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  641. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.0da [concrete]
  642. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.0da, @Int.as.Copy.impl.Op(%int_16) [concrete]
  643. // CHECK:STDOUT: %bound_method.a48: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.specific_fn [concrete]
  644. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  645. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  646. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: imports {
  650. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  651. // CHECK:STDOUT: .Int = %Core.Int
  652. // CHECK:STDOUT: .As = %Core.As
  653. // CHECK:STDOUT: .Copy = %Core.Copy
  654. // CHECK:STDOUT: .Destroy = %Core.Destroy
  655. // CHECK:STDOUT: import Core//prelude
  656. // CHECK:STDOUT: import Core//prelude/...
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  659. // CHECK:STDOUT: .bar = %bar.cpp_overload_set.value
  660. // CHECK:STDOUT: import Cpp//...
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete = constants.%bar.cpp_overload_set.value]
  663. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  664. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  665. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  666. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  667. // CHECK:STDOUT: %bar__carbon_thunk.decl: %bar__carbon_thunk.type = fn_decl @bar__carbon_thunk [concrete = constants.%bar__carbon_thunk] {
  668. // CHECK:STDOUT: %a.patt: %pattern_type.54c = value_binding_pattern a [concrete]
  669. // CHECK:STDOUT: %a.param_patt: %pattern_type.54c = value_param_pattern %a.patt, call_param0 [concrete]
  670. // CHECK:STDOUT: } {
  671. // CHECK:STDOUT: %a.param: %ptr.251 = value_param call_param0
  672. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr.251 [concrete = constants.%ptr.251] {
  673. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  674. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  675. // CHECK:STDOUT: }
  676. // CHECK:STDOUT: %a: %ptr.251 = value_binding a, %a.param
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  679. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  680. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  681. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  682. // CHECK:STDOUT: }
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: file {
  685. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  686. // CHECK:STDOUT: .Core = imports.%Core
  687. // CHECK:STDOUT: .Cpp = imports.%Cpp
  688. // CHECK:STDOUT: .F = %F.decl
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT: %Core.import = import Core
  691. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  692. // CHECK:STDOUT: import Cpp "multiple_functions_no_overloads.h"
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  695. // CHECK:STDOUT: }
  696. // CHECK:STDOUT:
  697. // CHECK:STDOUT: fn @F() {
  698. // CHECK:STDOUT: !entry:
  699. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  700. // CHECK:STDOUT: %bar.ref: %bar.cpp_overload_set.type = name_ref bar, imports.%bar.cpp_overload_set.value [concrete = constants.%bar.cpp_overload_set.value]
  701. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  702. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  703. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  704. // CHECK:STDOUT: %impl.elem0.loc7_13.1: %.240 = impl_witness_access constants.%As.impl_witness.b61, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.a42]
  705. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0.loc7_13.1 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  706. // CHECK:STDOUT: %specific_fn.loc7_13.1: <specific function> = specific_function %impl.elem0.loc7_13.1, @Core.IntLiteral.as.As.impl.Convert(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  707. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn.loc7_13.1 [concrete = constants.%bound_method.4da]
  708. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i16 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.f90]
  709. // CHECK:STDOUT: %.loc7_13.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.f90]
  710. // CHECK:STDOUT: %.loc7_13.2: %i16 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.f90]
  711. // CHECK:STDOUT: %.loc7_13.3: ref %i16 = temporary_storage
  712. // CHECK:STDOUT: %impl.elem0.loc7_13.2: %.03d = impl_witness_access constants.%Copy.impl_witness.e99, element0 [concrete = constants.%Int.as.Copy.impl.Op.0da]
  713. // CHECK:STDOUT: %bound_method.loc7_13.3: <bound method> = bound_method %.loc7_13.2, %impl.elem0.loc7_13.2 [concrete = constants.%Int.as.Copy.impl.Op.bound]
  714. // CHECK:STDOUT: %specific_fn.loc7_13.2: <specific function> = specific_function %impl.elem0.loc7_13.2, @Int.as.Copy.impl.Op(constants.%int_16) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  715. // CHECK:STDOUT: %bound_method.loc7_13.4: <bound method> = bound_method %.loc7_13.2, %specific_fn.loc7_13.2 [concrete = constants.%bound_method.a48]
  716. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i16 = call %bound_method.loc7_13.4(%.loc7_13.2) [concrete = constants.%int_1.f90]
  717. // CHECK:STDOUT: %.loc7_13.4: ref %i16 = temporary %.loc7_13.3, %Int.as.Copy.impl.Op.call
  718. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %.loc7_13.4
  719. // CHECK:STDOUT: %bar__carbon_thunk.call: init %empty_tuple.type = call imports.%bar__carbon_thunk.decl(%addr)
  720. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc7_13.4, constants.%DestroyOp
  721. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc7_13.4)
  722. // CHECK:STDOUT: return
  723. // CHECK:STDOUT: }
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: fn @bar(%a.param: %i16);
  726. // CHECK:STDOUT:
  727. // CHECK:STDOUT: fn @bar__carbon_thunk(%a.param: %ptr.251);
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: fn @DestroyOp(%self.param: %i16) = "no_op";
  730. // CHECK:STDOUT:
  731. // CHECK:STDOUT: --- import_overloaded_functions.carbon
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: constants {
  734. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  735. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  736. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  737. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  738. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  739. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  740. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  741. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  742. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  743. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  744. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  745. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  746. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  747. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  748. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  749. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  750. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  751. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  752. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  753. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  754. // CHECK:STDOUT: %As.facet: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  755. // CHECK:STDOUT: %.97a: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet [concrete]
  756. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  757. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  758. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  759. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  760. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  761. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  762. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  763. // CHECK:STDOUT: }
  764. // CHECK:STDOUT:
  765. // CHECK:STDOUT: imports {
  766. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  767. // CHECK:STDOUT: .Int = %Core.Int
  768. // CHECK:STDOUT: .As = %Core.As
  769. // CHECK:STDOUT: import Core//prelude
  770. // CHECK:STDOUT: import Core//prelude/...
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  773. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  774. // CHECK:STDOUT: import Cpp//...
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  777. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  778. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  779. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  780. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  781. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  782. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  783. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  784. // CHECK:STDOUT: } {
  785. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  786. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  787. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  788. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  791. // CHECK:STDOUT: }
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT:
  794. // CHECK:STDOUT: file {
  795. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  796. // CHECK:STDOUT: .Core = imports.%Core
  797. // CHECK:STDOUT: .Cpp = imports.%Cpp
  798. // CHECK:STDOUT: .F = %F.decl
  799. // CHECK:STDOUT: }
  800. // CHECK:STDOUT: %Core.import = import Core
  801. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  802. // CHECK:STDOUT: import Cpp "overloaded_functions.h"
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: fn @F() {
  808. // CHECK:STDOUT: !entry:
  809. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  810. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  811. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  812. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  813. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  814. // CHECK:STDOUT: %impl.elem0: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  815. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  816. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  817. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  818. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc7_13.2(%int_1) [concrete = constants.%int_1.5d2]
  819. // CHECK:STDOUT: %.loc7_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.5d2]
  820. // CHECK:STDOUT: %.loc7_13.2: %i32 = converted %int_1, %.loc7_13.1 [concrete = constants.%int_1.5d2]
  821. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc7_13.2)
  822. // CHECK:STDOUT: return
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: fn @foo(%a.param: %i32);
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: --- import_both_overloaded_functions_called.carbon
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: constants {
  830. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  831. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  832. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  833. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  834. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  835. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  836. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  837. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  838. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  839. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  840. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  841. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  842. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  843. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  844. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  845. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  846. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  847. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  848. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  849. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  850. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  851. // CHECK:STDOUT: %As.facet.d6e: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  852. // CHECK:STDOUT: %.97a: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet.d6e [concrete]
  853. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.bd3: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  854. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  855. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.fab: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  856. // CHECK:STDOUT: %bound_method.290: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.fab [concrete]
  857. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  858. // CHECK:STDOUT: %foo.type.a5abd1.1: type = fn_type @foo.1 [concrete]
  859. // CHECK:STDOUT: %foo.23ea43.1: %foo.type.a5abd1.1 = struct_value () [concrete]
  860. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  861. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  862. // CHECK:STDOUT: %As.type.359: type = facet_type <@As, @As(%i16)> [concrete]
  863. // CHECK:STDOUT: %As.Convert.type.be5: type = fn_type @As.Convert, @As(%i16) [concrete]
  864. // CHECK:STDOUT: %As.impl_witness.b61: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  865. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.c60: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  866. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.a42: %Core.IntLiteral.as.As.impl.Convert.type.c60 = struct_value () [concrete]
  867. // CHECK:STDOUT: %As.facet.071: %As.type.359 = facet_value Core.IntLiteral, (%As.impl_witness.b61) [concrete]
  868. // CHECK:STDOUT: %.240: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet.071 [concrete]
  869. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound.896: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.a42 [concrete]
  870. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn.00b: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.a42, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
  871. // CHECK:STDOUT: %bound_method.4da: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn.00b [concrete]
  872. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  873. // CHECK:STDOUT: %ptr.251: type = ptr_type %i16 [concrete]
  874. // CHECK:STDOUT: %pattern_type.54c: type = pattern_type %ptr.251 [concrete]
  875. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  876. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  877. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  878. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  879. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  880. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  881. // CHECK:STDOUT: %Copy.impl_witness.e99: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_16) [concrete]
  882. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.97f: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_16) [concrete]
  883. // CHECK:STDOUT: %Int.as.Copy.impl.Op.0da: %Int.as.Copy.impl.Op.type.97f = struct_value () [concrete]
  884. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i16, (%Copy.impl_witness.e99) [concrete]
  885. // CHECK:STDOUT: %.03d: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  886. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.0da [concrete]
  887. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.0da, @Int.as.Copy.impl.Op(%int_16) [concrete]
  888. // CHECK:STDOUT: %bound_method.a48: <bound method> = bound_method %int_1.f90, %Int.as.Copy.impl.Op.specific_fn [concrete]
  889. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  890. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  891. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: imports {
  895. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  896. // CHECK:STDOUT: .Int = %Core.Int
  897. // CHECK:STDOUT: .As = %Core.As
  898. // CHECK:STDOUT: .Copy = %Core.Copy
  899. // CHECK:STDOUT: .Destroy = %Core.Destroy
  900. // CHECK:STDOUT: import Core//prelude
  901. // CHECK:STDOUT: import Core//prelude/...
  902. // CHECK:STDOUT: }
  903. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  904. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  905. // CHECK:STDOUT: import Cpp//...
  906. // CHECK:STDOUT: }
  907. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  908. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  909. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  910. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  911. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  912. // CHECK:STDOUT: %foo.decl.bd967b.1: %foo.type.a5abd1.1 = fn_decl @foo.1 [concrete = constants.%foo.23ea43.1] {
  913. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  914. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  915. // CHECK:STDOUT: } {
  916. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  917. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  918. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  919. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  920. // CHECK:STDOUT: }
  921. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  922. // CHECK:STDOUT: }
  923. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  924. // CHECK:STDOUT: %a.patt: %pattern_type.54c = value_binding_pattern a [concrete]
  925. // CHECK:STDOUT: %a.param_patt: %pattern_type.54c = value_param_pattern %a.patt, call_param0 [concrete]
  926. // CHECK:STDOUT: } {
  927. // CHECK:STDOUT: %a.param: %ptr.251 = value_param call_param0
  928. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr.251 [concrete = constants.%ptr.251] {
  929. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  930. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  931. // CHECK:STDOUT: }
  932. // CHECK:STDOUT: %a: %ptr.251 = value_binding a, %a.param
  933. // CHECK:STDOUT: }
  934. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  935. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  936. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  937. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  938. // CHECK:STDOUT: }
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: file {
  941. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  942. // CHECK:STDOUT: .Core = imports.%Core
  943. // CHECK:STDOUT: .Cpp = imports.%Cpp
  944. // CHECK:STDOUT: .F = %F.decl
  945. // CHECK:STDOUT: }
  946. // CHECK:STDOUT: %Core.import = import Core
  947. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  948. // CHECK:STDOUT: import Cpp "both_overloaded_functions_called.h"
  949. // CHECK:STDOUT: }
  950. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  951. // CHECK:STDOUT: }
  952. // CHECK:STDOUT:
  953. // CHECK:STDOUT: fn @F() {
  954. // CHECK:STDOUT: !entry:
  955. // CHECK:STDOUT: %Cpp.ref.loc7: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  956. // CHECK:STDOUT: %foo.ref.loc7: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  957. // CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  958. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  959. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  960. // CHECK:STDOUT: %impl.elem0.loc7: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  961. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1.loc7, %impl.elem0.loc7 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.bd3]
  962. // CHECK:STDOUT: %specific_fn.loc7: <specific function> = specific_function %impl.elem0.loc7, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.fab]
  963. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1.loc7, %specific_fn.loc7 [concrete = constants.%bound_method.290]
  964. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_13.2(%int_1.loc7) [concrete = constants.%int_1.5d2]
  965. // CHECK:STDOUT: %.loc7_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc7 [concrete = constants.%int_1.5d2]
  966. // CHECK:STDOUT: %.loc7_13.2: %i32 = converted %int_1.loc7, %.loc7_13.1 [concrete = constants.%int_1.5d2]
  967. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl.bd967b.1(%.loc7_13.2)
  968. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  969. // CHECK:STDOUT: %foo.ref.loc8: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  970. // CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  971. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  972. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  973. // CHECK:STDOUT: %impl.elem0.loc8_13.1: %.240 = impl_witness_access constants.%As.impl_witness.b61, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.a42]
  974. // CHECK:STDOUT: %bound_method.loc8_13.1: <bound method> = bound_method %int_1.loc8, %impl.elem0.loc8_13.1 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound.896]
  975. // CHECK:STDOUT: %specific_fn.loc8_13.1: <specific function> = specific_function %impl.elem0.loc8_13.1, @Core.IntLiteral.as.As.impl.Convert(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn.00b]
  976. // CHECK:STDOUT: %bound_method.loc8_13.2: <bound method> = bound_method %int_1.loc8, %specific_fn.loc8_13.1 [concrete = constants.%bound_method.4da]
  977. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc8: init %i16 = call %bound_method.loc8_13.2(%int_1.loc8) [concrete = constants.%int_1.f90]
  978. // CHECK:STDOUT: %.loc8_13.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc8 [concrete = constants.%int_1.f90]
  979. // CHECK:STDOUT: %.loc8_13.2: %i16 = converted %int_1.loc8, %.loc8_13.1 [concrete = constants.%int_1.f90]
  980. // CHECK:STDOUT: %.loc8_13.3: ref %i16 = temporary_storage
  981. // CHECK:STDOUT: %impl.elem0.loc8_13.2: %.03d = impl_witness_access constants.%Copy.impl_witness.e99, element0 [concrete = constants.%Int.as.Copy.impl.Op.0da]
  982. // CHECK:STDOUT: %bound_method.loc8_13.3: <bound method> = bound_method %.loc8_13.2, %impl.elem0.loc8_13.2 [concrete = constants.%Int.as.Copy.impl.Op.bound]
  983. // CHECK:STDOUT: %specific_fn.loc8_13.2: <specific function> = specific_function %impl.elem0.loc8_13.2, @Int.as.Copy.impl.Op(constants.%int_16) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  984. // CHECK:STDOUT: %bound_method.loc8_13.4: <bound method> = bound_method %.loc8_13.2, %specific_fn.loc8_13.2 [concrete = constants.%bound_method.a48]
  985. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i16 = call %bound_method.loc8_13.4(%.loc8_13.2) [concrete = constants.%int_1.f90]
  986. // CHECK:STDOUT: %.loc8_13.4: ref %i16 = temporary %.loc8_13.3, %Int.as.Copy.impl.Op.call
  987. // CHECK:STDOUT: %addr: %ptr.251 = addr_of %.loc8_13.4
  988. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr)
  989. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc8_13.4, constants.%DestroyOp
  990. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc8_13.4)
  991. // CHECK:STDOUT: return
  992. // CHECK:STDOUT: }
  993. // CHECK:STDOUT:
  994. // CHECK:STDOUT: fn @foo.1(%a.param: %i32);
  995. // CHECK:STDOUT:
  996. // CHECK:STDOUT: fn @foo.2(%a.param: %i16);
  997. // CHECK:STDOUT:
  998. // CHECK:STDOUT: fn @foo__carbon_thunk(%a.param: %ptr.251);
  999. // CHECK:STDOUT:
  1000. // CHECK:STDOUT: fn @DestroyOp(%self.param: %i16) = "no_op";
  1001. // CHECK:STDOUT:
  1002. // CHECK:STDOUT: --- import_multiple_overloaded_sets.carbon
  1003. // CHECK:STDOUT:
  1004. // CHECK:STDOUT: constants {
  1005. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1006. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1007. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1008. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1009. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1010. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  1011. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1012. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1013. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1014. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1015. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  1016. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  1017. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  1018. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  1019. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  1020. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  1021. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  1022. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  1023. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  1024. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  1025. // CHECK:STDOUT: %As.facet: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  1026. // CHECK:STDOUT: %.97a: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet [concrete]
  1027. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  1028. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  1029. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  1030. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  1031. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  1032. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1033. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1034. // CHECK:STDOUT: %bar.cpp_overload_set.type: type = cpp_overload_set_type @bar.cpp_overload_set [concrete]
  1035. // CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete]
  1036. // CHECK:STDOUT: %bar.type: type = fn_type @bar [concrete]
  1037. // CHECK:STDOUT: %bar: %bar.type = struct_value () [concrete]
  1038. // CHECK:STDOUT: }
  1039. // CHECK:STDOUT:
  1040. // CHECK:STDOUT: imports {
  1041. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1042. // CHECK:STDOUT: .Int = %Core.Int
  1043. // CHECK:STDOUT: .As = %Core.As
  1044. // CHECK:STDOUT: import Core//prelude
  1045. // CHECK:STDOUT: import Core//prelude/...
  1046. // CHECK:STDOUT: }
  1047. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1048. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1049. // CHECK:STDOUT: .bar = %bar.cpp_overload_set.value
  1050. // CHECK:STDOUT: import Cpp//...
  1051. // CHECK:STDOUT: }
  1052. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1053. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  1054. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  1055. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  1056. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  1057. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1058. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  1059. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  1060. // CHECK:STDOUT: } {
  1061. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  1062. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  1063. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1064. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1065. // CHECK:STDOUT: }
  1066. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  1067. // CHECK:STDOUT: }
  1068. // CHECK:STDOUT: %bar.cpp_overload_set.value: %bar.cpp_overload_set.type = cpp_overload_set_value @bar.cpp_overload_set [concrete = constants.%bar.cpp_overload_set.value]
  1069. // CHECK:STDOUT: %bar.decl: %bar.type = fn_decl @bar [concrete = constants.%bar] {
  1070. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  1071. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  1072. // CHECK:STDOUT: } {
  1073. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  1074. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  1075. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1076. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1077. // CHECK:STDOUT: }
  1078. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  1079. // CHECK:STDOUT: }
  1080. // CHECK:STDOUT: }
  1081. // CHECK:STDOUT:
  1082. // CHECK:STDOUT: file {
  1083. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1084. // CHECK:STDOUT: .Core = imports.%Core
  1085. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1086. // CHECK:STDOUT: .F = %F.decl
  1087. // CHECK:STDOUT: }
  1088. // CHECK:STDOUT: %Core.import = import Core
  1089. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1090. // CHECK:STDOUT: import Cpp "multiple_overloaded_sets.h"
  1091. // CHECK:STDOUT: }
  1092. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1093. // CHECK:STDOUT: }
  1094. // CHECK:STDOUT:
  1095. // CHECK:STDOUT: fn @F() {
  1096. // CHECK:STDOUT: !entry:
  1097. // CHECK:STDOUT: %Cpp.ref.loc7: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1098. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1099. // CHECK:STDOUT: %int_1.loc7: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1100. // CHECK:STDOUT: %int_32.loc7: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1101. // CHECK:STDOUT: %i32.loc7: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1102. // CHECK:STDOUT: %impl.elem0.loc7: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  1103. // CHECK:STDOUT: %bound_method.loc7_13.1: <bound method> = bound_method %int_1.loc7, %impl.elem0.loc7 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  1104. // CHECK:STDOUT: %specific_fn.loc7: <specific function> = specific_function %impl.elem0.loc7, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  1105. // CHECK:STDOUT: %bound_method.loc7_13.2: <bound method> = bound_method %int_1.loc7, %specific_fn.loc7 [concrete = constants.%bound_method]
  1106. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc7: init %i32 = call %bound_method.loc7_13.2(%int_1.loc7) [concrete = constants.%int_1.5d2]
  1107. // CHECK:STDOUT: %.loc7_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc7 [concrete = constants.%int_1.5d2]
  1108. // CHECK:STDOUT: %.loc7_13.2: %i32 = converted %int_1.loc7, %.loc7_13.1 [concrete = constants.%int_1.5d2]
  1109. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc7_13.2)
  1110. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1111. // CHECK:STDOUT: %bar.ref: %bar.cpp_overload_set.type = name_ref bar, imports.%bar.cpp_overload_set.value [concrete = constants.%bar.cpp_overload_set.value]
  1112. // CHECK:STDOUT: %int_1.loc8: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  1113. // CHECK:STDOUT: %int_32.loc8: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1114. // CHECK:STDOUT: %i32.loc8: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1115. // CHECK:STDOUT: %impl.elem0.loc8: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  1116. // CHECK:STDOUT: %bound_method.loc8_13.1: <bound method> = bound_method %int_1.loc8, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  1117. // CHECK:STDOUT: %specific_fn.loc8: <specific function> = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  1118. // CHECK:STDOUT: %bound_method.loc8_13.2: <bound method> = bound_method %int_1.loc8, %specific_fn.loc8 [concrete = constants.%bound_method]
  1119. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call.loc8: init %i32 = call %bound_method.loc8_13.2(%int_1.loc8) [concrete = constants.%int_1.5d2]
  1120. // CHECK:STDOUT: %.loc8_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call.loc8 [concrete = constants.%int_1.5d2]
  1121. // CHECK:STDOUT: %.loc8_13.2: %i32 = converted %int_1.loc8, %.loc8_13.1 [concrete = constants.%int_1.5d2]
  1122. // CHECK:STDOUT: %bar.call: init %empty_tuple.type = call imports.%bar.decl(%.loc8_13.2)
  1123. // CHECK:STDOUT: return
  1124. // CHECK:STDOUT: }
  1125. // CHECK:STDOUT:
  1126. // CHECK:STDOUT: fn @foo(%a.param: %i32);
  1127. // CHECK:STDOUT:
  1128. // CHECK:STDOUT: fn @bar(%a.param: %i32);
  1129. // CHECK:STDOUT:
  1130. // CHECK:STDOUT: --- import_int_literal.carbon
  1131. // CHECK:STDOUT:
  1132. // CHECK:STDOUT: constants {
  1133. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1134. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1135. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1136. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1137. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1138. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1139. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  1140. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1141. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  1142. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1143. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1144. // CHECK:STDOUT: %int_2147483647.d89: Core.IntLiteral = int_value 2147483647 [concrete]
  1145. // CHECK:STDOUT: %foo.type.a5abd1.1: type = fn_type @foo.1 [concrete]
  1146. // CHECK:STDOUT: %foo.23ea43.1: %foo.type.a5abd1.1 = struct_value () [concrete]
  1147. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1148. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1149. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1150. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  1151. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  1152. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  1153. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  1154. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1155. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1156. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  1157. // CHECK:STDOUT: %ImplicitAs.facet.b94: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  1158. // CHECK:STDOUT: %.863: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet.b94 [concrete]
  1159. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5e6: <bound method> = bound_method %int_2147483647.d89, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  1160. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.709: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  1161. // CHECK:STDOUT: %bound_method.076: <bound method> = bound_method %int_2147483647.d89, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.709 [concrete]
  1162. // CHECK:STDOUT: %int_2147483647.a74: %i32 = int_value 2147483647 [concrete]
  1163. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  1164. // CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [concrete]
  1165. // CHECK:STDOUT: %pattern_type.95b: type = pattern_type %i64 [concrete]
  1166. // CHECK:STDOUT: %int_2147483648.1db: Core.IntLiteral = int_value 2147483648 [concrete]
  1167. // CHECK:STDOUT: %foo.type.a5abd1.2: type = fn_type @foo.2 [concrete]
  1168. // CHECK:STDOUT: %foo.23ea43.2: %foo.type.a5abd1.2 = struct_value () [concrete]
  1169. // CHECK:STDOUT: %ImplicitAs.type.2ad: type = facet_type <@ImplicitAs, @ImplicitAs(%i64)> [concrete]
  1170. // CHECK:STDOUT: %ImplicitAs.Convert.type.94e: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i64) [concrete]
  1171. // CHECK:STDOUT: %ImplicitAs.impl_witness.556: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  1172. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.b78: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  1173. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.57d: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.b78 = struct_value () [concrete]
  1174. // CHECK:STDOUT: %ImplicitAs.facet.d48: %ImplicitAs.type.2ad = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.556) [concrete]
  1175. // CHECK:STDOUT: %.567: type = fn_type_with_self_type %ImplicitAs.Convert.type.94e, %ImplicitAs.facet.d48 [concrete]
  1176. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a4: <bound method> = bound_method %int_2147483648.1db, %Core.IntLiteral.as.ImplicitAs.impl.Convert.57d [concrete]
  1177. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.57d, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_64) [concrete]
  1178. // CHECK:STDOUT: %bound_method.41d: <bound method> = bound_method %int_2147483648.1db, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7 [concrete]
  1179. // CHECK:STDOUT: %int_2147483648.e1f: %i64 = int_value 2147483648 [concrete]
  1180. // CHECK:STDOUT: %int_9223372036854775807.e6f: Core.IntLiteral = int_value 9223372036854775807 [concrete]
  1181. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6d9: <bound method> = bound_method %int_9223372036854775807.e6f, %Core.IntLiteral.as.ImplicitAs.impl.Convert.57d [concrete]
  1182. // CHECK:STDOUT: %bound_method.ef8: <bound method> = bound_method %int_9223372036854775807.e6f, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7 [concrete]
  1183. // CHECK:STDOUT: %int_9223372036854775807.9c2: %i64 = int_value 9223372036854775807 [concrete]
  1184. // CHECK:STDOUT: %int_128: Core.IntLiteral = int_value 128 [concrete]
  1185. // CHECK:STDOUT: %i128: type = class_type @Int, @Int(%int_128) [concrete]
  1186. // CHECK:STDOUT: %pattern_type.57d: type = pattern_type %i128 [concrete]
  1187. // CHECK:STDOUT: %int_9223372036854775808.293: Core.IntLiteral = int_value 9223372036854775808 [concrete]
  1188. // CHECK:STDOUT: %ptr.974: type = ptr_type %i128 [concrete]
  1189. // CHECK:STDOUT: %pattern_type.662: type = pattern_type %ptr.974 [concrete]
  1190. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  1191. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  1192. // CHECK:STDOUT: %ImplicitAs.type.e19: type = facet_type <@ImplicitAs, @ImplicitAs(%i128)> [concrete]
  1193. // CHECK:STDOUT: %ImplicitAs.Convert.type.812: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i128) [concrete]
  1194. // CHECK:STDOUT: %ImplicitAs.impl_witness.47a: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_128) [concrete]
  1195. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.74a: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_128) [concrete]
  1196. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.74a = struct_value () [concrete]
  1197. // CHECK:STDOUT: %ImplicitAs.facet.daa: %ImplicitAs.type.e19 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.47a) [concrete]
  1198. // CHECK:STDOUT: %.700: type = fn_type_with_self_type %ImplicitAs.Convert.type.812, %ImplicitAs.facet.daa [concrete]
  1199. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6a8: <bound method> = bound_method %int_9223372036854775808.293, %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a [concrete]
  1200. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_128) [concrete]
  1201. // CHECK:STDOUT: %bound_method.561: <bound method> = bound_method %int_9223372036854775808.293, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59 [concrete]
  1202. // CHECK:STDOUT: %int_9223372036854775808.f14: %i128 = int_value 9223372036854775808 [concrete]
  1203. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  1204. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  1205. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.824: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%N) [symbolic]
  1206. // CHECK:STDOUT: %Int.as.Copy.impl.Op.9b9: %Int.as.Copy.impl.Op.type.824 = struct_value () [symbolic]
  1207. // CHECK:STDOUT: %Copy.impl_witness.a35: <witness> = impl_witness imports.%Copy.impl_witness_table.e76, @Int.as.Copy.impl(%int_128) [concrete]
  1208. // CHECK:STDOUT: %Int.as.Copy.impl.Op.type.3b0: type = fn_type @Int.as.Copy.impl.Op, @Int.as.Copy.impl(%int_128) [concrete]
  1209. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bc1: %Int.as.Copy.impl.Op.type.3b0 = struct_value () [concrete]
  1210. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %i128, (%Copy.impl_witness.a35) [concrete]
  1211. // CHECK:STDOUT: %.80a: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  1212. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound.def: <bound method> = bound_method %int_9223372036854775808.f14, %Int.as.Copy.impl.Op.bc1 [concrete]
  1213. // CHECK:STDOUT: %Int.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Int.as.Copy.impl.Op.bc1, @Int.as.Copy.impl.Op(%int_128) [concrete]
  1214. // CHECK:STDOUT: %bound_method.b4e: <bound method> = bound_method %int_9223372036854775808.f14, %Int.as.Copy.impl.Op.specific_fn [concrete]
  1215. // CHECK:STDOUT: %int_18446744073709551615.5ec: Core.IntLiteral = int_value 18446744073709551615 [concrete]
  1216. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.9ac: <bound method> = bound_method %int_18446744073709551615.5ec, %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a [concrete]
  1217. // CHECK:STDOUT: %bound_method.422: <bound method> = bound_method %int_18446744073709551615.5ec, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59 [concrete]
  1218. // CHECK:STDOUT: %int_18446744073709551615.f56: %i128 = int_value 18446744073709551615 [concrete]
  1219. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound.cf0: <bound method> = bound_method %int_18446744073709551615.f56, %Int.as.Copy.impl.Op.bc1 [concrete]
  1220. // CHECK:STDOUT: %bound_method.2cb: <bound method> = bound_method %int_18446744073709551615.f56, %Int.as.Copy.impl.Op.specific_fn [concrete]
  1221. // CHECK:STDOUT: %int_18446744073709551616.1ee: Core.IntLiteral = int_value 18446744073709551616 [concrete]
  1222. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6a3: <bound method> = bound_method %int_18446744073709551616.1ee, %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a [concrete]
  1223. // CHECK:STDOUT: %bound_method.e31: <bound method> = bound_method %int_18446744073709551616.1ee, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59 [concrete]
  1224. // CHECK:STDOUT: %int_18446744073709551616.92b: %i128 = int_value 18446744073709551616 [concrete]
  1225. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound.bcd: <bound method> = bound_method %int_18446744073709551616.92b, %Int.as.Copy.impl.Op.bc1 [concrete]
  1226. // CHECK:STDOUT: %bound_method.6a9: <bound method> = bound_method %int_18446744073709551616.92b, %Int.as.Copy.impl.Op.specific_fn [concrete]
  1227. // CHECK:STDOUT: %int_170141183460469231731687303715884105727.fea: Core.IntLiteral = int_value 170141183460469231731687303715884105727 [concrete]
  1228. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e8: <bound method> = bound_method %int_170141183460469231731687303715884105727.fea, %Core.IntLiteral.as.ImplicitAs.impl.Convert.75a [concrete]
  1229. // CHECK:STDOUT: %bound_method.d00: <bound method> = bound_method %int_170141183460469231731687303715884105727.fea, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59 [concrete]
  1230. // CHECK:STDOUT: %int_170141183460469231731687303715884105727.ff5: %i128 = int_value 170141183460469231731687303715884105727 [concrete]
  1231. // CHECK:STDOUT: %Int.as.Copy.impl.Op.bound.78b: <bound method> = bound_method %int_170141183460469231731687303715884105727.ff5, %Int.as.Copy.impl.Op.bc1 [concrete]
  1232. // CHECK:STDOUT: %bound_method.2fb: <bound method> = bound_method %int_170141183460469231731687303715884105727.ff5, %Int.as.Copy.impl.Op.specific_fn [concrete]
  1233. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  1234. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  1235. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  1236. // CHECK:STDOUT: }
  1237. // CHECK:STDOUT:
  1238. // CHECK:STDOUT: imports {
  1239. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1240. // CHECK:STDOUT: .Int = %Core.Int
  1241. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1242. // CHECK:STDOUT: .Copy = %Core.Copy
  1243. // CHECK:STDOUT: .Destroy = %Core.Destroy
  1244. // CHECK:STDOUT: import Core//prelude
  1245. // CHECK:STDOUT: import Core//prelude/...
  1246. // CHECK:STDOUT: }
  1247. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1248. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1249. // CHECK:STDOUT: import Cpp//...
  1250. // CHECK:STDOUT: }
  1251. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  1252. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1253. // CHECK:STDOUT: %foo.decl.bd967b.1: %foo.type.a5abd1.1 = fn_decl @foo.1 [concrete = constants.%foo.23ea43.1] {
  1254. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  1255. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  1256. // CHECK:STDOUT: %return.patt: %pattern_type.7ce = return_slot_pattern [concrete]
  1257. // CHECK:STDOUT: %return.param_patt: %pattern_type.7ce = out_param_pattern %return.patt, call_param1 [concrete]
  1258. // CHECK:STDOUT: } {
  1259. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1260. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1261. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  1262. // CHECK:STDOUT: %.1: type = splice_block %i32.2 [concrete = constants.%i32] {
  1263. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1264. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1265. // CHECK:STDOUT: }
  1266. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  1267. // CHECK:STDOUT: %return.param: ref %i32 = out_param call_param1
  1268. // CHECK:STDOUT: %return: ref %i32 = return_slot %return.param
  1269. // CHECK:STDOUT: }
  1270. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1271. // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
  1272. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  1273. // CHECK:STDOUT: %foo.decl.bd967b.2: %foo.type.a5abd1.2 = fn_decl @foo.2 [concrete = constants.%foo.23ea43.2] {
  1274. // CHECK:STDOUT: %a.patt: %pattern_type.95b = value_binding_pattern a [concrete]
  1275. // CHECK:STDOUT: %a.param_patt: %pattern_type.95b = value_param_pattern %a.patt, call_param0 [concrete]
  1276. // CHECK:STDOUT: %return.patt: %pattern_type.95b = return_slot_pattern [concrete]
  1277. // CHECK:STDOUT: %return.param_patt: %pattern_type.95b = out_param_pattern %return.patt, call_param1 [concrete]
  1278. // CHECK:STDOUT: } {
  1279. // CHECK:STDOUT: %int_64.1: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1280. // CHECK:STDOUT: %i64.1: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1281. // CHECK:STDOUT: %a.param: %i64 = value_param call_param0
  1282. // CHECK:STDOUT: %.1: type = splice_block %i64.2 [concrete = constants.%i64] {
  1283. // CHECK:STDOUT: %int_64.2: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1284. // CHECK:STDOUT: %i64.2: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1285. // CHECK:STDOUT: }
  1286. // CHECK:STDOUT: %a: %i64 = value_binding a, %a.param
  1287. // CHECK:STDOUT: %return.param: ref %i64 = out_param call_param1
  1288. // CHECK:STDOUT: %return: ref %i64 = return_slot %return.param
  1289. // CHECK:STDOUT: }
  1290. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  1291. // CHECK:STDOUT: %a.patt: %pattern_type.662 = value_binding_pattern a [concrete]
  1292. // CHECK:STDOUT: %a.param_patt: %pattern_type.662 = value_param_pattern %a.patt, call_param0 [concrete]
  1293. // CHECK:STDOUT: %return.patt: %pattern_type.662 = value_binding_pattern r#return [concrete]
  1294. // CHECK:STDOUT: %return.param_patt: %pattern_type.662 = value_param_pattern %return.patt, call_param1 [concrete]
  1295. // CHECK:STDOUT: } {
  1296. // CHECK:STDOUT: %a.param: %ptr.974 = value_param call_param0
  1297. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr.974 [concrete = constants.%ptr.974] {
  1298. // CHECK:STDOUT: %int_128.2: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1299. // CHECK:STDOUT: %i128.2: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1300. // CHECK:STDOUT: }
  1301. // CHECK:STDOUT: %a: %ptr.974 = value_binding a, %a.param
  1302. // CHECK:STDOUT: %return.param: %ptr.974 = value_param call_param1
  1303. // CHECK:STDOUT: %.2: type = splice_block constants.%ptr.974 [concrete = constants.%ptr.974] {
  1304. // CHECK:STDOUT: %int_128.1: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1305. // CHECK:STDOUT: %i128.1: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1306. // CHECK:STDOUT: }
  1307. // CHECK:STDOUT: %return: %ptr.974 = value_binding r#return, %return.param
  1308. // CHECK:STDOUT: }
  1309. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  1310. // CHECK:STDOUT: %Core.import_ref.18d: @Int.as.Copy.impl.%Int.as.Copy.impl.Op.type (%Int.as.Copy.impl.Op.type.824) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Int.as.Copy.impl.%Int.as.Copy.impl.Op (constants.%Int.as.Copy.impl.Op.9b9)]
  1311. // CHECK:STDOUT: %Copy.impl_witness_table.e76 = impl_witness_table (%Core.import_ref.18d), @Int.as.Copy.impl [concrete]
  1312. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  1313. // CHECK:STDOUT: }
  1314. // CHECK:STDOUT:
  1315. // CHECK:STDOUT: file {
  1316. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1317. // CHECK:STDOUT: .Core = imports.%Core
  1318. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1319. // CHECK:STDOUT: .F = %F.decl
  1320. // CHECK:STDOUT: }
  1321. // CHECK:STDOUT: %Core.import = import Core
  1322. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1323. // CHECK:STDOUT: import Cpp "int_literal.h"
  1324. // CHECK:STDOUT: }
  1325. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1326. // CHECK:STDOUT: }
  1327. // CHECK:STDOUT:
  1328. // CHECK:STDOUT: fn @F() {
  1329. // CHECK:STDOUT: !entry:
  1330. // CHECK:STDOUT: name_binding_decl {
  1331. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  1332. // CHECK:STDOUT: }
  1333. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1334. // CHECK:STDOUT: %foo.ref.loc8: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1335. // CHECK:STDOUT: %int_2147483647: Core.IntLiteral = int_value 2147483647 [concrete = constants.%int_2147483647.d89]
  1336. // CHECK:STDOUT: %impl.elem0.loc8: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  1337. // CHECK:STDOUT: %bound_method.loc8_24.1: <bound method> = bound_method %int_2147483647, %impl.elem0.loc8 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.5e6]
  1338. // CHECK:STDOUT: %specific_fn.loc8: <specific function> = specific_function %impl.elem0.loc8, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.709]
  1339. // CHECK:STDOUT: %bound_method.loc8_24.2: <bound method> = bound_method %int_2147483647, %specific_fn.loc8 [concrete = constants.%bound_method.076]
  1340. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8: init %i32 = call %bound_method.loc8_24.2(%int_2147483647) [concrete = constants.%int_2147483647.a74]
  1341. // CHECK:STDOUT: %.loc8_24.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc8 [concrete = constants.%int_2147483647.a74]
  1342. // CHECK:STDOUT: %.loc8_24.2: %i32 = converted %int_2147483647, %.loc8_24.1 [concrete = constants.%int_2147483647.a74]
  1343. // CHECK:STDOUT: %foo.call.loc8: init %i32 = call imports.%foo.decl.bd967b.1(%.loc8_24.2)
  1344. // CHECK:STDOUT: %.loc8_10: type = splice_block %i32 [concrete = constants.%i32] {
  1345. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1346. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1347. // CHECK:STDOUT: }
  1348. // CHECK:STDOUT: %.loc8_34.1: %i32 = value_of_initializer %foo.call.loc8
  1349. // CHECK:STDOUT: %.loc8_34.2: %i32 = converted %foo.call.loc8, %.loc8_34.1
  1350. // CHECK:STDOUT: %a: %i32 = value_binding a, %.loc8_34.2
  1351. // CHECK:STDOUT: name_binding_decl {
  1352. // CHECK:STDOUT: %b.patt: %pattern_type.95b = value_binding_pattern b [concrete]
  1353. // CHECK:STDOUT: }
  1354. // CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1355. // CHECK:STDOUT: %foo.ref.loc13: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1356. // CHECK:STDOUT: %int_2147483648.loc13: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
  1357. // CHECK:STDOUT: %impl.elem0.loc13: %.567 = impl_witness_access constants.%ImplicitAs.impl_witness.556, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.57d]
  1358. // CHECK:STDOUT: %bound_method.loc13_24.1: <bound method> = bound_method %int_2147483648.loc13, %impl.elem0.loc13 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a4]
  1359. // CHECK:STDOUT: %specific_fn.loc13: <specific function> = specific_function %impl.elem0.loc13, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7]
  1360. // CHECK:STDOUT: %bound_method.loc13_24.2: <bound method> = bound_method %int_2147483648.loc13, %specific_fn.loc13 [concrete = constants.%bound_method.41d]
  1361. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13: init %i64 = call %bound_method.loc13_24.2(%int_2147483648.loc13) [concrete = constants.%int_2147483648.e1f]
  1362. // CHECK:STDOUT: %.loc13_24.1: %i64 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc13 [concrete = constants.%int_2147483648.e1f]
  1363. // CHECK:STDOUT: %.loc13_24.2: %i64 = converted %int_2147483648.loc13, %.loc13_24.1 [concrete = constants.%int_2147483648.e1f]
  1364. // CHECK:STDOUT: %foo.call.loc13: init %i64 = call imports.%foo.decl.bd967b.2(%.loc13_24.2)
  1365. // CHECK:STDOUT: %.loc13_10: type = splice_block %i64.loc13 [concrete = constants.%i64] {
  1366. // CHECK:STDOUT: %int_64.loc13: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1367. // CHECK:STDOUT: %i64.loc13: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1368. // CHECK:STDOUT: }
  1369. // CHECK:STDOUT: %.loc13_34.1: %i64 = value_of_initializer %foo.call.loc13
  1370. // CHECK:STDOUT: %.loc13_34.2: %i64 = converted %foo.call.loc13, %.loc13_34.1
  1371. // CHECK:STDOUT: %b: %i64 = value_binding b, %.loc13_34.2
  1372. // CHECK:STDOUT: name_binding_decl {
  1373. // CHECK:STDOUT: %b_hexa.patt: %pattern_type.95b = value_binding_pattern b_hexa [concrete]
  1374. // CHECK:STDOUT: }
  1375. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1376. // CHECK:STDOUT: %foo.ref.loc14: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1377. // CHECK:STDOUT: %int_2147483648.loc14: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
  1378. // CHECK:STDOUT: %impl.elem0.loc14: %.567 = impl_witness_access constants.%ImplicitAs.impl_witness.556, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.57d]
  1379. // CHECK:STDOUT: %bound_method.loc14_29.1: <bound method> = bound_method %int_2147483648.loc14, %impl.elem0.loc14 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a4]
  1380. // CHECK:STDOUT: %specific_fn.loc14: <specific function> = specific_function %impl.elem0.loc14, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7]
  1381. // CHECK:STDOUT: %bound_method.loc14_29.2: <bound method> = bound_method %int_2147483648.loc14, %specific_fn.loc14 [concrete = constants.%bound_method.41d]
  1382. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14: init %i64 = call %bound_method.loc14_29.2(%int_2147483648.loc14) [concrete = constants.%int_2147483648.e1f]
  1383. // CHECK:STDOUT: %.loc14_29.1: %i64 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc14 [concrete = constants.%int_2147483648.e1f]
  1384. // CHECK:STDOUT: %.loc14_29.2: %i64 = converted %int_2147483648.loc14, %.loc14_29.1 [concrete = constants.%int_2147483648.e1f]
  1385. // CHECK:STDOUT: %foo.call.loc14: init %i64 = call imports.%foo.decl.bd967b.2(%.loc14_29.2)
  1386. // CHECK:STDOUT: %.loc14_15: type = splice_block %i64.loc14 [concrete = constants.%i64] {
  1387. // CHECK:STDOUT: %int_64.loc14: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1388. // CHECK:STDOUT: %i64.loc14: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1389. // CHECK:STDOUT: }
  1390. // CHECK:STDOUT: %.loc14_40.1: %i64 = value_of_initializer %foo.call.loc14
  1391. // CHECK:STDOUT: %.loc14_40.2: %i64 = converted %foo.call.loc14, %.loc14_40.1
  1392. // CHECK:STDOUT: %b_hexa: %i64 = value_binding b_hexa, %.loc14_40.2
  1393. // CHECK:STDOUT: name_binding_decl {
  1394. // CHECK:STDOUT: %b_binary.patt: %pattern_type.95b = value_binding_pattern b_binary [concrete]
  1395. // CHECK:STDOUT: }
  1396. // CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1397. // CHECK:STDOUT: %foo.ref.loc15: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1398. // CHECK:STDOUT: %int_2147483648.loc15: Core.IntLiteral = int_value 2147483648 [concrete = constants.%int_2147483648.1db]
  1399. // CHECK:STDOUT: %impl.elem0.loc15: %.567 = impl_witness_access constants.%ImplicitAs.impl_witness.556, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.57d]
  1400. // CHECK:STDOUT: %bound_method.loc15_31.1: <bound method> = bound_method %int_2147483648.loc15, %impl.elem0.loc15 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8a4]
  1401. // CHECK:STDOUT: %specific_fn.loc15: <specific function> = specific_function %impl.elem0.loc15, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7]
  1402. // CHECK:STDOUT: %bound_method.loc15_31.2: <bound method> = bound_method %int_2147483648.loc15, %specific_fn.loc15 [concrete = constants.%bound_method.41d]
  1403. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15: init %i64 = call %bound_method.loc15_31.2(%int_2147483648.loc15) [concrete = constants.%int_2147483648.e1f]
  1404. // CHECK:STDOUT: %.loc15_31.1: %i64 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc15 [concrete = constants.%int_2147483648.e1f]
  1405. // CHECK:STDOUT: %.loc15_31.2: %i64 = converted %int_2147483648.loc15, %.loc15_31.1 [concrete = constants.%int_2147483648.e1f]
  1406. // CHECK:STDOUT: %foo.call.loc15: init %i64 = call imports.%foo.decl.bd967b.2(%.loc15_31.2)
  1407. // CHECK:STDOUT: %.loc15_17: type = splice_block %i64.loc15 [concrete = constants.%i64] {
  1408. // CHECK:STDOUT: %int_64.loc15: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1409. // CHECK:STDOUT: %i64.loc15: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1410. // CHECK:STDOUT: }
  1411. // CHECK:STDOUT: %.loc15_72.1: %i64 = value_of_initializer %foo.call.loc15
  1412. // CHECK:STDOUT: %.loc15_72.2: %i64 = converted %foo.call.loc15, %.loc15_72.1
  1413. // CHECK:STDOUT: %b_binary: %i64 = value_binding b_binary, %.loc15_72.2
  1414. // CHECK:STDOUT: name_binding_decl {
  1415. // CHECK:STDOUT: %c.patt: %pattern_type.95b = value_binding_pattern c [concrete]
  1416. // CHECK:STDOUT: }
  1417. // CHECK:STDOUT: %Cpp.ref.loc18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1418. // CHECK:STDOUT: %foo.ref.loc18: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1419. // CHECK:STDOUT: %int_9223372036854775807: Core.IntLiteral = int_value 9223372036854775807 [concrete = constants.%int_9223372036854775807.e6f]
  1420. // CHECK:STDOUT: %impl.elem0.loc18: %.567 = impl_witness_access constants.%ImplicitAs.impl_witness.556, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.57d]
  1421. // CHECK:STDOUT: %bound_method.loc18_24.1: <bound method> = bound_method %int_9223372036854775807, %impl.elem0.loc18 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6d9]
  1422. // CHECK:STDOUT: %specific_fn.loc18: <specific function> = specific_function %impl.elem0.loc18, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.8d7]
  1423. // CHECK:STDOUT: %bound_method.loc18_24.2: <bound method> = bound_method %int_9223372036854775807, %specific_fn.loc18 [concrete = constants.%bound_method.ef8]
  1424. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18: init %i64 = call %bound_method.loc18_24.2(%int_9223372036854775807) [concrete = constants.%int_9223372036854775807.9c2]
  1425. // CHECK:STDOUT: %.loc18_24.1: %i64 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc18 [concrete = constants.%int_9223372036854775807.9c2]
  1426. // CHECK:STDOUT: %.loc18_24.2: %i64 = converted %int_9223372036854775807, %.loc18_24.1 [concrete = constants.%int_9223372036854775807.9c2]
  1427. // CHECK:STDOUT: %foo.call.loc18: init %i64 = call imports.%foo.decl.bd967b.2(%.loc18_24.2)
  1428. // CHECK:STDOUT: %.loc18_10: type = splice_block %i64.loc18 [concrete = constants.%i64] {
  1429. // CHECK:STDOUT: %int_64.loc18: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1430. // CHECK:STDOUT: %i64.loc18: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  1431. // CHECK:STDOUT: }
  1432. // CHECK:STDOUT: %.loc18_43.1: %i64 = value_of_initializer %foo.call.loc18
  1433. // CHECK:STDOUT: %.loc18_43.2: %i64 = converted %foo.call.loc18, %.loc18_43.1
  1434. // CHECK:STDOUT: %c: %i64 = value_binding c, %.loc18_43.2
  1435. // CHECK:STDOUT: name_binding_decl {
  1436. // CHECK:STDOUT: %d.patt: %pattern_type.57d = value_binding_pattern d [concrete]
  1437. // CHECK:STDOUT: }
  1438. // CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1439. // CHECK:STDOUT: %foo.ref.loc22: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1440. // CHECK:STDOUT: %int_9223372036854775808: Core.IntLiteral = int_value 9223372036854775808 [concrete = constants.%int_9223372036854775808.293]
  1441. // CHECK:STDOUT: %impl.elem0.loc22_25.1: %.700 = impl_witness_access constants.%ImplicitAs.impl_witness.47a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.75a]
  1442. // CHECK:STDOUT: %bound_method.loc22_25.1: <bound method> = bound_method %int_9223372036854775808, %impl.elem0.loc22_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6a8]
  1443. // CHECK:STDOUT: %specific_fn.loc22_25.1: <specific function> = specific_function %impl.elem0.loc22_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_128) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59]
  1444. // CHECK:STDOUT: %bound_method.loc22_25.2: <bound method> = bound_method %int_9223372036854775808, %specific_fn.loc22_25.1 [concrete = constants.%bound_method.561]
  1445. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22: init %i128 = call %bound_method.loc22_25.2(%int_9223372036854775808) [concrete = constants.%int_9223372036854775808.f14]
  1446. // CHECK:STDOUT: %.loc22_25.1: %i128 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22 [concrete = constants.%int_9223372036854775808.f14]
  1447. // CHECK:STDOUT: %.loc22_25.2: %i128 = converted %int_9223372036854775808, %.loc22_25.1 [concrete = constants.%int_9223372036854775808.f14]
  1448. // CHECK:STDOUT: %.loc22_25.3: ref %i128 = temporary_storage
  1449. // CHECK:STDOUT: %impl.elem0.loc22_25.2: %.80a = impl_witness_access constants.%Copy.impl_witness.a35, element0 [concrete = constants.%Int.as.Copy.impl.Op.bc1]
  1450. // CHECK:STDOUT: %bound_method.loc22_25.3: <bound method> = bound_method %.loc22_25.2, %impl.elem0.loc22_25.2 [concrete = constants.%Int.as.Copy.impl.Op.bound.def]
  1451. // CHECK:STDOUT: %specific_fn.loc22_25.2: <specific function> = specific_function %impl.elem0.loc22_25.2, @Int.as.Copy.impl.Op(constants.%int_128) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1452. // CHECK:STDOUT: %bound_method.loc22_25.4: <bound method> = bound_method %.loc22_25.2, %specific_fn.loc22_25.2 [concrete = constants.%bound_method.b4e]
  1453. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc22: init %i128 = call %bound_method.loc22_25.4(%.loc22_25.2) [concrete = constants.%int_9223372036854775808.f14]
  1454. // CHECK:STDOUT: %.loc22_25.4: ref %i128 = temporary %.loc22_25.3, %Int.as.Copy.impl.Op.call.loc22
  1455. // CHECK:STDOUT: %addr.loc22_44.1: %ptr.974 = addr_of %.loc22_25.4
  1456. // CHECK:STDOUT: %.loc22_44.1: ref %i128 = temporary_storage
  1457. // CHECK:STDOUT: %addr.loc22_44.2: %ptr.974 = addr_of %.loc22_44.1
  1458. // CHECK:STDOUT: %foo__carbon_thunk.call.loc22: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc22_44.1, %addr.loc22_44.2)
  1459. // CHECK:STDOUT: %.loc22_44.2: init %i128 = in_place_init %foo__carbon_thunk.call.loc22, %.loc22_44.1
  1460. // CHECK:STDOUT: %.loc22_10: type = splice_block %i128.loc22 [concrete = constants.%i128] {
  1461. // CHECK:STDOUT: %int_128.loc22: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1462. // CHECK:STDOUT: %i128.loc22: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1463. // CHECK:STDOUT: }
  1464. // CHECK:STDOUT: %.loc22_44.3: %i128 = value_of_initializer %.loc22_44.2
  1465. // CHECK:STDOUT: %.loc22_44.4: %i128 = converted %.loc22_44.2, %.loc22_44.3
  1466. // CHECK:STDOUT: %d: %i128 = value_binding d, %.loc22_44.4
  1467. // CHECK:STDOUT: name_binding_decl {
  1468. // CHECK:STDOUT: %e.patt: %pattern_type.57d = value_binding_pattern e [concrete]
  1469. // CHECK:STDOUT: }
  1470. // CHECK:STDOUT: %Cpp.ref.loc25: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1471. // CHECK:STDOUT: %foo.ref.loc25: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1472. // CHECK:STDOUT: %int_18446744073709551615: Core.IntLiteral = int_value 18446744073709551615 [concrete = constants.%int_18446744073709551615.5ec]
  1473. // CHECK:STDOUT: %impl.elem0.loc25_25.1: %.700 = impl_witness_access constants.%ImplicitAs.impl_witness.47a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.75a]
  1474. // CHECK:STDOUT: %bound_method.loc25_25.1: <bound method> = bound_method %int_18446744073709551615, %impl.elem0.loc25_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.9ac]
  1475. // CHECK:STDOUT: %specific_fn.loc25_25.1: <specific function> = specific_function %impl.elem0.loc25_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_128) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59]
  1476. // CHECK:STDOUT: %bound_method.loc25_25.2: <bound method> = bound_method %int_18446744073709551615, %specific_fn.loc25_25.1 [concrete = constants.%bound_method.422]
  1477. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25: init %i128 = call %bound_method.loc25_25.2(%int_18446744073709551615) [concrete = constants.%int_18446744073709551615.f56]
  1478. // CHECK:STDOUT: %.loc25_25.1: %i128 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc25 [concrete = constants.%int_18446744073709551615.f56]
  1479. // CHECK:STDOUT: %.loc25_25.2: %i128 = converted %int_18446744073709551615, %.loc25_25.1 [concrete = constants.%int_18446744073709551615.f56]
  1480. // CHECK:STDOUT: %.loc25_25.3: ref %i128 = temporary_storage
  1481. // CHECK:STDOUT: %impl.elem0.loc25_25.2: %.80a = impl_witness_access constants.%Copy.impl_witness.a35, element0 [concrete = constants.%Int.as.Copy.impl.Op.bc1]
  1482. // CHECK:STDOUT: %bound_method.loc25_25.3: <bound method> = bound_method %.loc25_25.2, %impl.elem0.loc25_25.2 [concrete = constants.%Int.as.Copy.impl.Op.bound.cf0]
  1483. // CHECK:STDOUT: %specific_fn.loc25_25.2: <specific function> = specific_function %impl.elem0.loc25_25.2, @Int.as.Copy.impl.Op(constants.%int_128) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1484. // CHECK:STDOUT: %bound_method.loc25_25.4: <bound method> = bound_method %.loc25_25.2, %specific_fn.loc25_25.2 [concrete = constants.%bound_method.2cb]
  1485. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc25: init %i128 = call %bound_method.loc25_25.4(%.loc25_25.2) [concrete = constants.%int_18446744073709551615.f56]
  1486. // CHECK:STDOUT: %.loc25_25.4: ref %i128 = temporary %.loc25_25.3, %Int.as.Copy.impl.Op.call.loc25
  1487. // CHECK:STDOUT: %addr.loc25_45.1: %ptr.974 = addr_of %.loc25_25.4
  1488. // CHECK:STDOUT: %.loc25_45.1: ref %i128 = temporary_storage
  1489. // CHECK:STDOUT: %addr.loc25_45.2: %ptr.974 = addr_of %.loc25_45.1
  1490. // CHECK:STDOUT: %foo__carbon_thunk.call.loc25: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc25_45.1, %addr.loc25_45.2)
  1491. // CHECK:STDOUT: %.loc25_45.2: init %i128 = in_place_init %foo__carbon_thunk.call.loc25, %.loc25_45.1
  1492. // CHECK:STDOUT: %.loc25_10: type = splice_block %i128.loc25 [concrete = constants.%i128] {
  1493. // CHECK:STDOUT: %int_128.loc25: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1494. // CHECK:STDOUT: %i128.loc25: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1495. // CHECK:STDOUT: }
  1496. // CHECK:STDOUT: %.loc25_45.3: %i128 = value_of_initializer %.loc25_45.2
  1497. // CHECK:STDOUT: %.loc25_45.4: %i128 = converted %.loc25_45.2, %.loc25_45.3
  1498. // CHECK:STDOUT: %e: %i128 = value_binding e, %.loc25_45.4
  1499. // CHECK:STDOUT: name_binding_decl {
  1500. // CHECK:STDOUT: %f.patt: %pattern_type.57d = value_binding_pattern f [concrete]
  1501. // CHECK:STDOUT: }
  1502. // CHECK:STDOUT: %Cpp.ref.loc28: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1503. // CHECK:STDOUT: %foo.ref.loc28: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1504. // CHECK:STDOUT: %int_18446744073709551616: Core.IntLiteral = int_value 18446744073709551616 [concrete = constants.%int_18446744073709551616.1ee]
  1505. // CHECK:STDOUT: %impl.elem0.loc28_25.1: %.700 = impl_witness_access constants.%ImplicitAs.impl_witness.47a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.75a]
  1506. // CHECK:STDOUT: %bound_method.loc28_25.1: <bound method> = bound_method %int_18446744073709551616, %impl.elem0.loc28_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.6a3]
  1507. // CHECK:STDOUT: %specific_fn.loc28_25.1: <specific function> = specific_function %impl.elem0.loc28_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_128) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59]
  1508. // CHECK:STDOUT: %bound_method.loc28_25.2: <bound method> = bound_method %int_18446744073709551616, %specific_fn.loc28_25.1 [concrete = constants.%bound_method.e31]
  1509. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28: init %i128 = call %bound_method.loc28_25.2(%int_18446744073709551616) [concrete = constants.%int_18446744073709551616.92b]
  1510. // CHECK:STDOUT: %.loc28_25.1: %i128 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc28 [concrete = constants.%int_18446744073709551616.92b]
  1511. // CHECK:STDOUT: %.loc28_25.2: %i128 = converted %int_18446744073709551616, %.loc28_25.1 [concrete = constants.%int_18446744073709551616.92b]
  1512. // CHECK:STDOUT: %.loc28_25.3: ref %i128 = temporary_storage
  1513. // CHECK:STDOUT: %impl.elem0.loc28_25.2: %.80a = impl_witness_access constants.%Copy.impl_witness.a35, element0 [concrete = constants.%Int.as.Copy.impl.Op.bc1]
  1514. // CHECK:STDOUT: %bound_method.loc28_25.3: <bound method> = bound_method %.loc28_25.2, %impl.elem0.loc28_25.2 [concrete = constants.%Int.as.Copy.impl.Op.bound.bcd]
  1515. // CHECK:STDOUT: %specific_fn.loc28_25.2: <specific function> = specific_function %impl.elem0.loc28_25.2, @Int.as.Copy.impl.Op(constants.%int_128) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1516. // CHECK:STDOUT: %bound_method.loc28_25.4: <bound method> = bound_method %.loc28_25.2, %specific_fn.loc28_25.2 [concrete = constants.%bound_method.6a9]
  1517. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc28: init %i128 = call %bound_method.loc28_25.4(%.loc28_25.2) [concrete = constants.%int_18446744073709551616.92b]
  1518. // CHECK:STDOUT: %.loc28_25.4: ref %i128 = temporary %.loc28_25.3, %Int.as.Copy.impl.Op.call.loc28
  1519. // CHECK:STDOUT: %addr.loc28_45.1: %ptr.974 = addr_of %.loc28_25.4
  1520. // CHECK:STDOUT: %.loc28_45.1: ref %i128 = temporary_storage
  1521. // CHECK:STDOUT: %addr.loc28_45.2: %ptr.974 = addr_of %.loc28_45.1
  1522. // CHECK:STDOUT: %foo__carbon_thunk.call.loc28: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc28_45.1, %addr.loc28_45.2)
  1523. // CHECK:STDOUT: %.loc28_45.2: init %i128 = in_place_init %foo__carbon_thunk.call.loc28, %.loc28_45.1
  1524. // CHECK:STDOUT: %.loc28_10: type = splice_block %i128.loc28 [concrete = constants.%i128] {
  1525. // CHECK:STDOUT: %int_128.loc28: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1526. // CHECK:STDOUT: %i128.loc28: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1527. // CHECK:STDOUT: }
  1528. // CHECK:STDOUT: %.loc28_45.3: %i128 = value_of_initializer %.loc28_45.2
  1529. // CHECK:STDOUT: %.loc28_45.4: %i128 = converted %.loc28_45.2, %.loc28_45.3
  1530. // CHECK:STDOUT: %f: %i128 = value_binding f, %.loc28_45.4
  1531. // CHECK:STDOUT: name_binding_decl {
  1532. // CHECK:STDOUT: %g.patt: %pattern_type.57d = value_binding_pattern g [concrete]
  1533. // CHECK:STDOUT: }
  1534. // CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1535. // CHECK:STDOUT: %foo.ref.loc31: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1536. // CHECK:STDOUT: %int_170141183460469231731687303715884105727: Core.IntLiteral = int_value 170141183460469231731687303715884105727 [concrete = constants.%int_170141183460469231731687303715884105727.fea]
  1537. // CHECK:STDOUT: %impl.elem0.loc31_25.1: %.700 = impl_witness_access constants.%ImplicitAs.impl_witness.47a, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.75a]
  1538. // CHECK:STDOUT: %bound_method.loc31_25.1: <bound method> = bound_method %int_170141183460469231731687303715884105727, %impl.elem0.loc31_25.1 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.8e8]
  1539. // CHECK:STDOUT: %specific_fn.loc31_25.1: <specific function> = specific_function %impl.elem0.loc31_25.1, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_128) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn.e59]
  1540. // CHECK:STDOUT: %bound_method.loc31_25.2: <bound method> = bound_method %int_170141183460469231731687303715884105727, %specific_fn.loc31_25.1 [concrete = constants.%bound_method.d00]
  1541. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31: init %i128 = call %bound_method.loc31_25.2(%int_170141183460469231731687303715884105727) [concrete = constants.%int_170141183460469231731687303715884105727.ff5]
  1542. // CHECK:STDOUT: %.loc31_25.1: %i128 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc31 [concrete = constants.%int_170141183460469231731687303715884105727.ff5]
  1543. // CHECK:STDOUT: %.loc31_25.2: %i128 = converted %int_170141183460469231731687303715884105727, %.loc31_25.1 [concrete = constants.%int_170141183460469231731687303715884105727.ff5]
  1544. // CHECK:STDOUT: %.loc31_25.3: ref %i128 = temporary_storage
  1545. // CHECK:STDOUT: %impl.elem0.loc31_25.2: %.80a = impl_witness_access constants.%Copy.impl_witness.a35, element0 [concrete = constants.%Int.as.Copy.impl.Op.bc1]
  1546. // CHECK:STDOUT: %bound_method.loc31_25.3: <bound method> = bound_method %.loc31_25.2, %impl.elem0.loc31_25.2 [concrete = constants.%Int.as.Copy.impl.Op.bound.78b]
  1547. // CHECK:STDOUT: %specific_fn.loc31_25.2: <specific function> = specific_function %impl.elem0.loc31_25.2, @Int.as.Copy.impl.Op(constants.%int_128) [concrete = constants.%Int.as.Copy.impl.Op.specific_fn]
  1548. // CHECK:STDOUT: %bound_method.loc31_25.4: <bound method> = bound_method %.loc31_25.2, %specific_fn.loc31_25.2 [concrete = constants.%bound_method.2fb]
  1549. // CHECK:STDOUT: %Int.as.Copy.impl.Op.call.loc31: init %i128 = call %bound_method.loc31_25.4(%.loc31_25.2) [concrete = constants.%int_170141183460469231731687303715884105727.ff5]
  1550. // CHECK:STDOUT: %.loc31_25.4: ref %i128 = temporary %.loc31_25.3, %Int.as.Copy.impl.Op.call.loc31
  1551. // CHECK:STDOUT: %addr.loc31_64.1: %ptr.974 = addr_of %.loc31_25.4
  1552. // CHECK:STDOUT: %.loc31_64.1: ref %i128 = temporary_storage
  1553. // CHECK:STDOUT: %addr.loc31_64.2: %ptr.974 = addr_of %.loc31_64.1
  1554. // CHECK:STDOUT: %foo__carbon_thunk.call.loc31: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc31_64.1, %addr.loc31_64.2)
  1555. // CHECK:STDOUT: %.loc31_64.2: init %i128 = in_place_init %foo__carbon_thunk.call.loc31, %.loc31_64.1
  1556. // CHECK:STDOUT: %.loc31_10: type = splice_block %i128.loc31 [concrete = constants.%i128] {
  1557. // CHECK:STDOUT: %int_128.loc31: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1558. // CHECK:STDOUT: %i128.loc31: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1559. // CHECK:STDOUT: }
  1560. // CHECK:STDOUT: %.loc31_64.3: %i128 = value_of_initializer %.loc31_64.2
  1561. // CHECK:STDOUT: %.loc31_64.4: %i128 = converted %.loc31_64.2, %.loc31_64.3
  1562. // CHECK:STDOUT: %g: %i128 = value_binding g, %.loc31_64.4
  1563. // CHECK:STDOUT: %DestroyOp.bound.loc31: <bound method> = bound_method %.loc31_25.4, constants.%DestroyOp
  1564. // CHECK:STDOUT: %DestroyOp.call.loc31: init %empty_tuple.type = call %DestroyOp.bound.loc31(%.loc31_25.4)
  1565. // CHECK:STDOUT: %DestroyOp.bound.loc28: <bound method> = bound_method %.loc28_25.4, constants.%DestroyOp
  1566. // CHECK:STDOUT: %DestroyOp.call.loc28: init %empty_tuple.type = call %DestroyOp.bound.loc28(%.loc28_25.4)
  1567. // CHECK:STDOUT: %DestroyOp.bound.loc25: <bound method> = bound_method %.loc25_25.4, constants.%DestroyOp
  1568. // CHECK:STDOUT: %DestroyOp.call.loc25: init %empty_tuple.type = call %DestroyOp.bound.loc25(%.loc25_25.4)
  1569. // CHECK:STDOUT: %DestroyOp.bound.loc22: <bound method> = bound_method %.loc22_25.4, constants.%DestroyOp
  1570. // CHECK:STDOUT: %DestroyOp.call.loc22: init %empty_tuple.type = call %DestroyOp.bound.loc22(%.loc22_25.4)
  1571. // CHECK:STDOUT: return
  1572. // CHECK:STDOUT: }
  1573. // CHECK:STDOUT:
  1574. // CHECK:STDOUT: fn @foo.1(%a.param: %i32) -> out %return.param: %i32;
  1575. // CHECK:STDOUT:
  1576. // CHECK:STDOUT: fn @foo.2(%a.param: %i64) -> out %return.param: %i64;
  1577. // CHECK:STDOUT:
  1578. // CHECK:STDOUT: fn @foo.3(%a.param: %i128) -> out %return.param: %i128;
  1579. // CHECK:STDOUT:
  1580. // CHECK:STDOUT: fn @foo__carbon_thunk(%a.param: %ptr.974, %return.param: %ptr.974);
  1581. // CHECK:STDOUT:
  1582. // CHECK:STDOUT: fn @DestroyOp(%self.param: %i128) = "no_op";
  1583. // CHECK:STDOUT:
  1584. // CHECK:STDOUT: --- fail_import_large_int_literal.carbon
  1585. // CHECK:STDOUT:
  1586. // CHECK:STDOUT: constants {
  1587. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1588. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1589. // CHECK:STDOUT: %int_128: Core.IntLiteral = int_value 128 [concrete]
  1590. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1591. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1592. // CHECK:STDOUT: %i128: type = class_type @Int, @Int(%int_128) [concrete]
  1593. // CHECK:STDOUT: %pattern_type.57d: type = pattern_type %i128 [concrete]
  1594. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1595. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1596. // CHECK:STDOUT: %int_170141183460469231731687303715884105728: Core.IntLiteral = int_value 170141183460469231731687303715884105728 [concrete]
  1597. // CHECK:STDOUT: }
  1598. // CHECK:STDOUT:
  1599. // CHECK:STDOUT: imports {
  1600. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1601. // CHECK:STDOUT: .Int = %Core.Int
  1602. // CHECK:STDOUT: import Core//prelude
  1603. // CHECK:STDOUT: import Core//prelude/...
  1604. // CHECK:STDOUT: }
  1605. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1606. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1607. // CHECK:STDOUT: import Cpp//...
  1608. // CHECK:STDOUT: }
  1609. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  1610. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1611. // CHECK:STDOUT: }
  1612. // CHECK:STDOUT:
  1613. // CHECK:STDOUT: file {
  1614. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1615. // CHECK:STDOUT: .Core = imports.%Core
  1616. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1617. // CHECK:STDOUT: .F = %F.decl
  1618. // CHECK:STDOUT: }
  1619. // CHECK:STDOUT: %Core.import = import Core
  1620. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1621. // CHECK:STDOUT: import Cpp "int_literal.h"
  1622. // CHECK:STDOUT: }
  1623. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1624. // CHECK:STDOUT: }
  1625. // CHECK:STDOUT:
  1626. // CHECK:STDOUT: fn @F() {
  1627. // CHECK:STDOUT: !entry:
  1628. // CHECK:STDOUT: name_binding_decl {
  1629. // CHECK:STDOUT: %h.patt: %pattern_type.57d = value_binding_pattern h [concrete]
  1630. // CHECK:STDOUT: }
  1631. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1632. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1633. // CHECK:STDOUT: %int_170141183460469231731687303715884105728: Core.IntLiteral = int_value 170141183460469231731687303715884105728 [concrete = constants.%int_170141183460469231731687303715884105728]
  1634. // CHECK:STDOUT: %.loc17: type = splice_block %i128 [concrete = constants.%i128] {
  1635. // CHECK:STDOUT: %int_128: Core.IntLiteral = int_value 128 [concrete = constants.%int_128]
  1636. // CHECK:STDOUT: %i128: type = class_type @Int, @Int(constants.%int_128) [concrete = constants.%i128]
  1637. // CHECK:STDOUT: }
  1638. // CHECK:STDOUT: %h: %i128 = value_binding h, <error> [concrete = <error>]
  1639. // CHECK:STDOUT: return
  1640. // CHECK:STDOUT: }
  1641. // CHECK:STDOUT:
  1642. // CHECK:STDOUT: --- import_negative_int_literal.carbon
  1643. // CHECK:STDOUT:
  1644. // CHECK:STDOUT: constants {
  1645. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1646. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1647. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1648. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1649. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1650. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  1651. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  1652. // CHECK:STDOUT: %Negate.Op.type: type = fn_type @Negate.Op [concrete]
  1653. // CHECK:STDOUT: %Negate.impl_witness: <witness> = impl_witness imports.%Negate.impl_witness_table [concrete]
  1654. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness) [concrete]
  1655. // CHECK:STDOUT: %.826: type = fn_type_with_self_type %Negate.Op.type, %Negate.facet [concrete]
  1656. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.type: type = fn_type @Core.IntLiteral.as.Negate.impl.Op [concrete]
  1657. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op: %Core.IntLiteral.as.Negate.impl.Op.type = struct_value () [concrete]
  1658. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.bound: <bound method> = bound_method %int_1, %Core.IntLiteral.as.Negate.impl.Op [concrete]
  1659. // CHECK:STDOUT: %int_-1.638: Core.IntLiteral = int_value -1 [concrete]
  1660. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1661. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  1662. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  1663. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  1664. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  1665. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1666. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1667. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1668. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1669. // CHECK:STDOUT: %ImplicitAs.type.e8c: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  1670. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  1671. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  1672. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  1673. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6 = struct_value () [symbolic]
  1674. // CHECK:STDOUT: %ImplicitAs.impl_witness.6bc: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.74f, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1675. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1676. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.e0d = struct_value () [concrete]
  1677. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.e8c = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.6bc) [concrete]
  1678. // CHECK:STDOUT: %.863: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  1679. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_-1.638, %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5 [concrete]
  1680. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  1681. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-1.638, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  1682. // CHECK:STDOUT: %int_-1.251: %i32 = int_value -1 [concrete]
  1683. // CHECK:STDOUT: }
  1684. // CHECK:STDOUT:
  1685. // CHECK:STDOUT: imports {
  1686. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1687. // CHECK:STDOUT: .Negate = %Core.Negate
  1688. // CHECK:STDOUT: .Int = %Core.Int
  1689. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1690. // CHECK:STDOUT: import Core//prelude
  1691. // CHECK:STDOUT: import Core//prelude/...
  1692. // CHECK:STDOUT: }
  1693. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1694. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1695. // CHECK:STDOUT: import Cpp//...
  1696. // CHECK:STDOUT: }
  1697. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1698. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/parts/int_literal, Negate, loaded [concrete = constants.%Negate.type]
  1699. // CHECK:STDOUT: %Core.import_ref.abd = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, unloaded
  1700. // CHECK:STDOUT: %Core.import_ref.82e: %Core.IntLiteral.as.Negate.impl.Op.type = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, loaded [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  1701. // CHECK:STDOUT: %Negate.impl_witness_table = impl_witness_table (%Core.import_ref.abd, %Core.import_ref.82e), @Core.IntLiteral.as.Negate.impl [concrete]
  1702. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  1703. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1704. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  1705. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  1706. // CHECK:STDOUT: } {
  1707. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  1708. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  1709. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1710. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  1711. // CHECK:STDOUT: }
  1712. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  1713. // CHECK:STDOUT: }
  1714. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1715. // CHECK:STDOUT: %Core.import_ref.42d: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.4e6) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.3c2)]
  1716. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.74f = impl_witness_table (%Core.import_ref.42d), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  1717. // CHECK:STDOUT: }
  1718. // CHECK:STDOUT:
  1719. // CHECK:STDOUT: file {
  1720. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1721. // CHECK:STDOUT: .Core = imports.%Core
  1722. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1723. // CHECK:STDOUT: .F = %F.decl
  1724. // CHECK:STDOUT: }
  1725. // CHECK:STDOUT: %Core.import = import Core
  1726. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1727. // CHECK:STDOUT: import Cpp "negative_int_literal.h"
  1728. // CHECK:STDOUT: }
  1729. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1730. // CHECK:STDOUT: }
  1731. // CHECK:STDOUT:
  1732. // CHECK:STDOUT: fn @F() {
  1733. // CHECK:STDOUT: !entry:
  1734. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1735. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1736. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  1737. // CHECK:STDOUT: %impl.elem1: %.826 = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  1738. // CHECK:STDOUT: %bound_method.loc8_11.1: <bound method> = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound]
  1739. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method.loc8_11.1(%int_1) [concrete = constants.%int_-1.638]
  1740. // CHECK:STDOUT: %impl.elem0: %.863 = impl_witness_access constants.%ImplicitAs.impl_witness.6bc, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.0b5]
  1741. // CHECK:STDOUT: %bound_method.loc8_11.2: <bound method> = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  1742. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1743. // CHECK:STDOUT: %bound_method.loc8_11.3: <bound method> = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn [concrete = constants.%bound_method]
  1744. // CHECK:STDOUT: %.loc8_11.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1.638]
  1745. // CHECK:STDOUT: %.loc8_11.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc8_11.1 [concrete = constants.%int_-1.638]
  1746. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %i32 = call %bound_method.loc8_11.3(%.loc8_11.2) [concrete = constants.%int_-1.251]
  1747. // CHECK:STDOUT: %.loc8_11.3: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_-1.251]
  1748. // CHECK:STDOUT: %.loc8_11.4: %i32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc8_11.3 [concrete = constants.%int_-1.251]
  1749. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc8_11.4)
  1750. // CHECK:STDOUT: return
  1751. // CHECK:STDOUT: }
  1752. // CHECK:STDOUT:
  1753. // CHECK:STDOUT: fn @foo(%a.param: %i32);
  1754. // CHECK:STDOUT:
  1755. // CHECK:STDOUT: --- fail_import_negative_literal_passed_to_unsigned.carbon
  1756. // CHECK:STDOUT:
  1757. // CHECK:STDOUT: constants {
  1758. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1759. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1760. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1761. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1762. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1763. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  1764. // CHECK:STDOUT: %Negate.type: type = facet_type <@Negate> [concrete]
  1765. // CHECK:STDOUT: %Negate.Op.type: type = fn_type @Negate.Op [concrete]
  1766. // CHECK:STDOUT: %Negate.impl_witness: <witness> = impl_witness imports.%Negate.impl_witness_table [concrete]
  1767. // CHECK:STDOUT: %Negate.facet: %Negate.type = facet_value Core.IntLiteral, (%Negate.impl_witness) [concrete]
  1768. // CHECK:STDOUT: %.826: type = fn_type_with_self_type %Negate.Op.type, %Negate.facet [concrete]
  1769. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.type: type = fn_type @Core.IntLiteral.as.Negate.impl.Op [concrete]
  1770. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op: %Core.IntLiteral.as.Negate.impl.Op.type = struct_value () [concrete]
  1771. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.bound: <bound method> = bound_method %int_1, %Core.IntLiteral.as.Negate.impl.Op [concrete]
  1772. // CHECK:STDOUT: %int_-1.638: Core.IntLiteral = int_value -1 [concrete]
  1773. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  1774. // CHECK:STDOUT: %UInt.type: type = generic_class_type @UInt [concrete]
  1775. // CHECK:STDOUT: %UInt.generic: %UInt.type = struct_value () [concrete]
  1776. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(%int_32) [concrete]
  1777. // CHECK:STDOUT: %pattern_type.4a9: type = pattern_type %u32 [concrete]
  1778. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1779. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1780. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1781. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1782. // CHECK:STDOUT: %ImplicitAs.type.146: type = facet_type <@ImplicitAs, @ImplicitAs(%u32)> [concrete]
  1783. // CHECK:STDOUT: %ImplicitAs.Convert.type.92a: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%u32) [concrete]
  1784. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  1785. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.6a6: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  1786. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.46e: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.6a6 = struct_value () [symbolic]
  1787. // CHECK:STDOUT: %ImplicitAs.impl_witness.29e: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.899, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1788. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.b07: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  1789. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.90e: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.b07 = struct_value () [concrete]
  1790. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.146 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.29e) [concrete]
  1791. // CHECK:STDOUT: %.aab: type = fn_type_with_self_type %ImplicitAs.Convert.type.92a, %ImplicitAs.facet [concrete]
  1792. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %int_-1.638, %Core.IntLiteral.as.ImplicitAs.impl.Convert.90e [concrete]
  1793. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.90e, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  1794. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_-1.638, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  1795. // CHECK:STDOUT: %int_-1.311: %u32 = int_value 18446744073709551615 [concrete]
  1796. // CHECK:STDOUT: }
  1797. // CHECK:STDOUT:
  1798. // CHECK:STDOUT: imports {
  1799. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1800. // CHECK:STDOUT: .Negate = %Core.Negate
  1801. // CHECK:STDOUT: .UInt = %Core.UInt
  1802. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1803. // CHECK:STDOUT: import Core//prelude
  1804. // CHECK:STDOUT: import Core//prelude/...
  1805. // CHECK:STDOUT: }
  1806. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1807. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1808. // CHECK:STDOUT: import Cpp//...
  1809. // CHECK:STDOUT: }
  1810. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1811. // CHECK:STDOUT: %Core.Negate: type = import_ref Core//prelude/parts/int_literal, Negate, loaded [concrete = constants.%Negate.type]
  1812. // CHECK:STDOUT: %Core.import_ref.abd = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, unloaded
  1813. // CHECK:STDOUT: %Core.import_ref.82e: %Core.IntLiteral.as.Negate.impl.Op.type = import_ref Core//prelude/parts/int_literal, loc{{\d+_\d+}}, loaded [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  1814. // CHECK:STDOUT: %Negate.impl_witness_table = impl_witness_table (%Core.import_ref.abd, %Core.import_ref.82e), @Core.IntLiteral.as.Negate.impl [concrete]
  1815. // CHECK:STDOUT: %Core.UInt: %UInt.type = import_ref Core//prelude/parts/uint, UInt, loaded [concrete = constants.%UInt.generic]
  1816. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1817. // CHECK:STDOUT: %a.patt: %pattern_type.4a9 = value_binding_pattern a [concrete]
  1818. // CHECK:STDOUT: %a.param_patt: %pattern_type.4a9 = value_param_pattern %a.patt, call_param0 [concrete]
  1819. // CHECK:STDOUT: } {
  1820. // CHECK:STDOUT: %a.param: %u32 = value_param call_param0
  1821. // CHECK:STDOUT: %.1: type = splice_block %u32 [concrete = constants.%u32] {
  1822. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  1823. // CHECK:STDOUT: %u32: type = class_type @UInt, @UInt(constants.%int_32) [concrete = constants.%u32]
  1824. // CHECK:STDOUT: }
  1825. // CHECK:STDOUT: %a: %u32 = value_binding a, %a.param
  1826. // CHECK:STDOUT: }
  1827. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1828. // CHECK:STDOUT: %Core.import_ref.741: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.6a6) = import_ref Core//prelude/parts/uint, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.46e)]
  1829. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.899 = impl_witness_table (%Core.import_ref.741), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  1830. // CHECK:STDOUT: }
  1831. // CHECK:STDOUT:
  1832. // CHECK:STDOUT: file {
  1833. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1834. // CHECK:STDOUT: .Core = imports.%Core
  1835. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1836. // CHECK:STDOUT: .F = %F.decl
  1837. // CHECK:STDOUT: }
  1838. // CHECK:STDOUT: %Core.import = import Core
  1839. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1840. // CHECK:STDOUT: import Cpp "negative_literal_passed_to_unsigned.h"
  1841. // CHECK:STDOUT: }
  1842. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1843. // CHECK:STDOUT: }
  1844. // CHECK:STDOUT:
  1845. // CHECK:STDOUT: fn @F() {
  1846. // CHECK:STDOUT: !entry:
  1847. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1848. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1849. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  1850. // CHECK:STDOUT: %impl.elem1: %.826 = impl_witness_access constants.%Negate.impl_witness, element1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op]
  1851. // CHECK:STDOUT: %bound_method.loc15_11.1: <bound method> = bound_method %int_1, %impl.elem1 [concrete = constants.%Core.IntLiteral.as.Negate.impl.Op.bound]
  1852. // CHECK:STDOUT: %Core.IntLiteral.as.Negate.impl.Op.call: init Core.IntLiteral = call %bound_method.loc15_11.1(%int_1) [concrete = constants.%int_-1.638]
  1853. // CHECK:STDOUT: %impl.elem0: %.aab = impl_witness_access constants.%ImplicitAs.impl_witness.29e, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.90e]
  1854. // CHECK:STDOUT: %bound_method.loc15_11.2: <bound method> = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound]
  1855. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1856. // CHECK:STDOUT: %bound_method.loc15_11.3: <bound method> = bound_method %Core.IntLiteral.as.Negate.impl.Op.call, %specific_fn [concrete = constants.%bound_method]
  1857. // CHECK:STDOUT: %.loc15_11.1: Core.IntLiteral = value_of_initializer %Core.IntLiteral.as.Negate.impl.Op.call [concrete = constants.%int_-1.638]
  1858. // CHECK:STDOUT: %.loc15_11.2: Core.IntLiteral = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc15_11.1 [concrete = constants.%int_-1.638]
  1859. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call: init %u32 = call %bound_method.loc15_11.3(%.loc15_11.2) [concrete = constants.%int_-1.311]
  1860. // CHECK:STDOUT: %.loc15_11.3: %u32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%int_-1.311]
  1861. // CHECK:STDOUT: %.loc15_11.4: %u32 = converted %Core.IntLiteral.as.Negate.impl.Op.call, %.loc15_11.3 [concrete = constants.%int_-1.311]
  1862. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc15_11.4)
  1863. // CHECK:STDOUT: return
  1864. // CHECK:STDOUT: }
  1865. // CHECK:STDOUT:
  1866. // CHECK:STDOUT: fn @foo(%a.param: %u32);
  1867. // CHECK:STDOUT:
  1868. // CHECK:STDOUT: --- import_floating_point_literal.carbon
  1869. // CHECK:STDOUT:
  1870. // CHECK:STDOUT: constants {
  1871. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  1872. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1873. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  1874. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  1875. // CHECK:STDOUT: %Float.type: type = generic_class_type @Float [concrete]
  1876. // CHECK:STDOUT: %Float.generic: %Float.type = struct_value () [concrete]
  1877. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  1878. // CHECK:STDOUT: %f64.d77: type = class_type @Float, @Float(%int_64) [concrete]
  1879. // CHECK:STDOUT: %pattern_type.0ae: type = pattern_type %f64.d77 [concrete]
  1880. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  1881. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  1882. // CHECK:STDOUT: %float.674: Core.FloatLiteral = float_literal_value 10e-1 [concrete]
  1883. // CHECK:STDOUT: %ptr.bcc: type = ptr_type %f64.d77 [concrete]
  1884. // CHECK:STDOUT: %pattern_type.0ce: type = pattern_type %ptr.bcc [concrete]
  1885. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  1886. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  1887. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  1888. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  1889. // CHECK:STDOUT: %ImplicitAs.type.4a8: type = facet_type <@ImplicitAs, @ImplicitAs(%f64.d77)> [concrete]
  1890. // CHECK:STDOUT: %ImplicitAs.Convert.type.726: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%f64.d77) [concrete]
  1891. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  1892. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f: type = fn_type @Core.FloatLiteral.as.ImplicitAs.impl.Convert, @Core.FloatLiteral.as.ImplicitAs.impl(%To) [symbolic]
  1893. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.1f0: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f = struct_value () [symbolic]
  1894. // CHECK:STDOUT: %ImplicitAs.impl_witness.cb2: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table, @Core.FloatLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  1895. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.2c7: type = fn_type @Core.FloatLiteral.as.ImplicitAs.impl.Convert, @Core.FloatLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  1896. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.2c7 = struct_value () [concrete]
  1897. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.4a8 = facet_value Core.FloatLiteral, (%ImplicitAs.impl_witness.cb2) [concrete]
  1898. // CHECK:STDOUT: %.b13: type = fn_type_with_self_type %ImplicitAs.Convert.type.726, %ImplicitAs.facet [concrete]
  1899. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %float.674, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239 [concrete]
  1900. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(%int_64) [concrete]
  1901. // CHECK:STDOUT: %bound_method.581: <bound method> = bound_method %float.674, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  1902. // CHECK:STDOUT: %float.d20: %f64.d77 = float_value 1 [concrete]
  1903. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  1904. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  1905. // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.2fe: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%N) [symbolic]
  1906. // CHECK:STDOUT: %Float.as.Copy.impl.Op.240: %Float.as.Copy.impl.Op.type.2fe = struct_value () [symbolic]
  1907. // CHECK:STDOUT: %Copy.impl_witness.1e3: <witness> = impl_witness imports.%Copy.impl_witness_table.119, @Float.as.Copy.impl(%int_64) [concrete]
  1908. // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.07e: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%int_64) [concrete]
  1909. // CHECK:STDOUT: %Float.as.Copy.impl.Op.f05: %Float.as.Copy.impl.Op.type.07e = struct_value () [concrete]
  1910. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %f64.d77, (%Copy.impl_witness.1e3) [concrete]
  1911. // CHECK:STDOUT: %.c41: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  1912. // CHECK:STDOUT: %Float.as.Copy.impl.Op.bound: <bound method> = bound_method %float.d20, %Float.as.Copy.impl.Op.f05 [concrete]
  1913. // CHECK:STDOUT: %Float.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Float.as.Copy.impl.Op.f05, @Float.as.Copy.impl.Op(%int_64) [concrete]
  1914. // CHECK:STDOUT: %bound_method.9b6: <bound method> = bound_method %float.d20, %Float.as.Copy.impl.Op.specific_fn [concrete]
  1915. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  1916. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  1917. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  1918. // CHECK:STDOUT: }
  1919. // CHECK:STDOUT:
  1920. // CHECK:STDOUT: imports {
  1921. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  1922. // CHECK:STDOUT: .Float = %Core.Float
  1923. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  1924. // CHECK:STDOUT: .Copy = %Core.Copy
  1925. // CHECK:STDOUT: .Destroy = %Core.Destroy
  1926. // CHECK:STDOUT: import Core//prelude
  1927. // CHECK:STDOUT: import Core//prelude/...
  1928. // CHECK:STDOUT: }
  1929. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1930. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  1931. // CHECK:STDOUT: import Cpp//...
  1932. // CHECK:STDOUT: }
  1933. // CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/parts/float, Float, loaded [concrete = constants.%Float.generic]
  1934. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  1935. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  1936. // CHECK:STDOUT: %a.patt: %pattern_type.0ce = value_binding_pattern a [concrete]
  1937. // CHECK:STDOUT: %a.param_patt: %pattern_type.0ce = value_param_pattern %a.patt, call_param0 [concrete]
  1938. // CHECK:STDOUT: %return.patt: %pattern_type.0ce = value_binding_pattern r#return [concrete]
  1939. // CHECK:STDOUT: %return.param_patt: %pattern_type.0ce = value_param_pattern %return.patt, call_param1 [concrete]
  1940. // CHECK:STDOUT: } {
  1941. // CHECK:STDOUT: %a.param: %ptr.bcc = value_param call_param0
  1942. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr.bcc [concrete = constants.%ptr.bcc] {
  1943. // CHECK:STDOUT: %int_64.2: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1944. // CHECK:STDOUT: %f64.2: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  1945. // CHECK:STDOUT: }
  1946. // CHECK:STDOUT: %a: %ptr.bcc = value_binding a, %a.param
  1947. // CHECK:STDOUT: %return.param: %ptr.bcc = value_param call_param1
  1948. // CHECK:STDOUT: %.2: type = splice_block constants.%ptr.bcc [concrete = constants.%ptr.bcc] {
  1949. // CHECK:STDOUT: %int_64.1: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  1950. // CHECK:STDOUT: %f64.1: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  1951. // CHECK:STDOUT: }
  1952. // CHECK:STDOUT: %return: %ptr.bcc = value_binding r#return, %return.param
  1953. // CHECK:STDOUT: }
  1954. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  1955. // CHECK:STDOUT: %Core.import_ref.38a: @Core.FloatLiteral.as.ImplicitAs.impl.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.type (%Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f) = import_ref Core//prelude/parts/float, loc{{\d+_\d+}}, loaded [symbolic = @Core.FloatLiteral.as.ImplicitAs.impl.%Core.FloatLiteral.as.ImplicitAs.impl.Convert (constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.1f0)]
  1956. // CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (%Core.import_ref.38a), @Core.FloatLiteral.as.ImplicitAs.impl [concrete]
  1957. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  1958. // CHECK:STDOUT: %Core.import_ref.47c: @Float.as.Copy.impl.%Float.as.Copy.impl.Op.type (%Float.as.Copy.impl.Op.type.2fe) = import_ref Core//prelude/parts/float, loc{{\d+_\d+}}, loaded [symbolic = @Float.as.Copy.impl.%Float.as.Copy.impl.Op (constants.%Float.as.Copy.impl.Op.240)]
  1959. // CHECK:STDOUT: %Copy.impl_witness_table.119 = impl_witness_table (%Core.import_ref.47c), @Float.as.Copy.impl [concrete]
  1960. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  1961. // CHECK:STDOUT: }
  1962. // CHECK:STDOUT:
  1963. // CHECK:STDOUT: file {
  1964. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  1965. // CHECK:STDOUT: .Core = imports.%Core
  1966. // CHECK:STDOUT: .Cpp = imports.%Cpp
  1967. // CHECK:STDOUT: .F = %F.decl
  1968. // CHECK:STDOUT: }
  1969. // CHECK:STDOUT: %Core.import = import Core
  1970. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  1971. // CHECK:STDOUT: import Cpp "floating_point_literal.h"
  1972. // CHECK:STDOUT: }
  1973. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  1974. // CHECK:STDOUT: }
  1975. // CHECK:STDOUT:
  1976. // CHECK:STDOUT: fn @F() {
  1977. // CHECK:STDOUT: !entry:
  1978. // CHECK:STDOUT: name_binding_decl {
  1979. // CHECK:STDOUT: %d.patt: %pattern_type.0ae = value_binding_pattern d [concrete]
  1980. // CHECK:STDOUT: }
  1981. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1982. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  1983. // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 10e-1 [concrete = constants.%float.674]
  1984. // CHECK:STDOUT: %impl.elem0.loc7_24.1: %.b13 = impl_witness_access constants.%ImplicitAs.impl_witness.cb2, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.239]
  1985. // CHECK:STDOUT: %bound_method.loc7_24.1: <bound method> = bound_method %float, %impl.elem0.loc7_24.1 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
  1986. // CHECK:STDOUT: %specific_fn.loc7_24.1: <specific function> = specific_function %impl.elem0.loc7_24.1, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1987. // CHECK:STDOUT: %bound_method.loc7_24.2: <bound method> = bound_method %float, %specific_fn.loc7_24.1 [concrete = constants.%bound_method.581]
  1988. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.d77 = call %bound_method.loc7_24.2(%float) [concrete = constants.%float.d20]
  1989. // CHECK:STDOUT: %.loc7_24.1: %f64.d77 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = constants.%float.d20]
  1990. // CHECK:STDOUT: %.loc7_24.2: %f64.d77 = converted %float, %.loc7_24.1 [concrete = constants.%float.d20]
  1991. // CHECK:STDOUT: %.loc7_24.3: ref %f64.d77 = temporary_storage
  1992. // CHECK:STDOUT: %impl.elem0.loc7_24.2: %.c41 = impl_witness_access constants.%Copy.impl_witness.1e3, element0 [concrete = constants.%Float.as.Copy.impl.Op.f05]
  1993. // CHECK:STDOUT: %bound_method.loc7_24.3: <bound method> = bound_method %.loc7_24.2, %impl.elem0.loc7_24.2 [concrete = constants.%Float.as.Copy.impl.Op.bound]
  1994. // CHECK:STDOUT: %specific_fn.loc7_24.2: <specific function> = specific_function %impl.elem0.loc7_24.2, @Float.as.Copy.impl.Op(constants.%int_64) [concrete = constants.%Float.as.Copy.impl.Op.specific_fn]
  1995. // CHECK:STDOUT: %bound_method.loc7_24.4: <bound method> = bound_method %.loc7_24.2, %specific_fn.loc7_24.2 [concrete = constants.%bound_method.9b6]
  1996. // CHECK:STDOUT: %Float.as.Copy.impl.Op.call: init %f64.d77 = call %bound_method.loc7_24.4(%.loc7_24.2) [concrete = constants.%float.d20]
  1997. // CHECK:STDOUT: %.loc7_24.4: ref %f64.d77 = temporary %.loc7_24.3, %Float.as.Copy.impl.Op.call
  1998. // CHECK:STDOUT: %addr.loc7_27.1: %ptr.bcc = addr_of %.loc7_24.4
  1999. // CHECK:STDOUT: %.loc7_27.1: ref %f64.d77 = temporary_storage
  2000. // CHECK:STDOUT: %addr.loc7_27.2: %ptr.bcc = addr_of %.loc7_27.1
  2001. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc7_27.1, %addr.loc7_27.2)
  2002. // CHECK:STDOUT: %.loc7_27.2: init %f64.d77 = in_place_init %foo__carbon_thunk.call, %.loc7_27.1
  2003. // CHECK:STDOUT: %.loc7_10: type = splice_block %f64 [concrete = constants.%f64.d77] {
  2004. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  2005. // CHECK:STDOUT: %f64: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  2006. // CHECK:STDOUT: }
  2007. // CHECK:STDOUT: %.loc7_27.3: %f64.d77 = value_of_initializer %.loc7_27.2
  2008. // CHECK:STDOUT: %.loc7_27.4: %f64.d77 = converted %.loc7_27.2, %.loc7_27.3
  2009. // CHECK:STDOUT: %d: %f64.d77 = value_binding d, %.loc7_27.4
  2010. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc7_24.4, constants.%DestroyOp
  2011. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc7_24.4)
  2012. // CHECK:STDOUT: return
  2013. // CHECK:STDOUT: }
  2014. // CHECK:STDOUT:
  2015. // CHECK:STDOUT: fn @foo(%a.param: %f64.d77) -> out %return.param: %f64.d77;
  2016. // CHECK:STDOUT:
  2017. // CHECK:STDOUT: fn @foo__carbon_thunk(%a.param: %ptr.bcc, %return.param: %ptr.bcc);
  2018. // CHECK:STDOUT:
  2019. // CHECK:STDOUT: fn @DestroyOp(%self.param: %f64.d77) = "no_op";
  2020. // CHECK:STDOUT:
  2021. // CHECK:STDOUT: --- fail_import_large_floating_point_literal.carbon
  2022. // CHECK:STDOUT:
  2023. // CHECK:STDOUT: constants {
  2024. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2025. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2026. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2027. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  2028. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  2029. // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 18e307 [concrete]
  2030. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  2031. // CHECK:STDOUT: %Float.type: type = generic_class_type @Float [concrete]
  2032. // CHECK:STDOUT: %Float.generic: %Float.type = struct_value () [concrete]
  2033. // CHECK:STDOUT: %N: Core.IntLiteral = symbolic_binding N, 0 [symbolic]
  2034. // CHECK:STDOUT: %f64.d77: type = class_type @Float, @Float(%int_64) [concrete]
  2035. // CHECK:STDOUT: %ptr.bcc: type = ptr_type %f64.d77 [concrete]
  2036. // CHECK:STDOUT: %pattern_type.0ce: type = pattern_type %ptr.bcc [concrete]
  2037. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  2038. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  2039. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2040. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2041. // CHECK:STDOUT: %ImplicitAs.type.4a8: type = facet_type <@ImplicitAs, @ImplicitAs(%f64.d77)> [concrete]
  2042. // CHECK:STDOUT: %ImplicitAs.Convert.type.726: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%f64.d77) [concrete]
  2043. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  2044. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f: type = fn_type @Core.FloatLiteral.as.ImplicitAs.impl.Convert, @Core.FloatLiteral.as.ImplicitAs.impl(%To) [symbolic]
  2045. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.1f0: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f = struct_value () [symbolic]
  2046. // CHECK:STDOUT: %ImplicitAs.impl_witness.cb2: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table, @Core.FloatLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  2047. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.2c7: type = fn_type @Core.FloatLiteral.as.ImplicitAs.impl.Convert, @Core.FloatLiteral.as.ImplicitAs.impl(%int_64) [concrete]
  2048. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.2c7 = struct_value () [concrete]
  2049. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.4a8 = facet_value Core.FloatLiteral, (%ImplicitAs.impl_witness.cb2) [concrete]
  2050. // CHECK:STDOUT: %.b13: type = fn_type_with_self_type %ImplicitAs.Convert.type.726, %ImplicitAs.facet [concrete]
  2051. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound: <bound method> = bound_method %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239 [concrete]
  2052. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.FloatLiteral.as.ImplicitAs.impl.Convert.239, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(%int_64) [concrete]
  2053. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %float, %Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  2054. // CHECK:STDOUT: %Copy.type: type = facet_type <@Copy> [concrete]
  2055. // CHECK:STDOUT: %Copy.Op.type: type = fn_type @Copy.Op [concrete]
  2056. // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.2fe: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%N) [symbolic]
  2057. // CHECK:STDOUT: %Float.as.Copy.impl.Op.240: %Float.as.Copy.impl.Op.type.2fe = struct_value () [symbolic]
  2058. // CHECK:STDOUT: %Copy.impl_witness.1e3: <witness> = impl_witness imports.%Copy.impl_witness_table.119, @Float.as.Copy.impl(%int_64) [concrete]
  2059. // CHECK:STDOUT: %Float.as.Copy.impl.Op.type.07e: type = fn_type @Float.as.Copy.impl.Op, @Float.as.Copy.impl(%int_64) [concrete]
  2060. // CHECK:STDOUT: %Float.as.Copy.impl.Op.f05: %Float.as.Copy.impl.Op.type.07e = struct_value () [concrete]
  2061. // CHECK:STDOUT: %Copy.facet: %Copy.type = facet_value %f64.d77, (%Copy.impl_witness.1e3) [concrete]
  2062. // CHECK:STDOUT: %.c41: type = fn_type_with_self_type %Copy.Op.type, %Copy.facet [concrete]
  2063. // CHECK:STDOUT: %Float.as.Copy.impl.Op.specific_fn: <specific function> = specific_function %Float.as.Copy.impl.Op.f05, @Float.as.Copy.impl.Op(%int_64) [concrete]
  2064. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  2065. // CHECK:STDOUT: %DestroyOp.type: type = fn_type @DestroyOp [concrete]
  2066. // CHECK:STDOUT: %DestroyOp: %DestroyOp.type = struct_value () [concrete]
  2067. // CHECK:STDOUT: }
  2068. // CHECK:STDOUT:
  2069. // CHECK:STDOUT: imports {
  2070. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2071. // CHECK:STDOUT: .Float = %Core.Float
  2072. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2073. // CHECK:STDOUT: .Copy = %Core.Copy
  2074. // CHECK:STDOUT: .Destroy = %Core.Destroy
  2075. // CHECK:STDOUT: import Core//prelude
  2076. // CHECK:STDOUT: import Core//prelude/...
  2077. // CHECK:STDOUT: }
  2078. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2079. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  2080. // CHECK:STDOUT: import Cpp//...
  2081. // CHECK:STDOUT: }
  2082. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  2083. // CHECK:STDOUT: %Core.Float: %Float.type = import_ref Core//prelude/parts/float, Float, loaded [concrete = constants.%Float.generic]
  2084. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  2085. // CHECK:STDOUT: %a.patt: %pattern_type.0ce = value_binding_pattern a [concrete]
  2086. // CHECK:STDOUT: %a.param_patt: %pattern_type.0ce = value_param_pattern %a.patt, call_param0 [concrete]
  2087. // CHECK:STDOUT: %return.patt: %pattern_type.0ce = value_binding_pattern r#return [concrete]
  2088. // CHECK:STDOUT: %return.param_patt: %pattern_type.0ce = value_param_pattern %return.patt, call_param1 [concrete]
  2089. // CHECK:STDOUT: } {
  2090. // CHECK:STDOUT: %a.param: %ptr.bcc = value_param call_param0
  2091. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr.bcc [concrete = constants.%ptr.bcc] {
  2092. // CHECK:STDOUT: %int_64.2: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  2093. // CHECK:STDOUT: %f64.2: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  2094. // CHECK:STDOUT: }
  2095. // CHECK:STDOUT: %a: %ptr.bcc = value_binding a, %a.param
  2096. // CHECK:STDOUT: %return.param: %ptr.bcc = value_param call_param1
  2097. // CHECK:STDOUT: %.2: type = splice_block constants.%ptr.bcc [concrete = constants.%ptr.bcc] {
  2098. // CHECK:STDOUT: %int_64.1: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  2099. // CHECK:STDOUT: %f64.1: type = class_type @Float, @Float(constants.%int_64) [concrete = constants.%f64.d77]
  2100. // CHECK:STDOUT: }
  2101. // CHECK:STDOUT: %return: %ptr.bcc = value_binding r#return, %return.param
  2102. // CHECK:STDOUT: }
  2103. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2104. // CHECK:STDOUT: %Core.import_ref.38a: @Core.FloatLiteral.as.ImplicitAs.impl.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.type (%Core.FloatLiteral.as.ImplicitAs.impl.Convert.type.02f) = import_ref Core//prelude/parts/float, loc{{\d+_\d+}}, loaded [symbolic = @Core.FloatLiteral.as.ImplicitAs.impl.%Core.FloatLiteral.as.ImplicitAs.impl.Convert (constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.1f0)]
  2105. // CHECK:STDOUT: %ImplicitAs.impl_witness_table = impl_witness_table (%Core.import_ref.38a), @Core.FloatLiteral.as.ImplicitAs.impl [concrete]
  2106. // CHECK:STDOUT: %Core.Copy: type = import_ref Core//prelude/parts/copy, Copy, loaded [concrete = constants.%Copy.type]
  2107. // CHECK:STDOUT: %Core.import_ref.47c: @Float.as.Copy.impl.%Float.as.Copy.impl.Op.type (%Float.as.Copy.impl.Op.type.2fe) = import_ref Core//prelude/parts/float, loc{{\d+_\d+}}, loaded [symbolic = @Float.as.Copy.impl.%Float.as.Copy.impl.Op (constants.%Float.as.Copy.impl.Op.240)]
  2108. // CHECK:STDOUT: %Copy.impl_witness_table.119 = impl_witness_table (%Core.import_ref.47c), @Float.as.Copy.impl [concrete]
  2109. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  2110. // CHECK:STDOUT: }
  2111. // CHECK:STDOUT:
  2112. // CHECK:STDOUT: file {
  2113. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2114. // CHECK:STDOUT: .Core = imports.%Core
  2115. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2116. // CHECK:STDOUT: .F = %F.decl
  2117. // CHECK:STDOUT: }
  2118. // CHECK:STDOUT: %Core.import = import Core
  2119. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2120. // CHECK:STDOUT: import Cpp "floating_point_literal.h"
  2121. // CHECK:STDOUT: }
  2122. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2123. // CHECK:STDOUT: }
  2124. // CHECK:STDOUT:
  2125. // CHECK:STDOUT: fn @F() {
  2126. // CHECK:STDOUT: !entry:
  2127. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2128. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  2129. // CHECK:STDOUT: %float: Core.FloatLiteral = float_literal_value 18e307 [concrete = constants.%float]
  2130. // CHECK:STDOUT: %impl.elem0.loc15_11.1: %.b13 = impl_witness_access constants.%ImplicitAs.impl_witness.cb2, element0 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.239]
  2131. // CHECK:STDOUT: %bound_method.loc15_11.1: <bound method> = bound_method %float, %impl.elem0.loc15_11.1 [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.bound]
  2132. // CHECK:STDOUT: %specific_fn.loc15_11.1: <specific function> = specific_function %impl.elem0.loc15_11.1, @Core.FloatLiteral.as.ImplicitAs.impl.Convert(constants.%int_64) [concrete = constants.%Core.FloatLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  2133. // CHECK:STDOUT: %bound_method.loc15_11.2: <bound method> = bound_method %float, %specific_fn.loc15_11.1 [concrete = constants.%bound_method]
  2134. // CHECK:STDOUT: %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call: init %f64.d77 = call %bound_method.loc15_11.2(%float) [concrete = <error>]
  2135. // CHECK:STDOUT: %.loc15_11.1: %f64.d77 = value_of_initializer %Core.FloatLiteral.as.ImplicitAs.impl.Convert.call [concrete = <error>]
  2136. // CHECK:STDOUT: %.loc15_11.2: %f64.d77 = converted %float, %.loc15_11.1 [concrete = <error>]
  2137. // CHECK:STDOUT: %.loc15_11.3: ref %f64.d77 = temporary_storage
  2138. // CHECK:STDOUT: %impl.elem0.loc15_11.2: %.c41 = impl_witness_access constants.%Copy.impl_witness.1e3, element0 [concrete = constants.%Float.as.Copy.impl.Op.f05]
  2139. // CHECK:STDOUT: %bound_method.loc15_11.3: <bound method> = bound_method %.loc15_11.2, %impl.elem0.loc15_11.2 [concrete = <error>]
  2140. // CHECK:STDOUT: %specific_fn.loc15_11.2: <specific function> = specific_function %impl.elem0.loc15_11.2, @Float.as.Copy.impl.Op(constants.%int_64) [concrete = constants.%Float.as.Copy.impl.Op.specific_fn]
  2141. // CHECK:STDOUT: %bound_method.loc15_11.4: <bound method> = bound_method %.loc15_11.2, %specific_fn.loc15_11.2 [concrete = <error>]
  2142. // CHECK:STDOUT: %Float.as.Copy.impl.Op.call: init %f64.d77 = call %bound_method.loc15_11.4(%.loc15_11.2) [concrete = <error>]
  2143. // CHECK:STDOUT: %.loc15_11.4: ref %f64.d77 = temporary %.loc15_11.3, %Float.as.Copy.impl.Op.call
  2144. // CHECK:STDOUT: %addr.loc15_19.1: %ptr.bcc = addr_of %.loc15_11.4
  2145. // CHECK:STDOUT: %.loc15_19.1: ref %f64.d77 = temporary_storage
  2146. // CHECK:STDOUT: %addr.loc15_19.2: %ptr.bcc = addr_of %.loc15_19.1
  2147. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc15_19.1, %addr.loc15_19.2)
  2148. // CHECK:STDOUT: %.loc15_19.2: init %f64.d77 = in_place_init %foo__carbon_thunk.call, %.loc15_19.1
  2149. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc15_11.4, constants.%DestroyOp
  2150. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc15_11.4)
  2151. // CHECK:STDOUT: return
  2152. // CHECK:STDOUT: }
  2153. // CHECK:STDOUT:
  2154. // CHECK:STDOUT: fn @foo(%a.param: %f64.d77) -> out %return.param: %f64.d77;
  2155. // CHECK:STDOUT:
  2156. // CHECK:STDOUT: fn @foo__carbon_thunk(%a.param: %ptr.bcc, %return.param: %ptr.bcc);
  2157. // CHECK:STDOUT:
  2158. // CHECK:STDOUT: fn @DestroyOp(%self.param: %f64.d77) = "no_op";
  2159. // CHECK:STDOUT:
  2160. // CHECK:STDOUT: --- struct_init.carbon
  2161. // CHECK:STDOUT:
  2162. // CHECK:STDOUT: constants {
  2163. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  2164. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  2165. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2166. // CHECK:STDOUT: %.e6e: form = init_form %empty_struct_type, call_param0 [concrete]
  2167. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  2168. // CHECK:STDOUT: %MakeEmpty.type: type = fn_type @MakeEmpty [concrete]
  2169. // CHECK:STDOUT: %MakeEmpty: %MakeEmpty.type = struct_value () [concrete]
  2170. // CHECK:STDOUT: %Empty.type: type = fn_type @Empty [concrete]
  2171. // CHECK:STDOUT: %Empty: %Empty.type = struct_value () [concrete]
  2172. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.type: type = cpp_overload_set_type @PassNoFields.cpp_overload_set [concrete]
  2173. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.value: %PassNoFields.cpp_overload_set.type = cpp_overload_set_value @PassNoFields.cpp_overload_set [concrete]
  2174. // CHECK:STDOUT: %NoFields: type = class_type @NoFields [concrete]
  2175. // CHECK:STDOUT: %ptr.dd0: type = ptr_type %NoFields [concrete]
  2176. // CHECK:STDOUT: %pattern_type.a92: type = pattern_type %ptr.dd0 [concrete]
  2177. // CHECK:STDOUT: %PassNoFields__carbon_thunk.type: type = fn_type @PassNoFields__carbon_thunk [concrete]
  2178. // CHECK:STDOUT: %PassNoFields__carbon_thunk: %PassNoFields__carbon_thunk.type = struct_value () [concrete]
  2179. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  2180. // CHECK:STDOUT: %NoFields.val: %NoFields = struct_value () [concrete]
  2181. // CHECK:STDOUT: %Destroy.type: type = facet_type <@Destroy> [concrete]
  2182. // CHECK:STDOUT: %NoFields.cpp_destructor.type: type = fn_type @NoFields.cpp_destructor [concrete]
  2183. // CHECK:STDOUT: %NoFields.cpp_destructor: %NoFields.cpp_destructor.type = struct_value () [concrete]
  2184. // CHECK:STDOUT: %DestroyOp.type.3e79c2.2: type = fn_type @DestroyOp.loc15_30.2 [concrete]
  2185. // CHECK:STDOUT: %DestroyOp.b0ebf8.2: %DestroyOp.type.3e79c2.2 = struct_value () [concrete]
  2186. // CHECK:STDOUT: }
  2187. // CHECK:STDOUT:
  2188. // CHECK:STDOUT: imports {
  2189. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2190. // CHECK:STDOUT: .Destroy = %Core.Destroy
  2191. // CHECK:STDOUT: import Core//prelude
  2192. // CHECK:STDOUT: import Core//prelude/...
  2193. // CHECK:STDOUT: }
  2194. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2195. // CHECK:STDOUT: .PassNoFields = %PassNoFields.cpp_overload_set.value
  2196. // CHECK:STDOUT: import Cpp//...
  2197. // CHECK:STDOUT: }
  2198. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.value: %PassNoFields.cpp_overload_set.type = cpp_overload_set_value @PassNoFields.cpp_overload_set [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2199. // CHECK:STDOUT: %PassNoFields__carbon_thunk.decl: %PassNoFields__carbon_thunk.type = fn_decl @PassNoFields__carbon_thunk [concrete = constants.%PassNoFields__carbon_thunk] {
  2200. // CHECK:STDOUT: %s.patt: %pattern_type.a92 = value_binding_pattern s [concrete]
  2201. // CHECK:STDOUT: %s.param_patt: %pattern_type.a92 = value_param_pattern %s.patt, call_param0 [concrete]
  2202. // CHECK:STDOUT: } {
  2203. // CHECK:STDOUT: %s.param: %ptr.dd0 = value_param call_param0
  2204. // CHECK:STDOUT: %s: %ptr.dd0 = value_binding s, %s.param
  2205. // CHECK:STDOUT: }
  2206. // CHECK:STDOUT: %Core.Destroy: type = import_ref Core//prelude/parts/destroy, Destroy, loaded [concrete = constants.%Destroy.type]
  2207. // CHECK:STDOUT: }
  2208. // CHECK:STDOUT:
  2209. // CHECK:STDOUT: file {
  2210. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2211. // CHECK:STDOUT: .Core = imports.%Core
  2212. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2213. // CHECK:STDOUT: .MakeEmpty = %MakeEmpty.decl
  2214. // CHECK:STDOUT: .Empty = %Empty.decl
  2215. // CHECK:STDOUT: }
  2216. // CHECK:STDOUT: %Core.import = import Core
  2217. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2218. // CHECK:STDOUT: import Cpp "struct_init.h"
  2219. // CHECK:STDOUT: }
  2220. // CHECK:STDOUT: %MakeEmpty.decl: %MakeEmpty.type = fn_decl @MakeEmpty [concrete = constants.%MakeEmpty] {
  2221. // CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern [concrete]
  2222. // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern %return.patt, call_param0 [concrete]
  2223. // CHECK:STDOUT: } {
  2224. // CHECK:STDOUT: %.loc6_20.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  2225. // CHECK:STDOUT: %.loc6_20.2: type = converted %.loc6_20.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  2226. // CHECK:STDOUT: %.loc6_20.3: form = init_form %.loc6_20.2, call_param0 [concrete = constants.%.e6e]
  2227. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0
  2228. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  2229. // CHECK:STDOUT: }
  2230. // CHECK:STDOUT: %Empty.decl: %Empty.type = fn_decl @Empty [concrete = constants.%Empty] {
  2231. // CHECK:STDOUT: %value.patt: %pattern_type.a96 = value_binding_pattern value [concrete]
  2232. // CHECK:STDOUT: %value.param_patt: %pattern_type.a96 = value_param_pattern %value.patt, call_param0 [concrete]
  2233. // CHECK:STDOUT: %reference.patt: %pattern_type.a96 = ref_binding_pattern reference [concrete]
  2234. // CHECK:STDOUT: %reference.param_patt: %pattern_type.a96 = ref_param_pattern %reference.patt, call_param1 [concrete]
  2235. // CHECK:STDOUT: } {
  2236. // CHECK:STDOUT: %value.param: %empty_struct_type = value_param call_param0
  2237. // CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.3 [concrete = constants.%empty_struct_type] {
  2238. // CHECK:STDOUT: %.loc8_18.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  2239. // CHECK:STDOUT: %.loc8_18.3: type = converted %.loc8_18.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  2240. // CHECK:STDOUT: }
  2241. // CHECK:STDOUT: %value: %empty_struct_type = value_binding value, %value.param
  2242. // CHECK:STDOUT: %reference.param: ref %empty_struct_type = ref_param call_param1
  2243. // CHECK:STDOUT: %.loc8_37.1: type = splice_block %.loc8_37.3 [concrete = constants.%empty_struct_type] {
  2244. // CHECK:STDOUT: %.loc8_37.2: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  2245. // CHECK:STDOUT: %.loc8_37.3: type = converted %.loc8_37.2, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  2246. // CHECK:STDOUT: }
  2247. // CHECK:STDOUT: %reference: ref %empty_struct_type = ref_binding reference, %reference.param
  2248. // CHECK:STDOUT: }
  2249. // CHECK:STDOUT: }
  2250. // CHECK:STDOUT:
  2251. // CHECK:STDOUT: class @NoFields {
  2252. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  2253. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  2254. // CHECK:STDOUT: complete_type_witness = %complete_type
  2255. // CHECK:STDOUT:
  2256. // CHECK:STDOUT: !members:
  2257. // CHECK:STDOUT: import Cpp//...
  2258. // CHECK:STDOUT: }
  2259. // CHECK:STDOUT:
  2260. // CHECK:STDOUT: fn @MakeEmpty() -> out %return.param: %empty_struct_type;
  2261. // CHECK:STDOUT:
  2262. // CHECK:STDOUT: fn @Empty(%value.param: %empty_struct_type, %reference.param: %empty_struct_type) {
  2263. // CHECK:STDOUT: !entry:
  2264. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2265. // CHECK:STDOUT: %PassNoFields.ref.loc9: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2266. // CHECK:STDOUT: %.loc9_21.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  2267. // CHECK:STDOUT: %.loc9_21.2: ref %NoFields = temporary_storage
  2268. // CHECK:STDOUT: %.loc9_21.3: init %NoFields to %.loc9_21.2 = class_init () [concrete = constants.%NoFields.val]
  2269. // CHECK:STDOUT: %.loc9_21.4: ref %NoFields = temporary %.loc9_21.2, %.loc9_21.3
  2270. // CHECK:STDOUT: %.loc9_21.5: ref %NoFields = converted %.loc9_21.1, %.loc9_21.4
  2271. // CHECK:STDOUT: %.loc9_21.6: %NoFields = acquire_value %.loc9_21.5
  2272. // CHECK:STDOUT: %.loc9_21.7: ref %NoFields = value_as_ref %.loc9_21.6
  2273. // CHECK:STDOUT: %addr.loc9: %ptr.dd0 = addr_of %.loc9_21.7
  2274. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc9)
  2275. // CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2276. // CHECK:STDOUT: %PassNoFields.ref.loc11: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2277. // CHECK:STDOUT: %value.ref: %empty_struct_type = name_ref value, %value
  2278. // CHECK:STDOUT: %.loc11_20.1: ref %NoFields = temporary_storage
  2279. // CHECK:STDOUT: %.loc11_20.2: init %NoFields to %.loc11_20.1 = class_init () [concrete = constants.%NoFields.val]
  2280. // CHECK:STDOUT: %.loc11_20.3: ref %NoFields = temporary %.loc11_20.1, %.loc11_20.2
  2281. // CHECK:STDOUT: %.loc11_20.4: ref %NoFields = converted %value.ref, %.loc11_20.3
  2282. // CHECK:STDOUT: %.loc11_20.5: %NoFields = acquire_value %.loc11_20.4
  2283. // CHECK:STDOUT: %.loc11_20.6: ref %NoFields = value_as_ref %.loc11_20.5
  2284. // CHECK:STDOUT: %addr.loc11: %ptr.dd0 = addr_of %.loc11_20.6
  2285. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc11: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc11)
  2286. // CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2287. // CHECK:STDOUT: %PassNoFields.ref.loc13: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2288. // CHECK:STDOUT: %reference.ref: ref %empty_struct_type = name_ref reference, %reference
  2289. // CHECK:STDOUT: %.loc13_20.1: ref %NoFields = temporary_storage
  2290. // CHECK:STDOUT: %.loc13_20.2: init %NoFields to %.loc13_20.1 = class_init () [concrete = constants.%NoFields.val]
  2291. // CHECK:STDOUT: %.loc13_20.3: ref %NoFields = temporary %.loc13_20.1, %.loc13_20.2
  2292. // CHECK:STDOUT: %.loc13_20.4: ref %NoFields = converted %reference.ref, %.loc13_20.3
  2293. // CHECK:STDOUT: %.loc13_20.5: %NoFields = acquire_value %.loc13_20.4
  2294. // CHECK:STDOUT: %.loc13_20.6: ref %NoFields = value_as_ref %.loc13_20.5
  2295. // CHECK:STDOUT: %addr.loc13: %ptr.dd0 = addr_of %.loc13_20.6
  2296. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc13: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc13)
  2297. // CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2298. // CHECK:STDOUT: %PassNoFields.ref.loc15: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2299. // CHECK:STDOUT: %MakeEmpty.ref: %MakeEmpty.type = name_ref MakeEmpty, file.%MakeEmpty.decl [concrete = constants.%MakeEmpty]
  2300. // CHECK:STDOUT: %MakeEmpty.call: init %empty_struct_type = call %MakeEmpty.ref()
  2301. // CHECK:STDOUT: %.loc15_30.1: ref %empty_struct_type = temporary_storage
  2302. // CHECK:STDOUT: %.loc15_30.2: ref %empty_struct_type = temporary %.loc15_30.1, %MakeEmpty.call
  2303. // CHECK:STDOUT: %.loc15_30.3: ref %NoFields = temporary_storage
  2304. // CHECK:STDOUT: %.loc15_30.4: init %NoFields to %.loc15_30.3 = class_init () [concrete = constants.%NoFields.val]
  2305. // CHECK:STDOUT: %.loc15_30.5: ref %NoFields = temporary %.loc15_30.3, %.loc15_30.4
  2306. // CHECK:STDOUT: %.loc15_30.6: ref %NoFields = converted %MakeEmpty.call, %.loc15_30.5
  2307. // CHECK:STDOUT: %.loc15_30.7: %NoFields = acquire_value %.loc15_30.6
  2308. // CHECK:STDOUT: %.loc15_30.8: ref %NoFields = value_as_ref %.loc15_30.7
  2309. // CHECK:STDOUT: %addr.loc15: %ptr.dd0 = addr_of %.loc15_30.8
  2310. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc15: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc15)
  2311. // CHECK:STDOUT: %NoFields.cpp_destructor.bound.loc15: <bound method> = bound_method %.loc15_30.5, constants.%NoFields.cpp_destructor
  2312. // CHECK:STDOUT: %NoFields.cpp_destructor.call.loc15: init %empty_tuple.type = call %NoFields.cpp_destructor.bound.loc15(%.loc15_30.5)
  2313. // CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %.loc15_30.2, constants.%DestroyOp.b0ebf8.2
  2314. // CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%.loc15_30.2)
  2315. // CHECK:STDOUT: %NoFields.cpp_destructor.bound.loc13: <bound method> = bound_method %.loc13_20.3, constants.%NoFields.cpp_destructor
  2316. // CHECK:STDOUT: %NoFields.cpp_destructor.call.loc13: init %empty_tuple.type = call %NoFields.cpp_destructor.bound.loc13(%.loc13_20.3)
  2317. // CHECK:STDOUT: %NoFields.cpp_destructor.bound.loc11: <bound method> = bound_method %.loc11_20.3, constants.%NoFields.cpp_destructor
  2318. // CHECK:STDOUT: %NoFields.cpp_destructor.call.loc11: init %empty_tuple.type = call %NoFields.cpp_destructor.bound.loc11(%.loc11_20.3)
  2319. // CHECK:STDOUT: %NoFields.cpp_destructor.bound.loc9: <bound method> = bound_method %.loc9_21.4, constants.%NoFields.cpp_destructor
  2320. // CHECK:STDOUT: %NoFields.cpp_destructor.call.loc9: init %empty_tuple.type = call %NoFields.cpp_destructor.bound.loc9(%.loc9_21.4)
  2321. // CHECK:STDOUT: return
  2322. // CHECK:STDOUT: }
  2323. // CHECK:STDOUT:
  2324. // CHECK:STDOUT: fn @PassNoFields(%s.param: %NoFields);
  2325. // CHECK:STDOUT:
  2326. // CHECK:STDOUT: fn @PassNoFields__carbon_thunk(%s.param: %ptr.dd0);
  2327. // CHECK:STDOUT:
  2328. // CHECK:STDOUT: fn @DestroyOp.loc15_30.1(%self.param: %NoFields) = "no_op";
  2329. // CHECK:STDOUT:
  2330. // CHECK:STDOUT: fn @NoFields.cpp_destructor(%self.param: %NoFields) = "no_op";
  2331. // CHECK:STDOUT:
  2332. // CHECK:STDOUT: fn @DestroyOp.loc15_30.2(%self.param: %empty_struct_type) = "no_op";
  2333. // CHECK:STDOUT:
  2334. // CHECK:STDOUT: --- fail_todo_struct_init_nonempty.carbon
  2335. // CHECK:STDOUT:
  2336. // CHECK:STDOUT: constants {
  2337. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2338. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2339. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2340. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2341. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2342. // CHECK:STDOUT: %struct_type.a.b.c.0b6: type = struct_type {.a: %i32, .b: %i32, .c: %i32} [concrete]
  2343. // CHECK:STDOUT: %.fc2: form = init_form %struct_type.a.b.c.0b6, call_param0 [concrete]
  2344. // CHECK:STDOUT: %pattern_type.8ae: type = pattern_type %struct_type.a.b.c.0b6 [concrete]
  2345. // CHECK:STDOUT: %MakeThreeFields.type: type = fn_type @MakeThreeFields [concrete]
  2346. // CHECK:STDOUT: %MakeThreeFields: %MakeThreeFields.type = struct_value () [concrete]
  2347. // CHECK:STDOUT: %ThreeFields.type: type = fn_type @ThreeFields.loc8 [concrete]
  2348. // CHECK:STDOUT: %ThreeFields.c3a: %ThreeFields.type = struct_value () [concrete]
  2349. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.type: type = cpp_overload_set_type @PassThreeFields.cpp_overload_set [concrete]
  2350. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete]
  2351. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  2352. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  2353. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  2354. // CHECK:STDOUT: %struct_type.a.b.c.90d: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral} [concrete]
  2355. // CHECK:STDOUT: %struct.ec0: %struct_type.a.b.c.90d = struct_value (%int_1, %int_2, %int_3) [concrete]
  2356. // CHECK:STDOUT: %ThreeFields.942: type = class_type @ThreeFields.1 [concrete]
  2357. // CHECK:STDOUT: %ptr.f81: type = ptr_type %ThreeFields.942 [concrete]
  2358. // CHECK:STDOUT: %pattern_type.7bb: type = pattern_type %ptr.f81 [concrete]
  2359. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.type: type = fn_type @PassThreeFields__carbon_thunk [concrete]
  2360. // CHECK:STDOUT: %PassThreeFields__carbon_thunk: %PassThreeFields__carbon_thunk.type = struct_value () [concrete]
  2361. // CHECK:STDOUT: %ThreeFields.elem: type = unbound_element_type %ThreeFields.942, %i32 [concrete]
  2362. // CHECK:STDOUT: %.c77: type = custom_layout_type {size=12, align=4, .a@0: %i32, .b@4: %i32, .c@8: %i32} [concrete]
  2363. // CHECK:STDOUT: %complete_type.702: <witness> = complete_type_witness %.c77 [concrete]
  2364. // CHECK:STDOUT: %struct_type.b.c.a: type = struct_type {.b: Core.IntLiteral, .c: Core.IntLiteral, .a: Core.IntLiteral} [concrete]
  2365. // CHECK:STDOUT: %struct.d34: %struct_type.b.c.a = struct_value (%int_1, %int_2, %int_3) [concrete]
  2366. // CHECK:STDOUT: }
  2367. // CHECK:STDOUT:
  2368. // CHECK:STDOUT: imports {
  2369. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2370. // CHECK:STDOUT: .Int = %Core.Int
  2371. // CHECK:STDOUT: import Core//prelude
  2372. // CHECK:STDOUT: import Core//prelude/...
  2373. // CHECK:STDOUT: }
  2374. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2375. // CHECK:STDOUT: .PassThreeFields = %PassThreeFields.cpp_overload_set.value
  2376. // CHECK:STDOUT: import Cpp//...
  2377. // CHECK:STDOUT: }
  2378. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  2379. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2380. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.decl: %PassThreeFields__carbon_thunk.type = fn_decl @PassThreeFields__carbon_thunk [concrete = constants.%PassThreeFields__carbon_thunk] {
  2381. // CHECK:STDOUT: %t.patt: %pattern_type.7bb = value_binding_pattern t [concrete]
  2382. // CHECK:STDOUT: %t.param_patt: %pattern_type.7bb = value_param_pattern %t.patt, call_param0 [concrete]
  2383. // CHECK:STDOUT: } {
  2384. // CHECK:STDOUT: %t.param: %ptr.f81 = value_param call_param0
  2385. // CHECK:STDOUT: %t: %ptr.f81 = value_binding t, %t.param
  2386. // CHECK:STDOUT: }
  2387. // CHECK:STDOUT: }
  2388. // CHECK:STDOUT:
  2389. // CHECK:STDOUT: file {
  2390. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2391. // CHECK:STDOUT: .Core = imports.%Core
  2392. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2393. // CHECK:STDOUT: .MakeThreeFields = %MakeThreeFields.decl
  2394. // CHECK:STDOUT: .ThreeFields = %ThreeFields.decl
  2395. // CHECK:STDOUT: }
  2396. // CHECK:STDOUT: %Core.import = import Core
  2397. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2398. // CHECK:STDOUT: import Cpp "struct_init.h"
  2399. // CHECK:STDOUT: }
  2400. // CHECK:STDOUT: %MakeThreeFields.decl: %MakeThreeFields.type = fn_decl @MakeThreeFields [concrete = constants.%MakeThreeFields] {
  2401. // CHECK:STDOUT: %return.patt: %pattern_type.8ae = return_slot_pattern [concrete]
  2402. // CHECK:STDOUT: %return.param_patt: %pattern_type.8ae = out_param_pattern %return.patt, call_param0 [concrete]
  2403. // CHECK:STDOUT: } {
  2404. // CHECK:STDOUT: %int_32.loc6_30: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2405. // CHECK:STDOUT: %i32.loc6_30: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2406. // CHECK:STDOUT: %int_32.loc6_39: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2407. // CHECK:STDOUT: %i32.loc6_39: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2408. // CHECK:STDOUT: %int_32.loc6_48: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2409. // CHECK:STDOUT: %i32.loc6_48: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2410. // CHECK:STDOUT: %struct_type.a.b.c: type = struct_type {.a: %i32, .b: %i32, .c: %i32} [concrete = constants.%struct_type.a.b.c.0b6]
  2411. // CHECK:STDOUT: %.loc6: form = init_form %struct_type.a.b.c, call_param0 [concrete = constants.%.fc2]
  2412. // CHECK:STDOUT: %return.param: ref %struct_type.a.b.c.0b6 = out_param call_param0
  2413. // CHECK:STDOUT: %return: ref %struct_type.a.b.c.0b6 = return_slot %return.param
  2414. // CHECK:STDOUT: }
  2415. // CHECK:STDOUT: %ThreeFields.decl: %ThreeFields.type = fn_decl @ThreeFields.loc8 [concrete = constants.%ThreeFields.c3a] {
  2416. // CHECK:STDOUT: %value.patt: %pattern_type.8ae = value_binding_pattern value [concrete]
  2417. // CHECK:STDOUT: %value.param_patt: %pattern_type.8ae = value_param_pattern %value.patt, call_param0 [concrete]
  2418. // CHECK:STDOUT: %reference.patt: %pattern_type.8ae = ref_binding_pattern reference [concrete]
  2419. // CHECK:STDOUT: %reference.param_patt: %pattern_type.8ae = ref_param_pattern %reference.patt, call_param1 [concrete]
  2420. // CHECK:STDOUT: } {
  2421. // CHECK:STDOUT: %value.param: %struct_type.a.b.c.0b6 = value_param call_param0
  2422. // CHECK:STDOUT: %.loc8_49: type = splice_block %struct_type.a.b.c.loc8_49 [concrete = constants.%struct_type.a.b.c.0b6] {
  2423. // CHECK:STDOUT: %int_32.loc8_28: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2424. // CHECK:STDOUT: %i32.loc8_28: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2425. // CHECK:STDOUT: %int_32.loc8_37: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2426. // CHECK:STDOUT: %i32.loc8_37: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2427. // CHECK:STDOUT: %int_32.loc8_46: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2428. // CHECK:STDOUT: %i32.loc8_46: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2429. // CHECK:STDOUT: %struct_type.a.b.c.loc8_49: type = struct_type {.a: %i32, .b: %i32, .c: %i32} [concrete = constants.%struct_type.a.b.c.0b6]
  2430. // CHECK:STDOUT: }
  2431. // CHECK:STDOUT: %value: %struct_type.a.b.c.0b6 = value_binding value, %value.param
  2432. // CHECK:STDOUT: %reference.param: ref %struct_type.a.b.c.0b6 = ref_param call_param1
  2433. // CHECK:STDOUT: %.loc8_93: type = splice_block %struct_type.a.b.c.loc8_93 [concrete = constants.%struct_type.a.b.c.0b6] {
  2434. // CHECK:STDOUT: %int_32.loc8_72: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2435. // CHECK:STDOUT: %i32.loc8_72: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2436. // CHECK:STDOUT: %int_32.loc8_81: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2437. // CHECK:STDOUT: %i32.loc8_81: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2438. // CHECK:STDOUT: %int_32.loc8_90: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2439. // CHECK:STDOUT: %i32.loc8_90: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2440. // CHECK:STDOUT: %struct_type.a.b.c.loc8_93: type = struct_type {.a: %i32, .b: %i32, .c: %i32} [concrete = constants.%struct_type.a.b.c.0b6]
  2441. // CHECK:STDOUT: }
  2442. // CHECK:STDOUT: %reference: ref %struct_type.a.b.c.0b6 = ref_binding reference, %reference.param
  2443. // CHECK:STDOUT: }
  2444. // CHECK:STDOUT: }
  2445. // CHECK:STDOUT:
  2446. // CHECK:STDOUT: class @ThreeFields.1 {
  2447. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2448. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2449. // CHECK:STDOUT: %.1: %ThreeFields.elem = field_decl a, element0 [concrete]
  2450. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2451. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2452. // CHECK:STDOUT: %.2: %ThreeFields.elem = field_decl b, element1 [concrete]
  2453. // CHECK:STDOUT: %int_32.3: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2454. // CHECK:STDOUT: %i32.3: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2455. // CHECK:STDOUT: %.3: %ThreeFields.elem = field_decl c, element2 [concrete]
  2456. // CHECK:STDOUT: %.4: type = custom_layout_type {size=12, align=4, .a@0: %i32, .b@4: %i32, .c@8: %i32} [concrete = constants.%.c77]
  2457. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %.4 [concrete = constants.%complete_type.702]
  2458. // CHECK:STDOUT: complete_type_witness = %complete_type
  2459. // CHECK:STDOUT:
  2460. // CHECK:STDOUT: !members:
  2461. // CHECK:STDOUT: import Cpp//...
  2462. // CHECK:STDOUT: }
  2463. // CHECK:STDOUT:
  2464. // CHECK:STDOUT: fn @MakeThreeFields() -> out %return.param: %struct_type.a.b.c.0b6;
  2465. // CHECK:STDOUT:
  2466. // CHECK:STDOUT: fn @ThreeFields.loc8(%value.param: %struct_type.a.b.c.0b6, %reference.param: %struct_type.a.b.c.0b6) {
  2467. // CHECK:STDOUT: !entry:
  2468. // CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2469. // CHECK:STDOUT: %PassThreeFields.ref.loc19: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2470. // CHECK:STDOUT: %int_1.loc19: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2471. // CHECK:STDOUT: %int_2.loc19: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  2472. // CHECK:STDOUT: %int_3.loc19: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  2473. // CHECK:STDOUT: %.loc19_46.1: %struct_type.a.b.c.90d = struct_literal (%int_1.loc19, %int_2.loc19, %int_3.loc19) [concrete = constants.%struct.ec0]
  2474. // CHECK:STDOUT: %.loc19_46.2: %ThreeFields.942 = converted %.loc19_46.1, <error> [concrete = <error>]
  2475. // CHECK:STDOUT: %addr.loc19: %ptr.f81 = addr_of <error> [concrete = <error>]
  2476. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc19: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc19)
  2477. // CHECK:STDOUT: %Cpp.ref.loc31: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2478. // CHECK:STDOUT: %PassThreeFields.ref.loc31: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2479. // CHECK:STDOUT: %value.ref: %struct_type.a.b.c.0b6 = name_ref value, %value
  2480. // CHECK:STDOUT: %.loc31: %ThreeFields.942 = converted %value.ref, <error> [concrete = <error>]
  2481. // CHECK:STDOUT: %addr.loc31: %ptr.f81 = addr_of <error> [concrete = <error>]
  2482. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc31: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc31)
  2483. // CHECK:STDOUT: %Cpp.ref.loc43: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2484. // CHECK:STDOUT: %PassThreeFields.ref.loc43: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2485. // CHECK:STDOUT: %reference.ref: ref %struct_type.a.b.c.0b6 = name_ref reference, %reference
  2486. // CHECK:STDOUT: %.loc43: %ThreeFields.942 = converted %reference.ref, <error> [concrete = <error>]
  2487. // CHECK:STDOUT: %addr.loc43: %ptr.f81 = addr_of <error> [concrete = <error>]
  2488. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc43: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc43)
  2489. // CHECK:STDOUT: %Cpp.ref.loc55: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2490. // CHECK:STDOUT: %PassThreeFields.ref.loc55: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2491. // CHECK:STDOUT: %MakeThreeFields.ref: %MakeThreeFields.type = name_ref MakeThreeFields, file.%MakeThreeFields.decl [concrete = constants.%MakeThreeFields]
  2492. // CHECK:STDOUT: %.loc55_39.1: ref %struct_type.a.b.c.0b6 = temporary_storage
  2493. // CHECK:STDOUT: %MakeThreeFields.call: init %struct_type.a.b.c.0b6 to %.loc55_39.1 = call %MakeThreeFields.ref()
  2494. // CHECK:STDOUT: %.loc55_39.2: %ThreeFields.942 = converted %MakeThreeFields.call, <error> [concrete = <error>]
  2495. // CHECK:STDOUT: %addr.loc55: %ptr.f81 = addr_of <error> [concrete = <error>]
  2496. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc55: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc55)
  2497. // CHECK:STDOUT: %Cpp.ref.loc67: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2498. // CHECK:STDOUT: %PassThreeFields.ref.loc67: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2499. // CHECK:STDOUT: %int_1.loc67: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2500. // CHECK:STDOUT: %int_2.loc67: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  2501. // CHECK:STDOUT: %int_3.loc67: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  2502. // CHECK:STDOUT: %.loc67_46.1: %struct_type.b.c.a = struct_literal (%int_1.loc67, %int_2.loc67, %int_3.loc67) [concrete = constants.%struct.d34]
  2503. // CHECK:STDOUT: %.loc67_46.2: %ThreeFields.942 = converted %.loc67_46.1, <error> [concrete = <error>]
  2504. // CHECK:STDOUT: %addr.loc67: %ptr.f81 = addr_of <error> [concrete = <error>]
  2505. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc67: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc67)
  2506. // CHECK:STDOUT: return
  2507. // CHECK:STDOUT: }
  2508. // CHECK:STDOUT:
  2509. // CHECK:STDOUT: fn @PassThreeFields(%t.param: %ThreeFields.942);
  2510. // CHECK:STDOUT:
  2511. // CHECK:STDOUT: fn @PassThreeFields__carbon_thunk(%t.param: %ptr.f81);
  2512. // CHECK:STDOUT:
  2513. // CHECK:STDOUT: --- fail_struct_init_field_mismatch.carbon
  2514. // CHECK:STDOUT:
  2515. // CHECK:STDOUT: constants {
  2516. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2517. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2518. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.type: type = cpp_overload_set_type @PassThreeFields.cpp_overload_set [concrete]
  2519. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete]
  2520. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  2521. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  2522. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  2523. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete]
  2524. // CHECK:STDOUT: %struct_type.a.b.c.d: type = struct_type {.a: Core.IntLiteral, .b: Core.IntLiteral, .c: Core.IntLiteral, .d: Core.IntLiteral} [concrete]
  2525. // CHECK:STDOUT: %struct.9a6: %struct_type.a.b.c.d = struct_value (%int_1, %int_2, %int_3, %int_4) [concrete]
  2526. // CHECK:STDOUT: %struct_type.a.x.c: type = struct_type {.a: Core.IntLiteral, .x: Core.IntLiteral, .c: Core.IntLiteral} [concrete]
  2527. // CHECK:STDOUT: %struct.11a: %struct_type.a.x.c = struct_value (%int_1, %int_2, %int_3) [concrete]
  2528. // CHECK:STDOUT: }
  2529. // CHECK:STDOUT:
  2530. // CHECK:STDOUT: imports {
  2531. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2532. // CHECK:STDOUT: import Core//prelude
  2533. // CHECK:STDOUT: import Core//prelude/...
  2534. // CHECK:STDOUT: }
  2535. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2536. // CHECK:STDOUT: .PassThreeFields = %PassThreeFields.cpp_overload_set.value
  2537. // CHECK:STDOUT: import Cpp//...
  2538. // CHECK:STDOUT: }
  2539. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2540. // CHECK:STDOUT: }
  2541. // CHECK:STDOUT:
  2542. // CHECK:STDOUT: file {
  2543. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2544. // CHECK:STDOUT: .Core = imports.%Core
  2545. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2546. // CHECK:STDOUT: .F = %F.decl
  2547. // CHECK:STDOUT: }
  2548. // CHECK:STDOUT: %Core.import = import Core
  2549. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2550. // CHECK:STDOUT: import Cpp "struct_init.h"
  2551. // CHECK:STDOUT: }
  2552. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2553. // CHECK:STDOUT: }
  2554. // CHECK:STDOUT:
  2555. // CHECK:STDOUT: fn @F() {
  2556. // CHECK:STDOUT: !entry:
  2557. // CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2558. // CHECK:STDOUT: %PassThreeFields.ref.loc15: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2559. // CHECK:STDOUT: %int_1.loc15: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2560. // CHECK:STDOUT: %int_2.loc15: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  2561. // CHECK:STDOUT: %int_3.loc15: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  2562. // CHECK:STDOUT: %int_4: Core.IntLiteral = int_value 4 [concrete = constants.%int_4]
  2563. // CHECK:STDOUT: %.loc15: %struct_type.a.b.c.d = struct_literal (%int_1.loc15, %int_2.loc15, %int_3.loc15, %int_4) [concrete = constants.%struct.9a6]
  2564. // CHECK:STDOUT: %Cpp.ref.loc25: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2565. // CHECK:STDOUT: %PassThreeFields.ref.loc25: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2566. // CHECK:STDOUT: %int_1.loc25: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2567. // CHECK:STDOUT: %int_2.loc25: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  2568. // CHECK:STDOUT: %int_3.loc25: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  2569. // CHECK:STDOUT: %.loc25: %struct_type.a.x.c = struct_literal (%int_1.loc25, %int_2.loc25, %int_3.loc25) [concrete = constants.%struct.11a]
  2570. // CHECK:STDOUT: return
  2571. // CHECK:STDOUT: }
  2572. // CHECK:STDOUT:
  2573. // CHECK:STDOUT: --- fail_struct_init_unsupported_field_name.carbon
  2574. // CHECK:STDOUT:
  2575. // CHECK:STDOUT: constants {
  2576. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2577. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2578. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.type: type = cpp_overload_set_type @PassThreeFields.cpp_overload_set [concrete]
  2579. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete]
  2580. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  2581. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: Core.IntLiteral} [concrete]
  2582. // CHECK:STDOUT: %struct: %struct_type.base = struct_value (%int_1) [concrete]
  2583. // CHECK:STDOUT: }
  2584. // CHECK:STDOUT:
  2585. // CHECK:STDOUT: imports {
  2586. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2587. // CHECK:STDOUT: import Core//prelude
  2588. // CHECK:STDOUT: import Core//prelude/...
  2589. // CHECK:STDOUT: }
  2590. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2591. // CHECK:STDOUT: .PassThreeFields = %PassThreeFields.cpp_overload_set.value
  2592. // CHECK:STDOUT: import Cpp//...
  2593. // CHECK:STDOUT: }
  2594. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2595. // CHECK:STDOUT: }
  2596. // CHECK:STDOUT:
  2597. // CHECK:STDOUT: file {
  2598. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2599. // CHECK:STDOUT: .Core = imports.%Core
  2600. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2601. // CHECK:STDOUT: .F = %F.decl
  2602. // CHECK:STDOUT: }
  2603. // CHECK:STDOUT: %Core.import = import Core
  2604. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2605. // CHECK:STDOUT: import Cpp "struct_init.h"
  2606. // CHECK:STDOUT: }
  2607. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2608. // CHECK:STDOUT: }
  2609. // CHECK:STDOUT:
  2610. // CHECK:STDOUT: fn @F() {
  2611. // CHECK:STDOUT: !entry:
  2612. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2613. // CHECK:STDOUT: %PassThreeFields.ref: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2614. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2615. // CHECK:STDOUT: %.loc11: %struct_type.base = struct_literal (%int_1) [concrete = constants.%struct]
  2616. // CHECK:STDOUT: return
  2617. // CHECK:STDOUT: }
  2618. // CHECK:STDOUT:
  2619. // CHECK:STDOUT: --- fail_struct_init_from_tuple.carbon
  2620. // CHECK:STDOUT:
  2621. // CHECK:STDOUT: constants {
  2622. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2623. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  2624. // CHECK:STDOUT: %.62c: form = init_form %empty_tuple.type, call_param0 [concrete]
  2625. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  2626. // CHECK:STDOUT: %MakeEmpty.type: type = fn_type @MakeEmpty [concrete]
  2627. // CHECK:STDOUT: %MakeEmpty: %MakeEmpty.type = struct_value () [concrete]
  2628. // CHECK:STDOUT: %Empty.type: type = fn_type @Empty [concrete]
  2629. // CHECK:STDOUT: %Empty: %Empty.type = struct_value () [concrete]
  2630. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.type: type = cpp_overload_set_type @PassNoFields.cpp_overload_set [concrete]
  2631. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.value: %PassNoFields.cpp_overload_set.type = cpp_overload_set_value @PassNoFields.cpp_overload_set [concrete]
  2632. // CHECK:STDOUT: %NoFields: type = class_type @NoFields [concrete]
  2633. // CHECK:STDOUT: %ptr.dd0: type = ptr_type %NoFields [concrete]
  2634. // CHECK:STDOUT: %pattern_type.a92: type = pattern_type %ptr.dd0 [concrete]
  2635. // CHECK:STDOUT: %PassNoFields__carbon_thunk.type: type = fn_type @PassNoFields__carbon_thunk [concrete]
  2636. // CHECK:STDOUT: %PassNoFields__carbon_thunk: %PassNoFields__carbon_thunk.type = struct_value () [concrete]
  2637. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  2638. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  2639. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2640. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2641. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2642. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2643. // CHECK:STDOUT: %tuple.type.ff9: type = tuple_type (type, type, type) [concrete]
  2644. // CHECK:STDOUT: %tuple.e64: %tuple.type.ff9 = tuple_value (%i32, %i32, %i32) [concrete]
  2645. // CHECK:STDOUT: %tuple.type.189: type = tuple_type (%i32, %i32, %i32) [concrete]
  2646. // CHECK:STDOUT: %.084: form = init_form %tuple.type.189, call_param0 [concrete]
  2647. // CHECK:STDOUT: %pattern_type.b5a: type = pattern_type %tuple.type.189 [concrete]
  2648. // CHECK:STDOUT: %MakeThreeFields.type: type = fn_type @MakeThreeFields [concrete]
  2649. // CHECK:STDOUT: %MakeThreeFields: %MakeThreeFields.type = struct_value () [concrete]
  2650. // CHECK:STDOUT: %ThreeFields.type: type = fn_type @ThreeFields.loc63 [concrete]
  2651. // CHECK:STDOUT: %ThreeFields.c3a: %ThreeFields.type = struct_value () [concrete]
  2652. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.type: type = cpp_overload_set_type @PassThreeFields.cpp_overload_set [concrete]
  2653. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete]
  2654. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  2655. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  2656. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  2657. // CHECK:STDOUT: %tuple.type.37f: type = tuple_type (Core.IntLiteral, Core.IntLiteral, Core.IntLiteral) [concrete]
  2658. // CHECK:STDOUT: %tuple.2d5: %tuple.type.37f = tuple_value (%int_1, %int_2, %int_3) [concrete]
  2659. // CHECK:STDOUT: %ThreeFields.942: type = class_type @ThreeFields.1 [concrete]
  2660. // CHECK:STDOUT: %ptr.f81: type = ptr_type %ThreeFields.942 [concrete]
  2661. // CHECK:STDOUT: %pattern_type.7bb: type = pattern_type %ptr.f81 [concrete]
  2662. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.type: type = fn_type @PassThreeFields__carbon_thunk [concrete]
  2663. // CHECK:STDOUT: %PassThreeFields__carbon_thunk: %PassThreeFields__carbon_thunk.type = struct_value () [concrete]
  2664. // CHECK:STDOUT: %ThreeFields.elem: type = unbound_element_type %ThreeFields.942, %i32 [concrete]
  2665. // CHECK:STDOUT: %.c77: type = custom_layout_type {size=12, align=4, .a@0: %i32, .b@4: %i32, .c@8: %i32} [concrete]
  2666. // CHECK:STDOUT: %complete_type.702: <witness> = complete_type_witness %.c77 [concrete]
  2667. // CHECK:STDOUT: }
  2668. // CHECK:STDOUT:
  2669. // CHECK:STDOUT: imports {
  2670. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2671. // CHECK:STDOUT: .Int = %Core.Int
  2672. // CHECK:STDOUT: import Core//prelude
  2673. // CHECK:STDOUT: import Core//prelude/...
  2674. // CHECK:STDOUT: }
  2675. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2676. // CHECK:STDOUT: .PassNoFields = %PassNoFields.cpp_overload_set.value
  2677. // CHECK:STDOUT: .PassThreeFields = %PassThreeFields.cpp_overload_set.value
  2678. // CHECK:STDOUT: import Cpp//...
  2679. // CHECK:STDOUT: }
  2680. // CHECK:STDOUT: %PassNoFields.cpp_overload_set.value: %PassNoFields.cpp_overload_set.type = cpp_overload_set_value @PassNoFields.cpp_overload_set [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2681. // CHECK:STDOUT: %PassNoFields__carbon_thunk.decl: %PassNoFields__carbon_thunk.type = fn_decl @PassNoFields__carbon_thunk [concrete = constants.%PassNoFields__carbon_thunk] {
  2682. // CHECK:STDOUT: %s.patt: %pattern_type.a92 = value_binding_pattern s [concrete]
  2683. // CHECK:STDOUT: %s.param_patt: %pattern_type.a92 = value_param_pattern %s.patt, call_param0 [concrete]
  2684. // CHECK:STDOUT: } {
  2685. // CHECK:STDOUT: %s.param: %ptr.dd0 = value_param call_param0
  2686. // CHECK:STDOUT: %s: %ptr.dd0 = value_binding s, %s.param
  2687. // CHECK:STDOUT: }
  2688. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  2689. // CHECK:STDOUT: %PassThreeFields.cpp_overload_set.value: %PassThreeFields.cpp_overload_set.type = cpp_overload_set_value @PassThreeFields.cpp_overload_set [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2690. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.decl: %PassThreeFields__carbon_thunk.type = fn_decl @PassThreeFields__carbon_thunk [concrete = constants.%PassThreeFields__carbon_thunk] {
  2691. // CHECK:STDOUT: %t.patt: %pattern_type.7bb = value_binding_pattern t [concrete]
  2692. // CHECK:STDOUT: %t.param_patt: %pattern_type.7bb = value_param_pattern %t.patt, call_param0 [concrete]
  2693. // CHECK:STDOUT: } {
  2694. // CHECK:STDOUT: %t.param: %ptr.f81 = value_param call_param0
  2695. // CHECK:STDOUT: %t: %ptr.f81 = value_binding t, %t.param
  2696. // CHECK:STDOUT: }
  2697. // CHECK:STDOUT: }
  2698. // CHECK:STDOUT:
  2699. // CHECK:STDOUT: file {
  2700. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2701. // CHECK:STDOUT: .Core = imports.%Core
  2702. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2703. // CHECK:STDOUT: .MakeEmpty = %MakeEmpty.decl
  2704. // CHECK:STDOUT: .Empty = %Empty.decl
  2705. // CHECK:STDOUT: .MakeThreeFields = %MakeThreeFields.decl
  2706. // CHECK:STDOUT: .ThreeFields = %ThreeFields.decl
  2707. // CHECK:STDOUT: }
  2708. // CHECK:STDOUT: %Core.import = import Core
  2709. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2710. // CHECK:STDOUT: import Cpp "struct_init.h"
  2711. // CHECK:STDOUT: }
  2712. // CHECK:STDOUT: %MakeEmpty.decl: %MakeEmpty.type = fn_decl @MakeEmpty [concrete = constants.%MakeEmpty] {
  2713. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern [concrete]
  2714. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern %return.patt, call_param0 [concrete]
  2715. // CHECK:STDOUT: } {
  2716. // CHECK:STDOUT: %.loc9_20.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  2717. // CHECK:STDOUT: %.loc9_20.2: type = converted %.loc9_20.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  2718. // CHECK:STDOUT: %.loc9_20.3: form = init_form %.loc9_20.2, call_param0 [concrete = constants.%.62c]
  2719. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  2720. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  2721. // CHECK:STDOUT: }
  2722. // CHECK:STDOUT: %Empty.decl: %Empty.type = fn_decl @Empty [concrete = constants.%Empty] {
  2723. // CHECK:STDOUT: %value.patt: %pattern_type.cb1 = value_binding_pattern value [concrete]
  2724. // CHECK:STDOUT: %value.param_patt: %pattern_type.cb1 = value_param_pattern %value.patt, call_param0 [concrete]
  2725. // CHECK:STDOUT: %reference.patt: %pattern_type.cb1 = ref_binding_pattern reference [concrete]
  2726. // CHECK:STDOUT: %reference.param_patt: %pattern_type.cb1 = ref_param_pattern %reference.patt, call_param1 [concrete]
  2727. // CHECK:STDOUT: } {
  2728. // CHECK:STDOUT: %value.param: %empty_tuple.type = value_param call_param0
  2729. // CHECK:STDOUT: %.loc11_18.1: type = splice_block %.loc11_18.3 [concrete = constants.%empty_tuple.type] {
  2730. // CHECK:STDOUT: %.loc11_18.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  2731. // CHECK:STDOUT: %.loc11_18.3: type = converted %.loc11_18.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  2732. // CHECK:STDOUT: }
  2733. // CHECK:STDOUT: %value: %empty_tuple.type = value_binding value, %value.param
  2734. // CHECK:STDOUT: %reference.param: ref %empty_tuple.type = ref_param call_param1
  2735. // CHECK:STDOUT: %.loc11_37.1: type = splice_block %.loc11_37.3 [concrete = constants.%empty_tuple.type] {
  2736. // CHECK:STDOUT: %.loc11_37.2: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  2737. // CHECK:STDOUT: %.loc11_37.3: type = converted %.loc11_37.2, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  2738. // CHECK:STDOUT: }
  2739. // CHECK:STDOUT: %reference: ref %empty_tuple.type = ref_binding reference, %reference.param
  2740. // CHECK:STDOUT: }
  2741. // CHECK:STDOUT: %MakeThreeFields.decl: %MakeThreeFields.type = fn_decl @MakeThreeFields [concrete = constants.%MakeThreeFields] {
  2742. // CHECK:STDOUT: %return.patt: %pattern_type.b5a = return_slot_pattern [concrete]
  2743. // CHECK:STDOUT: %return.param_patt: %pattern_type.b5a = out_param_pattern %return.patt, call_param0 [concrete]
  2744. // CHECK:STDOUT: } {
  2745. // CHECK:STDOUT: %int_32.loc61_26: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2746. // CHECK:STDOUT: %i32.loc61_26: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2747. // CHECK:STDOUT: %int_32.loc61_31: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2748. // CHECK:STDOUT: %i32.loc61_31: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2749. // CHECK:STDOUT: %int_32.loc61_36: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2750. // CHECK:STDOUT: %i32.loc61_36: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2751. // CHECK:STDOUT: %.loc61_39.1: %tuple.type.ff9 = tuple_literal (%i32.loc61_26, %i32.loc61_31, %i32.loc61_36) [concrete = constants.%tuple.e64]
  2752. // CHECK:STDOUT: %.loc61_39.2: type = converted %.loc61_39.1, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  2753. // CHECK:STDOUT: %.loc61_39.3: form = init_form %.loc61_39.2, call_param0 [concrete = constants.%.084]
  2754. // CHECK:STDOUT: %return.param: ref %tuple.type.189 = out_param call_param0
  2755. // CHECK:STDOUT: %return: ref %tuple.type.189 = return_slot %return.param
  2756. // CHECK:STDOUT: }
  2757. // CHECK:STDOUT: %ThreeFields.decl: %ThreeFields.type = fn_decl @ThreeFields.loc63 [concrete = constants.%ThreeFields.c3a] {
  2758. // CHECK:STDOUT: %value.patt: %pattern_type.b5a = value_binding_pattern value [concrete]
  2759. // CHECK:STDOUT: %value.param_patt: %pattern_type.b5a = value_param_pattern %value.patt, call_param0 [concrete]
  2760. // CHECK:STDOUT: %reference.patt: %pattern_type.b5a = ref_binding_pattern reference [concrete]
  2761. // CHECK:STDOUT: %reference.param_patt: %pattern_type.b5a = ref_param_pattern %reference.patt, call_param1 [concrete]
  2762. // CHECK:STDOUT: } {
  2763. // CHECK:STDOUT: %value.param: %tuple.type.189 = value_param call_param0
  2764. // CHECK:STDOUT: %.loc63_37.1: type = splice_block %.loc63_37.3 [concrete = constants.%tuple.type.189] {
  2765. // CHECK:STDOUT: %int_32.loc63_24: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2766. // CHECK:STDOUT: %i32.loc63_24: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2767. // CHECK:STDOUT: %int_32.loc63_29: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2768. // CHECK:STDOUT: %i32.loc63_29: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2769. // CHECK:STDOUT: %int_32.loc63_34: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2770. // CHECK:STDOUT: %i32.loc63_34: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2771. // CHECK:STDOUT: %.loc63_37.2: %tuple.type.ff9 = tuple_literal (%i32.loc63_24, %i32.loc63_29, %i32.loc63_34) [concrete = constants.%tuple.e64]
  2772. // CHECK:STDOUT: %.loc63_37.3: type = converted %.loc63_37.2, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  2773. // CHECK:STDOUT: }
  2774. // CHECK:STDOUT: %value: %tuple.type.189 = value_binding value, %value.param
  2775. // CHECK:STDOUT: %reference.param: ref %tuple.type.189 = ref_param call_param1
  2776. // CHECK:STDOUT: %.loc63_69.1: type = splice_block %.loc63_69.3 [concrete = constants.%tuple.type.189] {
  2777. // CHECK:STDOUT: %int_32.loc63_56: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2778. // CHECK:STDOUT: %i32.loc63_56: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2779. // CHECK:STDOUT: %int_32.loc63_61: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2780. // CHECK:STDOUT: %i32.loc63_61: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2781. // CHECK:STDOUT: %int_32.loc63_66: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2782. // CHECK:STDOUT: %i32.loc63_66: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2783. // CHECK:STDOUT: %.loc63_69.2: %tuple.type.ff9 = tuple_literal (%i32.loc63_56, %i32.loc63_61, %i32.loc63_66) [concrete = constants.%tuple.e64]
  2784. // CHECK:STDOUT: %.loc63_69.3: type = converted %.loc63_69.2, constants.%tuple.type.189 [concrete = constants.%tuple.type.189]
  2785. // CHECK:STDOUT: }
  2786. // CHECK:STDOUT: %reference: ref %tuple.type.189 = ref_binding reference, %reference.param
  2787. // CHECK:STDOUT: }
  2788. // CHECK:STDOUT: }
  2789. // CHECK:STDOUT:
  2790. // CHECK:STDOUT: class @NoFields {
  2791. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  2792. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  2793. // CHECK:STDOUT: complete_type_witness = %complete_type
  2794. // CHECK:STDOUT:
  2795. // CHECK:STDOUT: !members:
  2796. // CHECK:STDOUT: import Cpp//...
  2797. // CHECK:STDOUT: }
  2798. // CHECK:STDOUT:
  2799. // CHECK:STDOUT: class @ThreeFields.1 {
  2800. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2801. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2802. // CHECK:STDOUT: %.1: %ThreeFields.elem = field_decl a, element0 [concrete]
  2803. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2804. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2805. // CHECK:STDOUT: %.2: %ThreeFields.elem = field_decl b, element1 [concrete]
  2806. // CHECK:STDOUT: %int_32.3: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2807. // CHECK:STDOUT: %i32.3: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2808. // CHECK:STDOUT: %.3: %ThreeFields.elem = field_decl c, element2 [concrete]
  2809. // CHECK:STDOUT: %.4: type = custom_layout_type {size=12, align=4, .a@0: %i32, .b@4: %i32, .c@8: %i32} [concrete = constants.%.c77]
  2810. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %.4 [concrete = constants.%complete_type.702]
  2811. // CHECK:STDOUT: complete_type_witness = %complete_type
  2812. // CHECK:STDOUT:
  2813. // CHECK:STDOUT: !members:
  2814. // CHECK:STDOUT: import Cpp//...
  2815. // CHECK:STDOUT: }
  2816. // CHECK:STDOUT:
  2817. // CHECK:STDOUT: fn @MakeEmpty() -> out %return.param: %empty_tuple.type;
  2818. // CHECK:STDOUT:
  2819. // CHECK:STDOUT: fn @Empty(%value.param: %empty_tuple.type, %reference.param: %empty_tuple.type) {
  2820. // CHECK:STDOUT: !entry:
  2821. // CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2822. // CHECK:STDOUT: %PassNoFields.ref.loc22: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2823. // CHECK:STDOUT: %.loc22_21.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  2824. // CHECK:STDOUT: %.loc22_21.2: %NoFields = converted %.loc22_21.1, <error> [concrete = <error>]
  2825. // CHECK:STDOUT: %addr.loc22: %ptr.dd0 = addr_of <error> [concrete = <error>]
  2826. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc22: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc22)
  2827. // CHECK:STDOUT: %Cpp.ref.loc34: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2828. // CHECK:STDOUT: %PassNoFields.ref.loc34: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2829. // CHECK:STDOUT: %value.ref: %empty_tuple.type = name_ref value, %value
  2830. // CHECK:STDOUT: %.loc34: %NoFields = converted %value.ref, <error> [concrete = <error>]
  2831. // CHECK:STDOUT: %addr.loc34: %ptr.dd0 = addr_of <error> [concrete = <error>]
  2832. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc34: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc34)
  2833. // CHECK:STDOUT: %Cpp.ref.loc46: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2834. // CHECK:STDOUT: %PassNoFields.ref.loc46: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2835. // CHECK:STDOUT: %reference.ref: ref %empty_tuple.type = name_ref reference, %reference
  2836. // CHECK:STDOUT: %.loc46: %NoFields = converted %reference.ref, <error> [concrete = <error>]
  2837. // CHECK:STDOUT: %addr.loc46: %ptr.dd0 = addr_of <error> [concrete = <error>]
  2838. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc46: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc46)
  2839. // CHECK:STDOUT: %Cpp.ref.loc58: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2840. // CHECK:STDOUT: %PassNoFields.ref.loc58: %PassNoFields.cpp_overload_set.type = name_ref PassNoFields, imports.%PassNoFields.cpp_overload_set.value [concrete = constants.%PassNoFields.cpp_overload_set.value]
  2841. // CHECK:STDOUT: %MakeEmpty.ref: %MakeEmpty.type = name_ref MakeEmpty, file.%MakeEmpty.decl [concrete = constants.%MakeEmpty]
  2842. // CHECK:STDOUT: %MakeEmpty.call: init %empty_tuple.type = call %MakeEmpty.ref()
  2843. // CHECK:STDOUT: %.loc58: %NoFields = converted %MakeEmpty.call, <error> [concrete = <error>]
  2844. // CHECK:STDOUT: %addr.loc58: %ptr.dd0 = addr_of <error> [concrete = <error>]
  2845. // CHECK:STDOUT: %PassNoFields__carbon_thunk.call.loc58: init %empty_tuple.type = call imports.%PassNoFields__carbon_thunk.decl(%addr.loc58)
  2846. // CHECK:STDOUT: return
  2847. // CHECK:STDOUT: }
  2848. // CHECK:STDOUT:
  2849. // CHECK:STDOUT: fn @PassNoFields(%s.param: %NoFields);
  2850. // CHECK:STDOUT:
  2851. // CHECK:STDOUT: fn @PassNoFields__carbon_thunk(%s.param: %ptr.dd0);
  2852. // CHECK:STDOUT:
  2853. // CHECK:STDOUT: fn @MakeThreeFields() -> out %return.param: %tuple.type.189;
  2854. // CHECK:STDOUT:
  2855. // CHECK:STDOUT: fn @ThreeFields.loc63(%value.param: %tuple.type.189, %reference.param: %tuple.type.189) {
  2856. // CHECK:STDOUT: !entry:
  2857. // CHECK:STDOUT: %Cpp.ref.loc74: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2858. // CHECK:STDOUT: %PassThreeFields.ref.loc74: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2859. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  2860. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  2861. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  2862. // CHECK:STDOUT: %.loc74_31.1: %tuple.type.37f = tuple_literal (%int_1, %int_2, %int_3) [concrete = constants.%tuple.2d5]
  2863. // CHECK:STDOUT: %.loc74_31.2: %ThreeFields.942 = converted %.loc74_31.1, <error> [concrete = <error>]
  2864. // CHECK:STDOUT: %addr.loc74: %ptr.f81 = addr_of <error> [concrete = <error>]
  2865. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc74: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc74)
  2866. // CHECK:STDOUT: %Cpp.ref.loc86: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2867. // CHECK:STDOUT: %PassThreeFields.ref.loc86: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2868. // CHECK:STDOUT: %value.ref: %tuple.type.189 = name_ref value, %value
  2869. // CHECK:STDOUT: %.loc86: %ThreeFields.942 = converted %value.ref, <error> [concrete = <error>]
  2870. // CHECK:STDOUT: %addr.loc86: %ptr.f81 = addr_of <error> [concrete = <error>]
  2871. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc86: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc86)
  2872. // CHECK:STDOUT: %Cpp.ref.loc98: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2873. // CHECK:STDOUT: %PassThreeFields.ref.loc98: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2874. // CHECK:STDOUT: %reference.ref: ref %tuple.type.189 = name_ref reference, %reference
  2875. // CHECK:STDOUT: %.loc98: %ThreeFields.942 = converted %reference.ref, <error> [concrete = <error>]
  2876. // CHECK:STDOUT: %addr.loc98: %ptr.f81 = addr_of <error> [concrete = <error>]
  2877. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc98: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc98)
  2878. // CHECK:STDOUT: %Cpp.ref.loc110: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2879. // CHECK:STDOUT: %PassThreeFields.ref.loc110: %PassThreeFields.cpp_overload_set.type = name_ref PassThreeFields, imports.%PassThreeFields.cpp_overload_set.value [concrete = constants.%PassThreeFields.cpp_overload_set.value]
  2880. // CHECK:STDOUT: %MakeThreeFields.ref: %MakeThreeFields.type = name_ref MakeThreeFields, file.%MakeThreeFields.decl [concrete = constants.%MakeThreeFields]
  2881. // CHECK:STDOUT: %.loc110_39.1: ref %tuple.type.189 = temporary_storage
  2882. // CHECK:STDOUT: %MakeThreeFields.call: init %tuple.type.189 to %.loc110_39.1 = call %MakeThreeFields.ref()
  2883. // CHECK:STDOUT: %.loc110_39.2: %ThreeFields.942 = converted %MakeThreeFields.call, <error> [concrete = <error>]
  2884. // CHECK:STDOUT: %addr.loc110: %ptr.f81 = addr_of <error> [concrete = <error>]
  2885. // CHECK:STDOUT: %PassThreeFields__carbon_thunk.call.loc110: init %empty_tuple.type = call imports.%PassThreeFields__carbon_thunk.decl(%addr.loc110)
  2886. // CHECK:STDOUT: return
  2887. // CHECK:STDOUT: }
  2888. // CHECK:STDOUT:
  2889. // CHECK:STDOUT: fn @PassThreeFields(%t.param: %ThreeFields.942);
  2890. // CHECK:STDOUT:
  2891. // CHECK:STDOUT: fn @PassThreeFields__carbon_thunk(%t.param: %ptr.f81);
  2892. // CHECK:STDOUT:
  2893. // CHECK:STDOUT: --- fail_int_from_struct.carbon
  2894. // CHECK:STDOUT:
  2895. // CHECK:STDOUT: constants {
  2896. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2897. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2898. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2899. // CHECK:STDOUT: %PassInt.cpp_overload_set.type: type = cpp_overload_set_type @PassInt.cpp_overload_set [concrete]
  2900. // CHECK:STDOUT: %PassInt.cpp_overload_set.value: %PassInt.cpp_overload_set.type = cpp_overload_set_value @PassInt.cpp_overload_set [concrete]
  2901. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  2902. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  2903. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2904. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2905. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2906. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2907. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  2908. // CHECK:STDOUT: %PassInt.type: type = fn_type @PassInt [concrete]
  2909. // CHECK:STDOUT: %PassInt: %PassInt.type = struct_value () [concrete]
  2910. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2911. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2912. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  2913. // CHECK:STDOUT: }
  2914. // CHECK:STDOUT:
  2915. // CHECK:STDOUT: imports {
  2916. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2917. // CHECK:STDOUT: .Int = %Core.Int
  2918. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2919. // CHECK:STDOUT: import Core//prelude
  2920. // CHECK:STDOUT: import Core//prelude/...
  2921. // CHECK:STDOUT: }
  2922. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2923. // CHECK:STDOUT: .PassInt = %PassInt.cpp_overload_set.value
  2924. // CHECK:STDOUT: import Cpp//...
  2925. // CHECK:STDOUT: }
  2926. // CHECK:STDOUT: %PassInt.cpp_overload_set.value: %PassInt.cpp_overload_set.type = cpp_overload_set_value @PassInt.cpp_overload_set [concrete = constants.%PassInt.cpp_overload_set.value]
  2927. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  2928. // CHECK:STDOUT: %PassInt.decl: %PassInt.type = fn_decl @PassInt [concrete = constants.%PassInt] {
  2929. // CHECK:STDOUT: %n.patt: %pattern_type.7ce = value_binding_pattern n [concrete]
  2930. // CHECK:STDOUT: %n.param_patt: %pattern_type.7ce = value_param_pattern %n.patt, call_param0 [concrete]
  2931. // CHECK:STDOUT: } {
  2932. // CHECK:STDOUT: %n.param: %i32 = value_param call_param0
  2933. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  2934. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  2935. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  2936. // CHECK:STDOUT: }
  2937. // CHECK:STDOUT: %n: %i32 = value_binding n, %n.param
  2938. // CHECK:STDOUT: }
  2939. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  2940. // CHECK:STDOUT: }
  2941. // CHECK:STDOUT:
  2942. // CHECK:STDOUT: file {
  2943. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  2944. // CHECK:STDOUT: .Core = imports.%Core
  2945. // CHECK:STDOUT: .Cpp = imports.%Cpp
  2946. // CHECK:STDOUT: .F = %F.decl
  2947. // CHECK:STDOUT: }
  2948. // CHECK:STDOUT: %Core.import = import Core
  2949. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  2950. // CHECK:STDOUT: import Cpp "int_from_struct.h"
  2951. // CHECK:STDOUT: }
  2952. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  2953. // CHECK:STDOUT: }
  2954. // CHECK:STDOUT:
  2955. // CHECK:STDOUT: fn @F() {
  2956. // CHECK:STDOUT: !entry:
  2957. // CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2958. // CHECK:STDOUT: %PassInt.ref.loc20: %PassInt.cpp_overload_set.type = name_ref PassInt, imports.%PassInt.cpp_overload_set.value [concrete = constants.%PassInt.cpp_overload_set.value]
  2959. // CHECK:STDOUT: %.loc20_16.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  2960. // CHECK:STDOUT: %.loc20_16.2: %i32 = converted %.loc20_16.1, <error> [concrete = <error>]
  2961. // CHECK:STDOUT: %PassInt.call.loc20: init %empty_tuple.type = call imports.%PassInt.decl(<error>)
  2962. // CHECK:STDOUT: %Cpp.ref.loc33: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2963. // CHECK:STDOUT: %PassInt.ref.loc33: %PassInt.cpp_overload_set.type = name_ref PassInt, imports.%PassInt.cpp_overload_set.value [concrete = constants.%PassInt.cpp_overload_set.value]
  2964. // CHECK:STDOUT: %.loc33_16.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  2965. // CHECK:STDOUT: %.loc33_16.2: %i32 = converted %.loc33_16.1, <error> [concrete = <error>]
  2966. // CHECK:STDOUT: %PassInt.call.loc33: init %empty_tuple.type = call imports.%PassInt.decl(<error>)
  2967. // CHECK:STDOUT: return
  2968. // CHECK:STDOUT: }
  2969. // CHECK:STDOUT:
  2970. // CHECK:STDOUT: fn @PassInt(%n.param: %i32);
  2971. // CHECK:STDOUT:
  2972. // CHECK:STDOUT: --- fail_int_from_struct_overloaded.carbon
  2973. // CHECK:STDOUT:
  2974. // CHECK:STDOUT: constants {
  2975. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  2976. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2977. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  2978. // CHECK:STDOUT: %PassOverloaded.cpp_overload_set.type: type = cpp_overload_set_type @PassOverloaded.cpp_overload_set [concrete]
  2979. // CHECK:STDOUT: %PassOverloaded.cpp_overload_set.value: %PassOverloaded.cpp_overload_set.type = cpp_overload_set_value @PassOverloaded.cpp_overload_set [concrete]
  2980. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  2981. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  2982. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2983. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  2984. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  2985. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2986. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  2987. // CHECK:STDOUT: %PassOverloaded.type: type = fn_type @PassOverloaded [concrete]
  2988. // CHECK:STDOUT: %PassOverloaded: %PassOverloaded.type = struct_value () [concrete]
  2989. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  2990. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  2991. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  2992. // CHECK:STDOUT: }
  2993. // CHECK:STDOUT:
  2994. // CHECK:STDOUT: imports {
  2995. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  2996. // CHECK:STDOUT: .Int = %Core.Int
  2997. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  2998. // CHECK:STDOUT: import Core//prelude
  2999. // CHECK:STDOUT: import Core//prelude/...
  3000. // CHECK:STDOUT: }
  3001. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3002. // CHECK:STDOUT: .PassOverloaded = %PassOverloaded.cpp_overload_set.value
  3003. // CHECK:STDOUT: import Cpp//...
  3004. // CHECK:STDOUT: }
  3005. // CHECK:STDOUT: %PassOverloaded.cpp_overload_set.value: %PassOverloaded.cpp_overload_set.type = cpp_overload_set_value @PassOverloaded.cpp_overload_set [concrete = constants.%PassOverloaded.cpp_overload_set.value]
  3006. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3007. // CHECK:STDOUT: %PassOverloaded.decl: %PassOverloaded.type = fn_decl @PassOverloaded [concrete = constants.%PassOverloaded] {
  3008. // CHECK:STDOUT: %n.patt: %pattern_type.7ce = value_binding_pattern n [concrete]
  3009. // CHECK:STDOUT: %n.param_patt: %pattern_type.7ce = value_param_pattern %n.patt, call_param0 [concrete]
  3010. // CHECK:STDOUT: } {
  3011. // CHECK:STDOUT: %n.param: %i32 = value_param call_param0
  3012. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  3013. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3014. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3015. // CHECK:STDOUT: }
  3016. // CHECK:STDOUT: %n: %i32 = value_binding n, %n.param
  3017. // CHECK:STDOUT: }
  3018. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3019. // CHECK:STDOUT: }
  3020. // CHECK:STDOUT:
  3021. // CHECK:STDOUT: file {
  3022. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3023. // CHECK:STDOUT: .Core = imports.%Core
  3024. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3025. // CHECK:STDOUT: .F = %F.decl
  3026. // CHECK:STDOUT: }
  3027. // CHECK:STDOUT: %Core.import = import Core
  3028. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3029. // CHECK:STDOUT: import Cpp "int_from_struct.h"
  3030. // CHECK:STDOUT: }
  3031. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3032. // CHECK:STDOUT: }
  3033. // CHECK:STDOUT:
  3034. // CHECK:STDOUT: fn @F() {
  3035. // CHECK:STDOUT: !entry:
  3036. // CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3037. // CHECK:STDOUT: %PassOverloaded.ref.loc21: %PassOverloaded.cpp_overload_set.type = name_ref PassOverloaded, imports.%PassOverloaded.cpp_overload_set.value [concrete = constants.%PassOverloaded.cpp_overload_set.value]
  3038. // CHECK:STDOUT: %.loc21_23.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  3039. // CHECK:STDOUT: %.loc21_23.2: %i32 = converted %.loc21_23.1, <error> [concrete = <error>]
  3040. // CHECK:STDOUT: %PassOverloaded.call.loc21: init %empty_tuple.type = call imports.%PassOverloaded.decl(<error>)
  3041. // CHECK:STDOUT: %Cpp.ref.loc34: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3042. // CHECK:STDOUT: %PassOverloaded.ref.loc34: %PassOverloaded.cpp_overload_set.type = name_ref PassOverloaded, imports.%PassOverloaded.cpp_overload_set.value [concrete = constants.%PassOverloaded.cpp_overload_set.value]
  3043. // CHECK:STDOUT: %.loc34_23.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  3044. // CHECK:STDOUT: %.loc34_23.2: %i32 = converted %.loc34_23.1, <error> [concrete = <error>]
  3045. // CHECK:STDOUT: %PassOverloaded.call.loc34: init %empty_tuple.type = call imports.%PassOverloaded.decl(<error>)
  3046. // CHECK:STDOUT: return
  3047. // CHECK:STDOUT: }
  3048. // CHECK:STDOUT:
  3049. // CHECK:STDOUT: fn @PassOverloaded(%n.param: %i32);
  3050. // CHECK:STDOUT:
  3051. // CHECK:STDOUT: --- fail_pass_nested_structs_inner_field_mismatch.carbon
  3052. // CHECK:STDOUT:
  3053. // CHECK:STDOUT: constants {
  3054. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3055. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3056. // CHECK:STDOUT: %TakeB.cpp_overload_set.type: type = cpp_overload_set_type @TakeB.cpp_overload_set [concrete]
  3057. // CHECK:STDOUT: %TakeB.cpp_overload_set.value: %TakeB.cpp_overload_set.type = cpp_overload_set_value @TakeB.cpp_overload_set [concrete]
  3058. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  3059. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  3060. // CHECK:STDOUT: %struct_type.x.z: type = struct_type {.x: Core.IntLiteral, .z: Core.IntLiteral} [concrete]
  3061. // CHECK:STDOUT: %struct.c50: %struct_type.x.z = struct_value (%int_1, %int_2) [concrete]
  3062. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  3063. // CHECK:STDOUT: %struct_type.a.n: type = struct_type {.a: %struct_type.x.z, .n: Core.IntLiteral} [concrete]
  3064. // CHECK:STDOUT: %struct.7ea: %struct_type.a.n = struct_value (%struct.c50, %int_3) [concrete]
  3065. // CHECK:STDOUT: }
  3066. // CHECK:STDOUT:
  3067. // CHECK:STDOUT: imports {
  3068. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3069. // CHECK:STDOUT: import Core//prelude
  3070. // CHECK:STDOUT: import Core//prelude/...
  3071. // CHECK:STDOUT: }
  3072. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3073. // CHECK:STDOUT: .TakeB = %TakeB.cpp_overload_set.value
  3074. // CHECK:STDOUT: import Cpp//...
  3075. // CHECK:STDOUT: }
  3076. // CHECK:STDOUT: %TakeB.cpp_overload_set.value: %TakeB.cpp_overload_set.type = cpp_overload_set_value @TakeB.cpp_overload_set [concrete = constants.%TakeB.cpp_overload_set.value]
  3077. // CHECK:STDOUT: }
  3078. // CHECK:STDOUT:
  3079. // CHECK:STDOUT: file {
  3080. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3081. // CHECK:STDOUT: .Core = imports.%Core
  3082. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3083. // CHECK:STDOUT: .F = %F.decl
  3084. // CHECK:STDOUT: }
  3085. // CHECK:STDOUT: %Core.import = import Core
  3086. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3087. // CHECK:STDOUT: import Cpp "nested_structs.h"
  3088. // CHECK:STDOUT: }
  3089. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3090. // CHECK:STDOUT: }
  3091. // CHECK:STDOUT:
  3092. // CHECK:STDOUT: fn @F() {
  3093. // CHECK:STDOUT: !entry:
  3094. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3095. // CHECK:STDOUT: %TakeB.ref: %TakeB.cpp_overload_set.type = name_ref TakeB, imports.%TakeB.cpp_overload_set.value [concrete = constants.%TakeB.cpp_overload_set.value]
  3096. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  3097. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  3098. // CHECK:STDOUT: %.loc15_34: %struct_type.x.z = struct_literal (%int_1, %int_2) [concrete = constants.%struct.c50]
  3099. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  3100. // CHECK:STDOUT: %.loc15_43: %struct_type.a.n = struct_literal (%.loc15_34, %int_3) [concrete = constants.%struct.7ea]
  3101. // CHECK:STDOUT: return
  3102. // CHECK:STDOUT: }
  3103. // CHECK:STDOUT:
  3104. // CHECK:STDOUT: --- fail_todo_pass_nested_structs.carbon
  3105. // CHECK:STDOUT:
  3106. // CHECK:STDOUT: constants {
  3107. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3108. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  3109. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3110. // CHECK:STDOUT: %TakeB.cpp_overload_set.type: type = cpp_overload_set_type @TakeB.cpp_overload_set [concrete]
  3111. // CHECK:STDOUT: %TakeB.cpp_overload_set.value: %TakeB.cpp_overload_set.type = cpp_overload_set_value @TakeB.cpp_overload_set [concrete]
  3112. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete]
  3113. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete]
  3114. // CHECK:STDOUT: %struct_type.x.y: type = struct_type {.x: Core.IntLiteral, .y: Core.IntLiteral} [concrete]
  3115. // CHECK:STDOUT: %struct.004: %struct_type.x.y = struct_value (%int_1, %int_2) [concrete]
  3116. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete]
  3117. // CHECK:STDOUT: %struct_type.a.n.988: type = struct_type {.a: %struct_type.x.y, .n: Core.IntLiteral} [concrete]
  3118. // CHECK:STDOUT: %struct.516: %struct_type.a.n.988 = struct_value (%struct.004, %int_3) [concrete]
  3119. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  3120. // CHECK:STDOUT: %ptr.a04: type = ptr_type %B [concrete]
  3121. // CHECK:STDOUT: %pattern_type.837: type = pattern_type %ptr.a04 [concrete]
  3122. // CHECK:STDOUT: %TakeB__carbon_thunk.type: type = fn_type @TakeB__carbon_thunk [concrete]
  3123. // CHECK:STDOUT: %TakeB__carbon_thunk: %TakeB__carbon_thunk.type = struct_value () [concrete]
  3124. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  3125. // CHECK:STDOUT: %B.elem.bad: type = unbound_element_type %B, %A [concrete]
  3126. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  3127. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3128. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3129. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  3130. // CHECK:STDOUT: %B.elem.c76: type = unbound_element_type %B, %i32 [concrete]
  3131. // CHECK:STDOUT: %.e7f: type = custom_layout_type {size=12, align=4, .a@0: %A, .n@8: %i32} [concrete]
  3132. // CHECK:STDOUT: %complete_type.b39: <witness> = complete_type_witness %.e7f [concrete]
  3133. // CHECK:STDOUT: %A.elem: type = unbound_element_type %A, %i32 [concrete]
  3134. // CHECK:STDOUT: %.7b6: type = custom_layout_type {size=8, align=4, .x@0: %i32, .y@4: %i32} [concrete]
  3135. // CHECK:STDOUT: %complete_type.1e0: <witness> = complete_type_witness %.7b6 [concrete]
  3136. // CHECK:STDOUT: }
  3137. // CHECK:STDOUT:
  3138. // CHECK:STDOUT: imports {
  3139. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3140. // CHECK:STDOUT: .Int = %Core.Int
  3141. // CHECK:STDOUT: import Core//prelude
  3142. // CHECK:STDOUT: import Core//prelude/...
  3143. // CHECK:STDOUT: }
  3144. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3145. // CHECK:STDOUT: .TakeB = %TakeB.cpp_overload_set.value
  3146. // CHECK:STDOUT: import Cpp//...
  3147. // CHECK:STDOUT: }
  3148. // CHECK:STDOUT: %TakeB.cpp_overload_set.value: %TakeB.cpp_overload_set.type = cpp_overload_set_value @TakeB.cpp_overload_set [concrete = constants.%TakeB.cpp_overload_set.value]
  3149. // CHECK:STDOUT: %TakeB__carbon_thunk.decl: %TakeB__carbon_thunk.type = fn_decl @TakeB__carbon_thunk [concrete = constants.%TakeB__carbon_thunk] {
  3150. // CHECK:STDOUT: %_.patt: %pattern_type.837 = value_binding_pattern _ [concrete]
  3151. // CHECK:STDOUT: %_.param_patt: %pattern_type.837 = value_param_pattern %_.patt, call_param0 [concrete]
  3152. // CHECK:STDOUT: } {
  3153. // CHECK:STDOUT: %_.param: %ptr.a04 = value_param call_param0
  3154. // CHECK:STDOUT: %_: %ptr.a04 = value_binding _, %_.param
  3155. // CHECK:STDOUT: }
  3156. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3157. // CHECK:STDOUT: }
  3158. // CHECK:STDOUT:
  3159. // CHECK:STDOUT: file {
  3160. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3161. // CHECK:STDOUT: .Core = imports.%Core
  3162. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3163. // CHECK:STDOUT: .F = %F.decl
  3164. // CHECK:STDOUT: }
  3165. // CHECK:STDOUT: %Core.import = import Core
  3166. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3167. // CHECK:STDOUT: import Cpp "nested_structs.h"
  3168. // CHECK:STDOUT: }
  3169. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3170. // CHECK:STDOUT: }
  3171. // CHECK:STDOUT:
  3172. // CHECK:STDOUT: class @B {
  3173. // CHECK:STDOUT: %.1: %B.elem.bad = field_decl a, element0 [concrete]
  3174. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3175. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3176. // CHECK:STDOUT: %.2: %B.elem.c76 = field_decl n, element1 [concrete]
  3177. // CHECK:STDOUT: %.3: type = custom_layout_type {size=12, align=4, .a@0: %A, .n@8: %i32} [concrete = constants.%.e7f]
  3178. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %.3 [concrete = constants.%complete_type.b39]
  3179. // CHECK:STDOUT: complete_type_witness = %complete_type
  3180. // CHECK:STDOUT:
  3181. // CHECK:STDOUT: !members:
  3182. // CHECK:STDOUT: import Cpp//...
  3183. // CHECK:STDOUT: }
  3184. // CHECK:STDOUT:
  3185. // CHECK:STDOUT: class @A {
  3186. // CHECK:STDOUT: %int_32.1: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3187. // CHECK:STDOUT: %i32.1: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3188. // CHECK:STDOUT: %.1: %A.elem = field_decl x, element0 [concrete]
  3189. // CHECK:STDOUT: %int_32.2: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3190. // CHECK:STDOUT: %i32.2: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3191. // CHECK:STDOUT: %.2: %A.elem = field_decl y, element1 [concrete]
  3192. // CHECK:STDOUT: %.3: type = custom_layout_type {size=8, align=4, .x@0: %i32, .y@4: %i32} [concrete = constants.%.7b6]
  3193. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %.3 [concrete = constants.%complete_type.1e0]
  3194. // CHECK:STDOUT: complete_type_witness = %complete_type
  3195. // CHECK:STDOUT:
  3196. // CHECK:STDOUT: !members:
  3197. // CHECK:STDOUT: import Cpp//...
  3198. // CHECK:STDOUT: }
  3199. // CHECK:STDOUT:
  3200. // CHECK:STDOUT: fn @F() {
  3201. // CHECK:STDOUT: !entry:
  3202. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3203. // CHECK:STDOUT: %TakeB.ref: %TakeB.cpp_overload_set.type = name_ref TakeB, imports.%TakeB.cpp_overload_set.value [concrete = constants.%TakeB.cpp_overload_set.value]
  3204. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1]
  3205. // CHECK:STDOUT: %int_2: Core.IntLiteral = int_value 2 [concrete = constants.%int_2]
  3206. // CHECK:STDOUT: %.loc17_34: %struct_type.x.y = struct_literal (%int_1, %int_2) [concrete = constants.%struct.004]
  3207. // CHECK:STDOUT: %int_3: Core.IntLiteral = int_value 3 [concrete = constants.%int_3]
  3208. // CHECK:STDOUT: %.loc17_43.1: %struct_type.a.n.988 = struct_literal (%.loc17_34, %int_3) [concrete = constants.%struct.516]
  3209. // CHECK:STDOUT: %.loc17_43.2: %B = converted %.loc17_43.1, <error> [concrete = <error>]
  3210. // CHECK:STDOUT: %addr: %ptr.a04 = addr_of <error> [concrete = <error>]
  3211. // CHECK:STDOUT: %TakeB__carbon_thunk.call: init %empty_tuple.type = call imports.%TakeB__carbon_thunk.decl(%addr)
  3212. // CHECK:STDOUT: return
  3213. // CHECK:STDOUT: }
  3214. // CHECK:STDOUT:
  3215. // CHECK:STDOUT: fn @TakeB(%_.param: %B);
  3216. // CHECK:STDOUT:
  3217. // CHECK:STDOUT: fn @TakeB__carbon_thunk(%_.param: %ptr.a04);
  3218. // CHECK:STDOUT:
  3219. // CHECK:STDOUT: --- fail_import_upsizing_rejected.carbon
  3220. // CHECK:STDOUT:
  3221. // CHECK:STDOUT: constants {
  3222. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3223. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  3224. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3225. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3226. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3227. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3228. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3229. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3230. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3231. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3232. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3233. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3234. // CHECK:STDOUT: %As.type.359: type = facet_type <@As, @As(%i16)> [concrete]
  3235. // CHECK:STDOUT: %As.Convert.type.be5: type = fn_type @As.Convert, @As(%i16) [concrete]
  3236. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  3237. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  3238. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  3239. // CHECK:STDOUT: %As.impl_witness.b61: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  3240. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.c60: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_16) [concrete]
  3241. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.a42: %Core.IntLiteral.as.As.impl.Convert.type.c60 = struct_value () [concrete]
  3242. // CHECK:STDOUT: %As.facet: %As.type.359 = facet_value Core.IntLiteral, (%As.impl_witness.b61) [concrete]
  3243. // CHECK:STDOUT: %.240: type = fn_type_with_self_type %As.Convert.type.be5, %As.facet [concrete]
  3244. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.a42 [concrete]
  3245. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.a42, @Core.IntLiteral.as.As.impl.Convert(%int_16) [concrete]
  3246. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  3247. // CHECK:STDOUT: %int_1.f90: %i16 = int_value 1 [concrete]
  3248. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  3249. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  3250. // CHECK:STDOUT: %pattern_type.7ce: type = pattern_type %i32 [concrete]
  3251. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  3252. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  3253. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3254. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3255. // CHECK:STDOUT: }
  3256. // CHECK:STDOUT:
  3257. // CHECK:STDOUT: imports {
  3258. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3259. // CHECK:STDOUT: .Int = %Core.Int
  3260. // CHECK:STDOUT: .As = %Core.As
  3261. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3262. // CHECK:STDOUT: import Core//prelude
  3263. // CHECK:STDOUT: import Core//prelude/...
  3264. // CHECK:STDOUT: }
  3265. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3266. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3267. // CHECK:STDOUT: import Cpp//...
  3268. // CHECK:STDOUT: }
  3269. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3270. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3271. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  3272. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  3273. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  3274. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  3275. // CHECK:STDOUT: %a.patt: %pattern_type.7ce = value_binding_pattern a [concrete]
  3276. // CHECK:STDOUT: %a.param_patt: %pattern_type.7ce = value_param_pattern %a.patt, call_param0 [concrete]
  3277. // CHECK:STDOUT: } {
  3278. // CHECK:STDOUT: %a.param: %i32 = value_param call_param0
  3279. // CHECK:STDOUT: %.1: type = splice_block %i32 [concrete = constants.%i32] {
  3280. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3281. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3282. // CHECK:STDOUT: }
  3283. // CHECK:STDOUT: %a: %i32 = value_binding a, %a.param
  3284. // CHECK:STDOUT: }
  3285. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3286. // CHECK:STDOUT: }
  3287. // CHECK:STDOUT:
  3288. // CHECK:STDOUT: file {
  3289. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3290. // CHECK:STDOUT: .Core = imports.%Core
  3291. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3292. // CHECK:STDOUT: .F = %F.decl
  3293. // CHECK:STDOUT: }
  3294. // CHECK:STDOUT: %Core.import = import Core
  3295. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3296. // CHECK:STDOUT: import Cpp "upsizing_rejected.h"
  3297. // CHECK:STDOUT: }
  3298. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3299. // CHECK:STDOUT: }
  3300. // CHECK:STDOUT:
  3301. // CHECK:STDOUT: fn @F() {
  3302. // CHECK:STDOUT: !entry:
  3303. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3304. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3305. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3306. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3307. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3308. // CHECK:STDOUT: %impl.elem0: %.240 = impl_witness_access constants.%As.impl_witness.b61, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.a42]
  3309. // CHECK:STDOUT: %bound_method.loc18_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  3310. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_16) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  3311. // CHECK:STDOUT: %bound_method.loc18_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3312. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i16 = call %bound_method.loc18_13.2(%int_1) [concrete = constants.%int_1.f90]
  3313. // CHECK:STDOUT: %.loc18_13.1: %i16 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.f90]
  3314. // CHECK:STDOUT: %.loc18_13.2: %i16 = converted %int_1, %.loc18_13.1 [concrete = constants.%int_1.f90]
  3315. // CHECK:STDOUT: %.loc18_13.3: %i32 = converted %.loc18_13.2, <error> [concrete = <error>]
  3316. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(<error>)
  3317. // CHECK:STDOUT: return
  3318. // CHECK:STDOUT: }
  3319. // CHECK:STDOUT:
  3320. // CHECK:STDOUT: fn @foo(%a.param: %i32);
  3321. // CHECK:STDOUT:
  3322. // CHECK:STDOUT: --- fail_import_downsizing_rejected.carbon
  3323. // CHECK:STDOUT:
  3324. // CHECK:STDOUT: constants {
  3325. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3326. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  3327. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3328. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3329. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3330. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3331. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  3332. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3333. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3334. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  3335. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3336. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3337. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  3338. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  3339. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  3340. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  3341. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  3342. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  3343. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  3344. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  3345. // CHECK:STDOUT: %As.facet: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  3346. // CHECK:STDOUT: %.97a: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet [concrete]
  3347. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  3348. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  3349. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  3350. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  3351. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete]
  3352. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(%int_16) [concrete]
  3353. // CHECK:STDOUT: %ptr: type = ptr_type %i16 [concrete]
  3354. // CHECK:STDOUT: %pattern_type.54c: type = pattern_type %ptr [concrete]
  3355. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  3356. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  3357. // CHECK:STDOUT: %ImplicitAs.type.cc7: type = generic_interface_type @ImplicitAs [concrete]
  3358. // CHECK:STDOUT: %ImplicitAs.generic: %ImplicitAs.type.cc7 = struct_value () [concrete]
  3359. // CHECK:STDOUT: }
  3360. // CHECK:STDOUT:
  3361. // CHECK:STDOUT: imports {
  3362. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3363. // CHECK:STDOUT: .Int = %Core.Int
  3364. // CHECK:STDOUT: .As = %Core.As
  3365. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  3366. // CHECK:STDOUT: import Core//prelude
  3367. // CHECK:STDOUT: import Core//prelude/...
  3368. // CHECK:STDOUT: }
  3369. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3370. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3371. // CHECK:STDOUT: import Cpp//...
  3372. // CHECK:STDOUT: }
  3373. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3374. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3375. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  3376. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  3377. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  3378. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  3379. // CHECK:STDOUT: %a.patt: %pattern_type.54c = value_binding_pattern a [concrete]
  3380. // CHECK:STDOUT: %a.param_patt: %pattern_type.54c = value_param_pattern %a.patt, call_param0 [concrete]
  3381. // CHECK:STDOUT: } {
  3382. // CHECK:STDOUT: %a.param: %ptr = value_param call_param0
  3383. // CHECK:STDOUT: %.1: type = splice_block constants.%ptr [concrete = constants.%ptr] {
  3384. // CHECK:STDOUT: %int_16: Core.IntLiteral = int_value 16 [concrete = constants.%int_16]
  3385. // CHECK:STDOUT: %i16: type = class_type @Int, @Int(constants.%int_16) [concrete = constants.%i16]
  3386. // CHECK:STDOUT: }
  3387. // CHECK:STDOUT: %a: %ptr = value_binding a, %a.param
  3388. // CHECK:STDOUT: }
  3389. // CHECK:STDOUT: %Core.ImplicitAs: %ImplicitAs.type.cc7 = import_ref Core//prelude/parts/as, ImplicitAs, loaded [concrete = constants.%ImplicitAs.generic]
  3390. // CHECK:STDOUT: }
  3391. // CHECK:STDOUT:
  3392. // CHECK:STDOUT: file {
  3393. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3394. // CHECK:STDOUT: .Core = imports.%Core
  3395. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3396. // CHECK:STDOUT: .F = %F.decl
  3397. // CHECK:STDOUT: }
  3398. // CHECK:STDOUT: %Core.import = import Core
  3399. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3400. // CHECK:STDOUT: import Cpp "downsizing_rejected.h"
  3401. // CHECK:STDOUT: }
  3402. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3403. // CHECK:STDOUT: }
  3404. // CHECK:STDOUT:
  3405. // CHECK:STDOUT: fn @F() {
  3406. // CHECK:STDOUT: !entry:
  3407. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3408. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3409. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3410. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3411. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3412. // CHECK:STDOUT: %impl.elem0: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  3413. // CHECK:STDOUT: %bound_method.loc18_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  3414. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  3415. // CHECK:STDOUT: %bound_method.loc18_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3416. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc18_13.2(%int_1) [concrete = constants.%int_1.5d2]
  3417. // CHECK:STDOUT: %.loc18_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.5d2]
  3418. // CHECK:STDOUT: %.loc18_13.2: %i32 = converted %int_1, %.loc18_13.1 [concrete = constants.%int_1.5d2]
  3419. // CHECK:STDOUT: %.loc18_13.3: %i16 = converted %.loc18_13.2, <error> [concrete = <error>]
  3420. // CHECK:STDOUT: %addr: %ptr = addr_of <error> [concrete = <error>]
  3421. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr)
  3422. // CHECK:STDOUT: return
  3423. // CHECK:STDOUT: }
  3424. // CHECK:STDOUT:
  3425. // CHECK:STDOUT: fn @foo(%a.param: %i16);
  3426. // CHECK:STDOUT:
  3427. // CHECK:STDOUT: fn @foo__carbon_thunk(%a.param: %ptr);
  3428. // CHECK:STDOUT:
  3429. // CHECK:STDOUT: --- fail_import_no_viable_function.carbon
  3430. // CHECK:STDOUT:
  3431. // CHECK:STDOUT: constants {
  3432. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3433. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3434. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3435. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3436. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3437. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  3438. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3439. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3440. // CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [concrete]
  3441. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3442. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3443. // CHECK:STDOUT: %As.type.229: type = facet_type <@As, @As(%i64)> [concrete]
  3444. // CHECK:STDOUT: %As.Convert.type.d57: type = fn_type @As.Convert, @As(%i64) [concrete]
  3445. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  3446. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  3447. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  3448. // CHECK:STDOUT: %As.impl_witness.c71: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_64) [concrete]
  3449. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.cee: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_64) [concrete]
  3450. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.a54: %Core.IntLiteral.as.As.impl.Convert.type.cee = struct_value () [concrete]
  3451. // CHECK:STDOUT: %As.facet: %As.type.229 = facet_value Core.IntLiteral, (%As.impl_witness.c71) [concrete]
  3452. // CHECK:STDOUT: %.aba: type = fn_type_with_self_type %As.Convert.type.d57, %As.facet [concrete]
  3453. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.a54 [concrete]
  3454. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.a54, @Core.IntLiteral.as.As.impl.Convert(%int_64) [concrete]
  3455. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  3456. // CHECK:STDOUT: %int_1.41a: %i64 = int_value 1 [concrete]
  3457. // CHECK:STDOUT: }
  3458. // CHECK:STDOUT:
  3459. // CHECK:STDOUT: imports {
  3460. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3461. // CHECK:STDOUT: .Int = %Core.Int
  3462. // CHECK:STDOUT: .As = %Core.As
  3463. // CHECK:STDOUT: import Core//prelude
  3464. // CHECK:STDOUT: import Core//prelude/...
  3465. // CHECK:STDOUT: }
  3466. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3467. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3468. // CHECK:STDOUT: import Cpp//...
  3469. // CHECK:STDOUT: }
  3470. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3471. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3472. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  3473. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  3474. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  3475. // CHECK:STDOUT: }
  3476. // CHECK:STDOUT:
  3477. // CHECK:STDOUT: file {
  3478. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3479. // CHECK:STDOUT: .Core = imports.%Core
  3480. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3481. // CHECK:STDOUT: .F = %F.decl
  3482. // CHECK:STDOUT: }
  3483. // CHECK:STDOUT: %Core.import = import Core
  3484. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3485. // CHECK:STDOUT: import Cpp "no_viable_function.h"
  3486. // CHECK:STDOUT: }
  3487. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3488. // CHECK:STDOUT: }
  3489. // CHECK:STDOUT:
  3490. // CHECK:STDOUT: fn @F() {
  3491. // CHECK:STDOUT: !entry:
  3492. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3493. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3494. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3495. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  3496. // CHECK:STDOUT: %i64: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  3497. // CHECK:STDOUT: %impl.elem0: %.aba = impl_witness_access constants.%As.impl_witness.c71, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.a54]
  3498. // CHECK:STDOUT: %bound_method.loc15_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  3499. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  3500. // CHECK:STDOUT: %bound_method.loc15_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3501. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i64 = call %bound_method.loc15_13.2(%int_1) [concrete = constants.%int_1.41a]
  3502. // CHECK:STDOUT: %.loc15_13.1: %i64 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.41a]
  3503. // CHECK:STDOUT: %.loc15_13.2: %i64 = converted %int_1, %.loc15_13.1 [concrete = constants.%int_1.41a]
  3504. // CHECK:STDOUT: return
  3505. // CHECK:STDOUT: }
  3506. // CHECK:STDOUT:
  3507. // CHECK:STDOUT: --- fail_import_ambiguous_overload.carbon
  3508. // CHECK:STDOUT:
  3509. // CHECK:STDOUT: constants {
  3510. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3511. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3512. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3513. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3514. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3515. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete]
  3516. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3517. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3518. // CHECK:STDOUT: %i64: type = class_type @Int, @Int(%int_64) [concrete]
  3519. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3520. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3521. // CHECK:STDOUT: %As.type.229: type = facet_type <@As, @As(%i64)> [concrete]
  3522. // CHECK:STDOUT: %As.Convert.type.d57: type = fn_type @As.Convert, @As(%i64) [concrete]
  3523. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  3524. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  3525. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  3526. // CHECK:STDOUT: %As.impl_witness.c71: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_64) [concrete]
  3527. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.cee: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_64) [concrete]
  3528. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.a54: %Core.IntLiteral.as.As.impl.Convert.type.cee = struct_value () [concrete]
  3529. // CHECK:STDOUT: %As.facet: %As.type.229 = facet_value Core.IntLiteral, (%As.impl_witness.c71) [concrete]
  3530. // CHECK:STDOUT: %.aba: type = fn_type_with_self_type %As.Convert.type.d57, %As.facet [concrete]
  3531. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.a54 [concrete]
  3532. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.a54, @Core.IntLiteral.as.As.impl.Convert(%int_64) [concrete]
  3533. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  3534. // CHECK:STDOUT: %int_1.41a: %i64 = int_value 1 [concrete]
  3535. // CHECK:STDOUT: }
  3536. // CHECK:STDOUT:
  3537. // CHECK:STDOUT: imports {
  3538. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3539. // CHECK:STDOUT: .Int = %Core.Int
  3540. // CHECK:STDOUT: .As = %Core.As
  3541. // CHECK:STDOUT: import Core//prelude
  3542. // CHECK:STDOUT: import Core//prelude/...
  3543. // CHECK:STDOUT: }
  3544. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3545. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3546. // CHECK:STDOUT: import Cpp//...
  3547. // CHECK:STDOUT: }
  3548. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3549. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3550. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  3551. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  3552. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  3553. // CHECK:STDOUT: }
  3554. // CHECK:STDOUT:
  3555. // CHECK:STDOUT: file {
  3556. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3557. // CHECK:STDOUT: .Core = imports.%Core
  3558. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3559. // CHECK:STDOUT: .F = %F.decl
  3560. // CHECK:STDOUT: }
  3561. // CHECK:STDOUT: %Core.import = import Core
  3562. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3563. // CHECK:STDOUT: import Cpp "ambiguous_overload.h"
  3564. // CHECK:STDOUT: }
  3565. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3566. // CHECK:STDOUT: }
  3567. // CHECK:STDOUT:
  3568. // CHECK:STDOUT: fn @F() {
  3569. // CHECK:STDOUT: !entry:
  3570. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3571. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3572. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3573. // CHECK:STDOUT: %int_64: Core.IntLiteral = int_value 64 [concrete = constants.%int_64]
  3574. // CHECK:STDOUT: %i64: type = class_type @Int, @Int(constants.%int_64) [concrete = constants.%i64]
  3575. // CHECK:STDOUT: %impl.elem0: %.aba = impl_witness_access constants.%As.impl_witness.c71, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.a54]
  3576. // CHECK:STDOUT: %bound_method.loc19_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  3577. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_64) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  3578. // CHECK:STDOUT: %bound_method.loc19_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3579. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i64 = call %bound_method.loc19_13.2(%int_1) [concrete = constants.%int_1.41a]
  3580. // CHECK:STDOUT: %.loc19_13.1: %i64 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.41a]
  3581. // CHECK:STDOUT: %.loc19_13.2: %i64 = converted %int_1, %.loc19_13.1 [concrete = constants.%int_1.41a]
  3582. // CHECK:STDOUT: return
  3583. // CHECK:STDOUT: }
  3584. // CHECK:STDOUT:
  3585. // CHECK:STDOUT: --- fail_import_deleted_function.carbon
  3586. // CHECK:STDOUT:
  3587. // CHECK:STDOUT: constants {
  3588. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3589. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3590. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3591. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3592. // CHECK:STDOUT: %int_1.5b8: Core.IntLiteral = int_value 1 [concrete]
  3593. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  3594. // CHECK:STDOUT: %Int.type: type = generic_class_type @Int [concrete]
  3595. // CHECK:STDOUT: %Int.generic: %Int.type = struct_value () [concrete]
  3596. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  3597. // CHECK:STDOUT: %As.type.90f: type = generic_interface_type @As [concrete]
  3598. // CHECK:STDOUT: %As.generic: %As.type.90f = struct_value () [concrete]
  3599. // CHECK:STDOUT: %As.type.047: type = facet_type <@As, @As(%i32)> [concrete]
  3600. // CHECK:STDOUT: %As.Convert.type.99b: type = fn_type @As.Convert, @As(%i32) [concrete]
  3601. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  3602. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.09e: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%To) [symbolic]
  3603. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.dbe: %Core.IntLiteral.as.As.impl.Convert.type.09e = struct_value () [symbolic]
  3604. // CHECK:STDOUT: %As.impl_witness.ab6: <witness> = impl_witness imports.%As.impl_witness_table.9fc, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  3605. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.type.8ec: type = fn_type @Core.IntLiteral.as.As.impl.Convert, @Core.IntLiteral.as.As.impl(%int_32) [concrete]
  3606. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.29b: %Core.IntLiteral.as.As.impl.Convert.type.8ec = struct_value () [concrete]
  3607. // CHECK:STDOUT: %As.facet: %As.type.047 = facet_value Core.IntLiteral, (%As.impl_witness.ab6) [concrete]
  3608. // CHECK:STDOUT: %.97a: type = fn_type_with_self_type %As.Convert.type.99b, %As.facet [concrete]
  3609. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.bound: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.29b [concrete]
  3610. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.As.impl.Convert.29b, @Core.IntLiteral.as.As.impl.Convert(%int_32) [concrete]
  3611. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %int_1.5b8, %Core.IntLiteral.as.As.impl.Convert.specific_fn [concrete]
  3612. // CHECK:STDOUT: %int_1.5d2: %i32 = int_value 1 [concrete]
  3613. // CHECK:STDOUT: }
  3614. // CHECK:STDOUT:
  3615. // CHECK:STDOUT: imports {
  3616. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3617. // CHECK:STDOUT: .Int = %Core.Int
  3618. // CHECK:STDOUT: .As = %Core.As
  3619. // CHECK:STDOUT: import Core//prelude
  3620. // CHECK:STDOUT: import Core//prelude/...
  3621. // CHECK:STDOUT: }
  3622. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3623. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3624. // CHECK:STDOUT: import Cpp//...
  3625. // CHECK:STDOUT: }
  3626. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3627. // CHECK:STDOUT: %Core.Int: %Int.type = import_ref Core//prelude/parts/int, Int, loaded [concrete = constants.%Int.generic]
  3628. // CHECK:STDOUT: %Core.As: %As.type.90f = import_ref Core//prelude/parts/as, As, loaded [concrete = constants.%As.generic]
  3629. // CHECK:STDOUT: %Core.import_ref.ca0: @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert.type (%Core.IntLiteral.as.As.impl.Convert.type.09e) = import_ref Core//prelude/parts/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.As.impl.%Core.IntLiteral.as.As.impl.Convert (constants.%Core.IntLiteral.as.As.impl.Convert.dbe)]
  3630. // CHECK:STDOUT: %As.impl_witness_table.9fc = impl_witness_table (%Core.import_ref.ca0), @Core.IntLiteral.as.As.impl [concrete]
  3631. // CHECK:STDOUT: }
  3632. // CHECK:STDOUT:
  3633. // CHECK:STDOUT: file {
  3634. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3635. // CHECK:STDOUT: .Core = imports.%Core
  3636. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3637. // CHECK:STDOUT: .F = %F.decl
  3638. // CHECK:STDOUT: }
  3639. // CHECK:STDOUT: %Core.import = import Core
  3640. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3641. // CHECK:STDOUT: import Cpp "deleted_function.h"
  3642. // CHECK:STDOUT: }
  3643. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3644. // CHECK:STDOUT: }
  3645. // CHECK:STDOUT:
  3646. // CHECK:STDOUT: fn @F() {
  3647. // CHECK:STDOUT: !entry:
  3648. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3649. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3650. // CHECK:STDOUT: %int_1: Core.IntLiteral = int_value 1 [concrete = constants.%int_1.5b8]
  3651. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  3652. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  3653. // CHECK:STDOUT: %impl.elem0: %.97a = impl_witness_access constants.%As.impl_witness.ab6, element0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.29b]
  3654. // CHECK:STDOUT: %bound_method.loc19_13.1: <bound method> = bound_method %int_1, %impl.elem0 [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.bound]
  3655. // CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @Core.IntLiteral.as.As.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.As.impl.Convert.specific_fn]
  3656. // CHECK:STDOUT: %bound_method.loc19_13.2: <bound method> = bound_method %int_1, %specific_fn [concrete = constants.%bound_method]
  3657. // CHECK:STDOUT: %Core.IntLiteral.as.As.impl.Convert.call: init %i32 = call %bound_method.loc19_13.2(%int_1) [concrete = constants.%int_1.5d2]
  3658. // CHECK:STDOUT: %.loc19_13.1: %i32 = value_of_initializer %Core.IntLiteral.as.As.impl.Convert.call [concrete = constants.%int_1.5d2]
  3659. // CHECK:STDOUT: %.loc19_13.2: %i32 = converted %int_1, %.loc19_13.1 [concrete = constants.%int_1.5d2]
  3660. // CHECK:STDOUT: return
  3661. // CHECK:STDOUT: }
  3662. // CHECK:STDOUT:
  3663. // CHECK:STDOUT: --- fail_missing_impl.carbon
  3664. // CHECK:STDOUT:
  3665. // CHECK:STDOUT: constants {
  3666. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  3667. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  3668. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  3669. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  3670. // CHECK:STDOUT: %ValueT: %I.type = symbolic_binding ValueT, 0 [symbolic]
  3671. // CHECK:STDOUT: %pattern_type.9d9: type = pattern_type %I.type [concrete]
  3672. // CHECK:STDOUT: %ValueT.binding.as_type: type = symbolic_binding_type ValueT, 0, %ValueT [symbolic]
  3673. // CHECK:STDOUT: %value: %ValueT.binding.as_type = symbolic_binding value, 1 [symbolic]
  3674. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %ValueT.binding.as_type [symbolic]
  3675. // CHECK:STDOUT: %EchoValue.type: type = fn_type @EchoValue [concrete]
  3676. // CHECK:STDOUT: %EchoValue: %EchoValue.type = struct_value () [concrete]
  3677. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  3678. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  3679. // CHECK:STDOUT: %foo.cpp_overload_set.type: type = cpp_overload_set_type @foo.cpp_overload_set [concrete]
  3680. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete]
  3681. // CHECK:STDOUT: }
  3682. // CHECK:STDOUT:
  3683. // CHECK:STDOUT: imports {
  3684. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  3685. // CHECK:STDOUT: import Core//prelude
  3686. // CHECK:STDOUT: import Core//prelude/...
  3687. // CHECK:STDOUT: }
  3688. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  3689. // CHECK:STDOUT: .foo = %foo.cpp_overload_set.value
  3690. // CHECK:STDOUT: import Cpp//...
  3691. // CHECK:STDOUT: }
  3692. // CHECK:STDOUT: %foo.cpp_overload_set.value: %foo.cpp_overload_set.type = cpp_overload_set_value @foo.cpp_overload_set [concrete = constants.%foo.cpp_overload_set.value]
  3693. // CHECK:STDOUT: }
  3694. // CHECK:STDOUT:
  3695. // CHECK:STDOUT: file {
  3696. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  3697. // CHECK:STDOUT: .Core = imports.%Core
  3698. // CHECK:STDOUT: .Cpp = imports.%Cpp
  3699. // CHECK:STDOUT: .I = %I.decl
  3700. // CHECK:STDOUT: .EchoValue = %EchoValue.decl
  3701. // CHECK:STDOUT: .F = %F.decl
  3702. // CHECK:STDOUT: }
  3703. // CHECK:STDOUT: %Core.import = import Core
  3704. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  3705. // CHECK:STDOUT: import Cpp inline
  3706. // CHECK:STDOUT: }
  3707. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  3708. // CHECK:STDOUT: %EchoValue.decl: %EchoValue.type = fn_decl @EchoValue [concrete = constants.%EchoValue] {
  3709. // CHECK:STDOUT: %ValueT.patt: %pattern_type.9d9 = symbolic_binding_pattern ValueT, 0 [concrete]
  3710. // CHECK:STDOUT: %value.patt: @EchoValue.%pattern_type (%pattern_type.422) = symbolic_binding_pattern value, 1 [concrete]
  3711. // CHECK:STDOUT: } {
  3712. // CHECK:STDOUT: %.loc10_23: type = splice_block %I.ref [concrete = constants.%I.type] {
  3713. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  3714. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  3715. // CHECK:STDOUT: }
  3716. // CHECK:STDOUT: %ValueT.loc10_14.2: %I.type = symbolic_binding ValueT, 0 [symbolic = %ValueT.loc10_14.1 (constants.%ValueT)]
  3717. // CHECK:STDOUT: %.loc10_34.1: type = splice_block %.loc10_34.2 [symbolic = %ValueT.binding.as_type (constants.%ValueT.binding.as_type)] {
  3718. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  3719. // CHECK:STDOUT: %ValueT.ref: %I.type = name_ref ValueT, %ValueT.loc10_14.2 [symbolic = %ValueT.loc10_14.1 (constants.%ValueT)]
  3720. // CHECK:STDOUT: %ValueT.as_type: type = facet_access_type %ValueT.ref [symbolic = %ValueT.binding.as_type (constants.%ValueT.binding.as_type)]
  3721. // CHECK:STDOUT: %.loc10_34.2: type = converted %ValueT.ref, %ValueT.as_type [symbolic = %ValueT.binding.as_type (constants.%ValueT.binding.as_type)]
  3722. // CHECK:STDOUT: }
  3723. // CHECK:STDOUT: %value.loc10_26.2: @EchoValue.%ValueT.binding.as_type (%ValueT.binding.as_type) = symbolic_binding value, 1 [symbolic = %value.loc10_26.1 (constants.%value)]
  3724. // CHECK:STDOUT: }
  3725. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {} {}
  3726. // CHECK:STDOUT: }
  3727. // CHECK:STDOUT:
  3728. // CHECK:STDOUT: interface @I {
  3729. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  3730. // CHECK:STDOUT:
  3731. // CHECK:STDOUT: !members:
  3732. // CHECK:STDOUT: .Self = %Self
  3733. // CHECK:STDOUT: witness = ()
  3734. // CHECK:STDOUT:
  3735. // CHECK:STDOUT: !requires:
  3736. // CHECK:STDOUT: }
  3737. // CHECK:STDOUT:
  3738. // CHECK:STDOUT: generic fn @EchoValue(%ValueT.loc10_14.2: %I.type, %value.loc10_26.2: @EchoValue.%ValueT.binding.as_type (%ValueT.binding.as_type)) {
  3739. // CHECK:STDOUT: %ValueT.loc10_14.1: %I.type = symbolic_binding ValueT, 0 [symbolic = %ValueT.loc10_14.1 (constants.%ValueT)]
  3740. // CHECK:STDOUT: %ValueT.binding.as_type: type = symbolic_binding_type ValueT, 0, %ValueT.loc10_14.1 [symbolic = %ValueT.binding.as_type (constants.%ValueT.binding.as_type)]
  3741. // CHECK:STDOUT: %value.loc10_26.1: @EchoValue.%ValueT.binding.as_type (%ValueT.binding.as_type) = symbolic_binding value, 1 [symbolic = %value.loc10_26.1 (constants.%value)]
  3742. // CHECK:STDOUT: %pattern_type: type = pattern_type %ValueT.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.422)]
  3743. // CHECK:STDOUT:
  3744. // CHECK:STDOUT: !definition:
  3745. // CHECK:STDOUT:
  3746. // CHECK:STDOUT: fn() {
  3747. // CHECK:STDOUT: !entry:
  3748. // CHECK:STDOUT: return
  3749. // CHECK:STDOUT: }
  3750. // CHECK:STDOUT: }
  3751. // CHECK:STDOUT:
  3752. // CHECK:STDOUT: fn @F() {
  3753. // CHECK:STDOUT: !entry:
  3754. // CHECK:STDOUT: %EchoValue.ref: %EchoValue.type = name_ref EchoValue, file.%EchoValue.decl [concrete = constants.%EchoValue]
  3755. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  3756. // CHECK:STDOUT: %foo.ref: %foo.cpp_overload_set.type = name_ref foo, imports.%foo.cpp_overload_set.value [concrete = constants.%foo.cpp_overload_set.value]
  3757. // CHECK:STDOUT: return
  3758. // CHECK:STDOUT: }
  3759. // CHECK:STDOUT:
  3760. // CHECK:STDOUT: specific @EchoValue(constants.%ValueT, constants.%value) {
  3761. // CHECK:STDOUT: %ValueT.loc10_14.1 => constants.%ValueT
  3762. // CHECK:STDOUT: %ValueT.binding.as_type => constants.%ValueT.binding.as_type
  3763. // CHECK:STDOUT: %value.loc10_26.1 => constants.%value
  3764. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  3765. // CHECK:STDOUT: }
  3766. // CHECK:STDOUT: