overloads.carbon 297 KB

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