operators.carbon 197 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214
  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/full.carbon
  6. // EXTRA-ARGS: --target=x86_64-linux-gnu --clang-arg=-std=c++20
  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/operators.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/operators.carbon
  13. // ============================================================================
  14. // Unary operators
  15. // ============================================================================
  16. // --- unary_operators.h
  17. class C {};
  18. // Increment and Decrement.
  19. auto operator++(C& operand) -> C&;
  20. auto operator--(C& operand) -> C&;
  21. // Arithmetic.
  22. auto operator-(C operand) -> C;
  23. // --- import_unary_operators.carbon
  24. library "[[@TEST_NAME]]";
  25. import Cpp library "unary_operators.h";
  26. fn F() {
  27. //@dump-sem-ir-begin
  28. var c: Cpp.C = Cpp.C.C();
  29. // Increment and Decrement.
  30. ++c;
  31. --c;
  32. // Arithmetic.
  33. let minus: Cpp.C = -c;
  34. //@dump-sem-ir-end
  35. }
  36. // ============================================================================
  37. // Prefix increment and decrement vs postfix increment and decrement
  38. // ============================================================================
  39. // --- prefix_inc_and_dec.h
  40. class Prefix {};
  41. auto operator++(Prefix& operand) -> Prefix&;
  42. auto operator--(Prefix& operand) -> Prefix&;
  43. // --- fail_prefix_calling_postfix.carbon
  44. library "[[@TEST_NAME]]";
  45. import Cpp library "prefix_inc_and_dec.h";
  46. fn F() {
  47. var prefix: Cpp.Prefix = Cpp.Prefix.Prefix();
  48. // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+8]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
  49. // CHECK:STDERR: prefix++;
  50. // CHECK:STDERR: ^~
  51. // CHECK:STDERR:
  52. // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:3: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  53. // CHECK:STDERR: prefix++;
  54. // CHECK:STDERR: ^~~~~~~~~
  55. // CHECK:STDERR:
  56. prefix++;
  57. // CHECK:STDERR: fail_prefix_calling_postfix.carbon:[[@LINE+4]]:9: error: expected `;` after expression statement [ExpectedExprSemi]
  58. // CHECK:STDERR: prefix--;
  59. // CHECK:STDERR: ^~
  60. // CHECK:STDERR:
  61. prefix--;
  62. }
  63. // --- postfix_inc_and_dec.h
  64. class Postfix {};
  65. auto operator++(Postfix& operand, int) -> Postfix&;
  66. auto operator--(Postfix& operand, int) -> Postfix&;
  67. // --- fail_postfix_calling_prefix.carbon
  68. library "[[@TEST_NAME]]";
  69. import Cpp library "postfix_inc_and_dec.h";
  70. fn F() {
  71. var postfix: Cpp.Postfix = Cpp.Postfix.Postfix();
  72. // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.Inc` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
  73. // CHECK:STDERR: ++postfix;
  74. // CHECK:STDERR: ^~~~~~~~~
  75. // CHECK:STDERR:
  76. ++postfix;
  77. // CHECK:STDERR: fail_postfix_calling_prefix.carbon:[[@LINE+4]]:3: error: cannot access member of interface `Core.Dec` in type `Cpp.Postfix` that does not implement that interface [MissingImplInMemberAccess]
  78. // CHECK:STDERR: --postfix;
  79. // CHECK:STDERR: ^~~~~~~~~
  80. // CHECK:STDERR:
  81. --postfix;
  82. }
  83. // ============================================================================
  84. // Binary operators
  85. // ============================================================================
  86. // --- binary_operators.h
  87. class C {};
  88. // Arithmetic.
  89. auto operator+(C lhs, C rhs) -> C;
  90. auto operator-(C lhs, C rhs) -> C;
  91. auto operator*(C lhs, C rhs) -> C;
  92. auto operator/(C lhs, C rhs) -> C;
  93. auto operator%(C lhs, C rhs) -> C;
  94. // Bitwise.
  95. auto operator&(C lhs, C rhs) -> C;
  96. auto operator|(C lhs, C rhs) -> C;
  97. auto operator^(C lhs, C rhs) -> C;
  98. auto operator<<(C lhs, int num_bits) -> C;
  99. auto operator>>(C lhs, int num_bits) -> C;
  100. // Compound Assignment Arithmetic.
  101. auto operator+=(C& lhs, C rhs) -> C&;
  102. auto operator-=(C& lhs, C rhs) -> C&;
  103. auto operator*=(C& lhs, C rhs) -> C&;
  104. auto operator/=(C& lhs, C rhs) -> C&;
  105. auto operator%=(C& lhs, C rhs) -> C&;
  106. // Compound Assignment Bitwuse.
  107. auto operator&=(C& lhs, C rhs) -> C&;
  108. auto operator|=(C& lhs, C rhs) -> C&;
  109. auto operator^=(C& lhs, C rhs) -> C&;
  110. auto operator<<=(C& lhs, int num_bites) -> C&;
  111. auto operator>>=(C& lhs, int num_bites) -> C&;
  112. // Relational.
  113. auto operator==(C lhs, C rhs) -> bool;
  114. auto operator!=(C lhs, C rhs) -> bool;
  115. auto operator<(C lhs, C rhs) -> bool;
  116. auto operator>(C lhs, C rhs) -> bool;
  117. auto operator<=(C lhs, C rhs) -> bool;
  118. auto operator>=(C lhs, C rhs) -> bool;
  119. // --- import_binary_operators.carbon
  120. library "[[@TEST_NAME]]";
  121. import Cpp library "binary_operators.h";
  122. fn F() {
  123. //@dump-sem-ir-begin
  124. var c1: Cpp.C = Cpp.C.C();
  125. var c2: Cpp.C = Cpp.C.C();
  126. // Arithmetic.
  127. let addition: Cpp.C = c1 + c2;
  128. let subtraction: Cpp.C = c1 - c2;
  129. let multiplication: Cpp.C = c1 * c2;
  130. let division: Cpp.C = c1 / c2;
  131. let modulo: Cpp.C = c1 % c2;
  132. // Bitwise.
  133. let bitwise_and: Cpp.C = c1 & c2;
  134. let bitwise_or: Cpp.C = c1 | c2;
  135. let bitwise_xor: Cpp.C = c1 ^ c2;
  136. let left_shift: Cpp.C = c1 << 3;
  137. let right_shift: Cpp.C = c1 >> 5;
  138. // Compound Assignment Arithmetic.
  139. c1 += c2;
  140. c1 -= c2;
  141. c1 *= c2;
  142. c1 /= c2;
  143. c1 %= c2;
  144. // Compound Assignment Bitwise.
  145. c1 &= c2;
  146. c1 |= c2;
  147. c1 ^= c2;
  148. c1 <<= 3;
  149. c1 >>= 5;
  150. // Relational.
  151. let equal: bool = c1 == c2;
  152. let not_equal: bool = c1 != c2;
  153. let greater_than: bool = c1 > c2;
  154. let less_than: bool = c1 < c2;
  155. let greater_than_or_equal: bool = c1 >= c2;
  156. let less_than_or_equal: bool = c1 <= c2;
  157. //@dump-sem-ir-end
  158. }
  159. // --- multiple_calls.carbon
  160. library "[[@TEST_NAME]]";
  161. import Cpp library "binary_operators.h";
  162. fn F() {
  163. //@dump-sem-ir-begin
  164. let c1: Cpp.C = Cpp.C.C();
  165. let c2: Cpp.C = Cpp.C.C();
  166. let c3: Cpp.C = c1 + c2;
  167. let c4: Cpp.C = c1 + c3;
  168. let c5: Cpp.C = c4 + c3;
  169. //@dump-sem-ir-end
  170. }
  171. // --- fail_call_with_wrong_type.carbon
  172. library "[[@TEST_NAME]]";
  173. import Cpp library "binary_operators.h";
  174. fn F() {
  175. let c1: Cpp.C = Cpp.C.C();
  176. // TODO: Include a list of non-viable candidate operators with this diagnostic.
  177. // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.AddWith(Core.IntLiteral)` in type `Cpp.C` that does not implement that interface [MissingImplInMemberAccess]
  178. // CHECK:STDERR: let c2: Cpp.C = c1 + 5;
  179. // CHECK:STDERR: ^~~~~~
  180. // CHECK:STDERR:
  181. let c2: Cpp.C = c1 + 5;
  182. // CHECK:STDERR: fail_call_with_wrong_type.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.AddWith(Cpp.C)` in type `Core.IntLiteral` that does not implement that interface [MissingImplInMemberAccess]
  183. // CHECK:STDERR: let c3: Cpp.C = 6 + c1;
  184. // CHECK:STDERR: ^~~~~~
  185. // CHECK:STDERR:
  186. let c3: Cpp.C = 6 + c1;
  187. }
  188. // ============================================================================
  189. // Overload resolution failures
  190. // ============================================================================
  191. // --- fail_ambiguous.carbon
  192. library "[[@TEST_NAME]]";
  193. import Cpp inline '''
  194. class C {};
  195. void operator+(C, char);
  196. void operator+(C, short);
  197. ''';
  198. fn Test(c: Cpp.C) {
  199. // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE+10]]:5: error: use of overloaded operator '+' is ambiguous (with operand types 'C' and 'int') [CppInteropParseError]
  200. // CHECK:STDERR: 21 | c + 1;
  201. // CHECK:STDERR: | ^
  202. // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-8]]:6: note: candidate function [CppInteropParseNote]
  203. // CHECK:STDERR: 6 | void operator+(C, char);
  204. // CHECK:STDERR: | ^
  205. // CHECK:STDERR: fail_ambiguous.carbon:[[@LINE-10]]:6: note: candidate function [CppInteropParseNote]
  206. // CHECK:STDERR: 7 | void operator+(C, short);
  207. // CHECK:STDERR: | ^
  208. // CHECK:STDERR:
  209. c + 1;
  210. }
  211. // --- fail_deleted.carbon
  212. library "[[@TEST_NAME]]";
  213. import Cpp inline '''
  214. class C {};
  215. void operator+(C, int) = delete;
  216. void operator+(C, void*) = delete;
  217. ''';
  218. fn Test(c: Cpp.C) {
  219. // CHECK:STDERR: fail_deleted.carbon:[[@LINE+10]]:5: error: overload resolution selected deleted operator '+' [CppInteropParseError]
  220. // CHECK:STDERR: 21 | c + 1;
  221. // CHECK:STDERR: | ^
  222. // CHECK:STDERR: fail_deleted.carbon:[[@LINE-8]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
  223. // CHECK:STDERR: 6 | void operator+(C, int) = delete;
  224. // CHECK:STDERR: | ^
  225. // CHECK:STDERR: fail_deleted.carbon:[[@LINE-10]]:6: note: candidate function not viable: no known conversion from 'int' to 'void *' for 2nd argument [CppInteropParseNote]
  226. // CHECK:STDERR: 7 | void operator+(C, void*) = delete;
  227. // CHECK:STDERR: | ^ ~~~~~
  228. // CHECK:STDERR:
  229. c + 1;
  230. }
  231. // ============================================================================
  232. // Rewrite using the spaceship operator
  233. // ============================================================================
  234. // --- fail_todo_rewrite_spaceship.carbon
  235. library "[[@TEST_NAME]]";
  236. import Cpp inline '''
  237. class C {};
  238. namespace std { class strong_ordering {}; }
  239. auto operator<=>(C lhs, C rhs) -> std::strong_ordering;
  240. auto operator>(C lhs, C rhs) -> bool;
  241. auto operator<=(C lhs, C rhs) -> bool;
  242. ''';
  243. fn F() {
  244. //@dump-sem-ir-begin
  245. var c1: Cpp.C = Cpp.C.C();
  246. var c2: Cpp.C = Cpp.C.C();
  247. // No rewrite.
  248. let greater_than: bool = c1 > c2;
  249. // Rewrite.
  250. // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+4]]:25: error: semantics TODO: `Rewriting operator< using operator<=> is not supported` [SemanticsTodo]
  251. // CHECK:STDERR: let less_than: bool = c1 < c2;
  252. // CHECK:STDERR: ^~~~~~~
  253. // CHECK:STDERR:
  254. let less_than: bool = c1 < c2;
  255. // Rewrite.
  256. // CHECK:STDERR: fail_todo_rewrite_spaceship.carbon:[[@LINE+4]]:37: error: semantics TODO: `Rewriting operator>= using operator<=> is not supported` [SemanticsTodo]
  257. // CHECK:STDERR: let greater_than_or_equal: bool = c1 >= c2;
  258. // CHECK:STDERR: ^~~~~~~~
  259. // CHECK:STDERR:
  260. let greater_than_or_equal: bool = c1 >= c2;
  261. // No rewrite.
  262. let less_than_or_equal: bool = c1 <= c2;
  263. //@dump-sem-ir-end
  264. }
  265. // --- fail_rewrite_deleted.carbon
  266. library "[[@TEST_NAME]]";
  267. import Cpp inline '''
  268. class B {};
  269. class C : public B {};
  270. namespace std { class strong_ordering {}; }
  271. auto operator<=>(C lhs, C rhs) -> std::strong_ordering = delete;
  272. auto operator<(C lhs, B rhs) -> bool;
  273. ''';
  274. fn F(c: Cpp.C) -> bool {
  275. // Note that we mention `operator '<=>'` in the diagnostic.
  276. // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE+10]]:12: error: overload resolution selected deleted operator '<=>' [CppInteropParseError]
  277. // CHECK:STDERR: 25 | return c < c;
  278. // CHECK:STDERR: | ^
  279. // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-9]]:6: note: candidate function has been explicitly deleted [CppInteropParseNote]
  280. // CHECK:STDERR: 9 | auto operator<=>(C lhs, C rhs) -> std::strong_ordering = delete;
  281. // CHECK:STDERR: | ^
  282. // CHECK:STDERR: fail_rewrite_deleted.carbon:[[@LINE-11]]:6: note: candidate function [CppInteropParseNote]
  283. // CHECK:STDERR: 10 | auto operator<(C lhs, B rhs) -> bool;
  284. // CHECK:STDERR: | ^
  285. // CHECK:STDERR:
  286. return c < c;
  287. }
  288. // ============================================================================
  289. // Rewrite using the equal operator
  290. // ============================================================================
  291. // --- fail_todo_rewrite_equal.carbon
  292. library "[[@TEST_NAME]]";
  293. import Cpp inline '''
  294. class C {};
  295. auto operator==(C lhs, C rhs) -> bool;
  296. ''';
  297. fn F() {
  298. //@dump-sem-ir-begin
  299. var c1: Cpp.C = Cpp.C.C();
  300. var c2: Cpp.C = Cpp.C.C();
  301. // No rewrite.
  302. let equal: bool = c1 == c2;
  303. // Rewrite.
  304. // CHECK:STDERR: fail_todo_rewrite_equal.carbon:[[@LINE+4]]:25: error: semantics TODO: `Rewriting operator!= using operator== is not supported` [SemanticsTodo]
  305. // CHECK:STDERR: let not_equal: bool = c1 != c2;
  306. // CHECK:STDERR: ^~~~~~~~
  307. // CHECK:STDERR:
  308. let not_equal: bool = c1 != c2;
  309. //@dump-sem-ir-end
  310. }
  311. // ============================================================================
  312. // One of two operands conversion
  313. // ============================================================================
  314. // --- plus_with_int_conversion.h
  315. class C {
  316. public:
  317. C(int);
  318. };
  319. auto operator+(C lhs, C rhs) -> C;
  320. // --- fail_todo_plus_with_int_conversion.carbon
  321. library "[[@TEST_NAME]]";
  322. import Cpp library "plus_with_int_conversion.h";
  323. fn F() {
  324. let c1: Cpp.C = Cpp.C.C(4);
  325. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE+11]]:24: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.C` [ConversionFailure]
  326. // CHECK:STDERR: let c2: Cpp.C = c1 + 5;
  327. // CHECK:STDERR: ^
  328. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE+8]]:24: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessNote]
  329. // CHECK:STDERR: let c2: Cpp.C = c1 + 5;
  330. // CHECK:STDERR: ^
  331. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
  332. // CHECK:STDERR: ./plus_with_int_conversion.h:6:25: note: initializing function parameter [InCallToFunctionParam]
  333. // CHECK:STDERR: auto operator+(C lhs, C rhs) -> C;
  334. // CHECK:STDERR: ^
  335. // CHECK:STDERR:
  336. let c2: Cpp.C = c1 + 5;
  337. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE+11]]:19: error: cannot implicitly convert expression of type `Core.IntLiteral` to `Cpp.C` [ConversionFailure]
  338. // CHECK:STDERR: let c3: Cpp.C = 6 + c1;
  339. // CHECK:STDERR: ^
  340. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE+8]]:19: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(Cpp.C)` [MissingImplInMemberAccessNote]
  341. // CHECK:STDERR: let c3: Cpp.C = 6 + c1;
  342. // CHECK:STDERR: ^
  343. // CHECK:STDERR: fail_todo_plus_with_int_conversion.carbon:[[@LINE-22]]:10: in file included here [InCppInclude]
  344. // CHECK:STDERR: ./plus_with_int_conversion.h:6:18: note: initializing function parameter [InCallToFunctionParam]
  345. // CHECK:STDERR: auto operator+(C lhs, C rhs) -> C;
  346. // CHECK:STDERR: ^
  347. // CHECK:STDERR:
  348. let c3: Cpp.C = 6 + c1;
  349. }
  350. // ============================================================================
  351. // All operands conversion
  352. // ============================================================================
  353. // --- plus_with_string_view_conversion.h
  354. namespace std {
  355. using size_t = __SIZE_TYPE__;
  356. inline namespace __1 {
  357. template<typename T> struct char_traits {};
  358. template<typename CharT, typename Traits = char_traits<CharT>>
  359. class basic_string_view {
  360. public:
  361. basic_string_view() = default;
  362. size_t size() const { return size_; }
  363. private:
  364. const CharT* data_;
  365. size_t size_;
  366. };
  367. using string_view = basic_string_view<char>;
  368. }
  369. }
  370. class C {
  371. public:
  372. C(std::string_view s);
  373. };
  374. auto operator+(C lhs, C rhs) -> C;
  375. // --- fail_todo_import_plus_with_string_view_conversion.carbon
  376. library "[[@TEST_NAME]]";
  377. import Cpp library "plus_with_string_view_conversion.h";
  378. fn F() {
  379. let s1: str = "hello";
  380. let s2: str = "world";
  381. // CHECK:STDERR: fail_todo_import_plus_with_string_view_conversion.carbon:[[@LINE+4]]:18: error: cannot access member of interface `Core.AddWith(str)` in type `str` that does not implement that interface [MissingImplInMemberAccess]
  382. // CHECK:STDERR: let c: Cpp.C = s1 + s2;
  383. // CHECK:STDERR: ^~~~~~~
  384. // CHECK:STDERR:
  385. let c: Cpp.C = s1 + s2;
  386. }
  387. // ============================================================================
  388. // Unsupported unary operators
  389. // ============================================================================
  390. // --- unsupported_unary_operators.h
  391. class C {};
  392. // Arithmetic.
  393. auto operator+(C operand) -> C;
  394. // Increment and Decrement.
  395. auto operator++(C& operand, int) -> C&;
  396. auto operator--(C& operand, int) -> C&;
  397. // Bitwise.
  398. auto operator~(C operand) -> C;
  399. // Logical.
  400. auto operator!(C operand) -> C;
  401. // Pointer and Memory.
  402. class P {
  403. public:
  404. auto foo() -> P;
  405. auto operator->() const -> P* _Nonnull;
  406. };
  407. auto operator*(P operand) -> P;
  408. auto operator&(P operand) -> P;
  409. // --- fail_todo_import_unsupported_unary_operators.carbon
  410. library "[[@TEST_NAME]]";
  411. import Cpp library "unsupported_unary_operators.h";
  412. fn F() {
  413. var c: Cpp.C = Cpp.C.C();
  414. // Arithmetic.
  415. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+12]]:21: error: expected expression [ExpectedExpr]
  416. // CHECK:STDERR: let plus: Cpp.C = +c;
  417. // CHECK:STDERR: ^
  418. // CHECK:STDERR:
  419. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:21: error: whitespace missing after binary operator [BinaryOperatorRequiresWhitespace]
  420. // CHECK:STDERR: let plus: Cpp.C = +c;
  421. // CHECK:STDERR: ^
  422. // CHECK:STDERR:
  423. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:21: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  424. // CHECK:STDERR: let plus: Cpp.C = +c;
  425. // CHECK:STDERR: ^
  426. // CHECK:STDERR:
  427. let plus: Cpp.C = +c;
  428. // Increment and Decrement.
  429. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
  430. // CHECK:STDERR: c++;
  431. // CHECK:STDERR: ^~
  432. // CHECK:STDERR:
  433. c++;
  434. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:4: error: expected `;` after expression statement [ExpectedExprSemi]
  435. // CHECK:STDERR: c--;
  436. // CHECK:STDERR: ^~
  437. // CHECK:STDERR:
  438. c--;
  439. // Bitwise.
  440. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+8]]:26: error: expected expression [ExpectedExpr]
  441. // CHECK:STDERR: let not_value: Cpp.C = ~c;
  442. // CHECK:STDERR: ^
  443. // CHECK:STDERR:
  444. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:26: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
  445. // CHECK:STDERR: let not_value: Cpp.C = ~c;
  446. // CHECK:STDERR: ^
  447. // CHECK:STDERR:
  448. let not_value: Cpp.C = ~c;
  449. // Logical.
  450. // CHECK:STDERR: fail_todo_import_unsupported_unary_operators.carbon:[[@LINE+4]]:35: error: `let` declarations must end with a `;` [ExpectedDeclSemi]
  451. // CHECK:STDERR: let not_result: Cpp.C = operator!(c1);
  452. // CHECK:STDERR: ^
  453. // CHECK:STDERR:
  454. let not_result: Cpp.C = operator!(c1);
  455. // Pointer and Memory.
  456. var p: Cpp.P = Cpp.P.P();
  457. // Pointer and Memory.
  458. let dereference: Cpp.P = *p;
  459. let address: Cpp.P = operator&(p);
  460. let call_result: Cpp.P = p->foo();
  461. }
  462. // ============================================================================
  463. // Unsupported binary operators
  464. // ============================================================================
  465. // --- unsupported_binary_operators.h
  466. class C {};
  467. // Logical.
  468. auto operator&&(C lhs, C rhs) -> C;
  469. auto operator||(C lhs, C rhs) -> C;
  470. // --- fail_todo_import_unsupported_binary_operators.carbon
  471. library "[[@TEST_NAME]]";
  472. import Cpp library "unsupported_binary_operators.h";
  473. fn F() {
  474. var c1: Cpp.C = Cpp.C.C();
  475. // Logical.
  476. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:27: error: name `operator` not found [NameNotFound]
  477. // CHECK:STDERR: let and_result: Cpp.C = operator&&(c1, c2);
  478. // CHECK:STDERR: ^~~~~~~~
  479. // CHECK:STDERR:
  480. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+12]]:35: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
  481. // CHECK:STDERR: let and_result: Cpp.C = operator&&(c1, c2);
  482. // CHECK:STDERR: ^
  483. // CHECK:STDERR:
  484. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:42: error: name `c2` not found [NameNotFound]
  485. // CHECK:STDERR: let and_result: Cpp.C = operator&&(c1, c2);
  486. // CHECK:STDERR: ^~
  487. // CHECK:STDERR:
  488. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:36: error: cannot take the address of non-reference expression [AddrOfNonRef]
  489. // CHECK:STDERR: let and_result: Cpp.C = operator&&(c1, c2);
  490. // CHECK:STDERR: ^
  491. // CHECK:STDERR:
  492. let and_result: Cpp.C = operator&&(c1, c2);
  493. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+20]]:26: error: name `operator` not found [NameNotFound]
  494. // CHECK:STDERR: let or_result: Cpp.C = operator||(c1, c2);
  495. // CHECK:STDERR: ^~~~~~~~
  496. // CHECK:STDERR:
  497. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+16]]:34: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
  498. // CHECK:STDERR: let or_result: Cpp.C = operator||(c1, c2);
  499. // CHECK:STDERR: ^
  500. // CHECK:STDERR:
  501. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+12]]:35: error: expected expression [ExpectedExpr]
  502. // CHECK:STDERR: let or_result: Cpp.C = operator||(c1, c2);
  503. // CHECK:STDERR: ^
  504. // CHECK:STDERR:
  505. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+8]]:35: error: whitespace missing around binary operator [BinaryOperatorRequiresWhitespace]
  506. // CHECK:STDERR: let or_result: Cpp.C = operator||(c1, c2);
  507. // CHECK:STDERR: ^
  508. // CHECK:STDERR:
  509. // CHECK:STDERR: fail_todo_import_unsupported_binary_operators.carbon:[[@LINE+4]]:35: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  510. // CHECK:STDERR: let or_result: Cpp.C = operator||(c1, c2);
  511. // CHECK:STDERR: ^
  512. // CHECK:STDERR:
  513. let or_result: Cpp.C = operator||(c1, c2);
  514. }
  515. // ============================================================================
  516. // Operator and operands in a single namespace
  517. // ============================================================================
  518. // --- single_namespace.h
  519. namespace N {
  520. class C {};
  521. auto operator+(C lhs, C rhs) -> C;
  522. } // namespace N
  523. // --- import_single_namespace.carbon
  524. library "[[@TEST_NAME]]";
  525. import Cpp library "single_namespace.h";
  526. fn F() {
  527. //@dump-sem-ir-begin
  528. let c1: Cpp.N.C = Cpp.N.C.C();
  529. let c2: Cpp.N.C = Cpp.N.C.C();
  530. let c3: Cpp.N.C = c1 + c2;
  531. //@dump-sem-ir-end
  532. }
  533. // ============================================================================
  534. // Operator and operands in a different namespaces
  535. // ============================================================================
  536. // --- multiple_namespaces.h
  537. namespace N1 {
  538. class C1 {};
  539. } // namespace N1
  540. namespace N2 {
  541. class C2 {};
  542. auto operator+(N1::C1 lhs, C2 rhs) -> C2;
  543. auto operator-(C2 lhs, N1::C1 rhs) -> C2;
  544. } // namespace N2
  545. // --- import_multiple_namespaces.carbon
  546. library "[[@TEST_NAME]]";
  547. import Cpp library "multiple_namespaces.h";
  548. fn F() {
  549. //@dump-sem-ir-begin
  550. let c1: Cpp.N1.C1 = Cpp.N1.C1.C1();
  551. let c2: Cpp.N2.C2 = Cpp.N2.C2.C2();
  552. let c3: Cpp.N2.C2 = c1 + c2;
  553. let c4: Cpp.N2.C2 = c2 - c1;
  554. //@dump-sem-ir-end
  555. }
  556. // ============================================================================
  557. // Operands in namespace, operator in global namespace
  558. // ============================================================================
  559. // --- operands_in_namespace_operator_in_global.h
  560. namespace N {
  561. class C {};
  562. } // namespace N
  563. auto operator+(N::C lhs, N::C rhs) -> N::C;
  564. void foo() {
  565. N::C() + N::C();
  566. }
  567. // --- fail_todo_import_operands_in_namespace_operator_in_global.carbon
  568. library "[[@TEST_NAME]]";
  569. import Cpp library "operands_in_namespace_operator_in_global.h";
  570. fn F() {
  571. //@dump-sem-ir-begin
  572. let c1: Cpp.N.C = Cpp.N.C.C();
  573. let c2: Cpp.N.C = Cpp.N.C.C();
  574. // CHECK:STDERR: fail_todo_import_operands_in_namespace_operator_in_global.carbon:[[@LINE+4]]:21: error: cannot access member of interface `Core.AddWith(Cpp.N.C)` in type `Cpp.N.C` that does not implement that interface [MissingImplInMemberAccess]
  575. // CHECK:STDERR: let c3: Cpp.N.C = c1 + c2;
  576. // CHECK:STDERR: ^~~~~~~
  577. // CHECK:STDERR:
  578. let c3: Cpp.N.C = c1 + c2;
  579. //@dump-sem-ir-end
  580. }
  581. // ============================================================================
  582. // Operand is an inner class
  583. // ============================================================================
  584. // --- inner_class.h
  585. class O {
  586. public:
  587. class C {};
  588. };
  589. auto operator+(O::C lhs, O::C rhs) -> O::C;
  590. // --- import_inner_class.carbon
  591. library "[[@TEST_NAME]]";
  592. import Cpp library "inner_class.h";
  593. fn F() {
  594. //@dump-sem-ir-begin
  595. let c1: Cpp.O.C = Cpp.O.C.C();
  596. let c2: Cpp.O.C = Cpp.O.C.C();
  597. let c3: Cpp.O.C = c1 + c2;
  598. //@dump-sem-ir-end
  599. }
  600. // ============================================================================
  601. // Operand is an inner class in a namespace
  602. // ============================================================================
  603. // --- inner_class_in_namespace.h
  604. namespace N {
  605. class O {
  606. public:
  607. class C {};
  608. };
  609. auto operator+(O::C lhs, O::C rhs) -> O::C;
  610. } // namespace N
  611. // --- import_inner_class_in_namespace.carbon
  612. library "[[@TEST_NAME]]";
  613. import Cpp library "inner_class_in_namespace.h";
  614. fn F() {
  615. //@dump-sem-ir-begin
  616. let c1: Cpp.N.O.C = Cpp.N.O.C.C();
  617. let c2: Cpp.N.O.C = Cpp.N.O.C.C();
  618. let c3: Cpp.N.O.C = c1 + c2;
  619. //@dump-sem-ir-end
  620. }
  621. // ============================================================================
  622. // Member operator
  623. // ============================================================================
  624. // --- member_add_with.h
  625. class C {
  626. public:
  627. // Unary.
  628. auto operator-() -> C;
  629. // Binary.
  630. auto operator+(C rhs) -> C;
  631. };
  632. // --- import_member_add_with.carbon
  633. library "[[@TEST_NAME]]";
  634. import Cpp library "member_add_with.h";
  635. fn F() {
  636. //@dump-sem-ir-begin
  637. var c1: Cpp.C = Cpp.C.C();
  638. var c2: Cpp.C = -c1;
  639. var c3: Cpp.C = c1 + c2;
  640. //@dump-sem-ir-end
  641. }
  642. // ============================================================================
  643. // Satisfying constraints
  644. // ============================================================================
  645. // --- fail_todo_constraints.carbon
  646. library "[[@TEST_NAME]]";
  647. import Cpp inline '''
  648. class X {};
  649. X operator+(X, X);
  650. ''';
  651. // TODO: Use Core.Add() when it is available.
  652. // TODO: `Sum()` should be declared this way when generics implementation is ready for that:
  653. // fn Sum[T:! Core.AddWith(.Self) where .Result = .Self](a: T, b: T) -> T
  654. fn Sum[U:! type, T:! Core.AddWith(U) where .Result = U](a: T, b: U) -> U {
  655. return a + b;
  656. }
  657. fn Call(x: Cpp.X) -> Cpp.X {
  658. // CHECK:STDERR: fail_todo_constraints.carbon:[[@LINE+7]]:10: error: cannot convert type `Cpp.X` into type implementing `Core.AddWith(Cpp.X) where .(Core.AddWith(Cpp.X).Core.Result) = Cpp.X` [ConversionFailureTypeToFacet]
  659. // CHECK:STDERR: return Sum(x, x);
  660. // CHECK:STDERR: ^~~~~~~~~
  661. // CHECK:STDERR: fail_todo_constraints.carbon:[[@LINE-7]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  662. // CHECK:STDERR: fn Sum[U:! type, T:! Core.AddWith(U) where .Result = U](a: T, b: U) -> U {
  663. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  664. // CHECK:STDERR:
  665. return Sum(x, x);
  666. }
  667. // ============================================================================
  668. // Operator not found
  669. // ============================================================================
  670. // --- not_found.h
  671. class C {};
  672. // --- fail_import_not_found.carbon
  673. library "[[@TEST_NAME]]";
  674. import Cpp library "not_found.h";
  675. fn F() {
  676. let c1: Cpp.C = Cpp.C.C();
  677. let c2: Cpp.C = Cpp.C.C();
  678. // CHECK:STDERR: fail_import_not_found.carbon:[[@LINE+4]]:19: error: cannot access member of interface `Core.AddWith(Cpp.C)` in type `Cpp.C` that does not implement that interface [MissingImplInMemberAccess]
  679. // CHECK:STDERR: let c3: Cpp.C = c1 + c2;
  680. // CHECK:STDERR: ^~~~~~~
  681. // CHECK:STDERR:
  682. let c3: Cpp.C = c1 + c2;
  683. }
  684. // ============================================================================
  685. // Incomplete operand C++ type
  686. // ============================================================================
  687. // --- incomplete.h
  688. class Incomplete;
  689. class Complete {};
  690. auto CreateIncomplete() -> Incomplete* _Nonnull;
  691. // --- fail_import_incomplete_unary.carbon
  692. library "[[@TEST_NAME]]";
  693. import Cpp library "incomplete.h";
  694. fn F() {
  695. // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE+8]]:27: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
  696. // CHECK:STDERR: let result_unary: i32 = -*Cpp.CreateIncomplete();
  697. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  698. // CHECK:STDERR: fail_import_incomplete_unary.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  699. // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
  700. // CHECK:STDERR: class Incomplete;
  701. // CHECK:STDERR: ^
  702. // CHECK:STDERR:
  703. let result_unary: i32 = -*Cpp.CreateIncomplete();
  704. }
  705. // --- fail_import_incomplete_binary.carbon
  706. library "[[@TEST_NAME]]";
  707. import Cpp library "incomplete.h";
  708. fn F() {
  709. var complete: Cpp.Complete = Cpp.Complete.Complete();
  710. // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE+8]]:28: error: looking up a C++ operator with incomplete operand type `Cpp.Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
  711. // CHECK:STDERR: let result_binary: i32 = complete + *Cpp.CreateIncomplete();
  712. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  713. // CHECK:STDERR: fail_import_incomplete_binary.carbon:[[@LINE-7]]:10: in file included here [InCppInclude]
  714. // CHECK:STDERR: ./incomplete.h:2:7: note: class was forward declared here [ClassForwardDeclaredHere]
  715. // CHECK:STDERR: class Incomplete;
  716. // CHECK:STDERR: ^
  717. // CHECK:STDERR:
  718. let result_binary: i32 = complete + *Cpp.CreateIncomplete();
  719. }
  720. // ============================================================================
  721. // Incomplete operand Carbon type
  722. // ============================================================================
  723. // --- complete.h
  724. struct Complete {};
  725. // --- fail_incomplete_operand_carbon_type.carbon
  726. library "[[@TEST_NAME]]";
  727. import Cpp library "complete.h";
  728. class Incomplete;
  729. fn CreateIncomplete() -> Incomplete*;
  730. fn F() {
  731. var complete: Cpp.Complete = Cpp.Complete.Complete();
  732. // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE+7]]:21: error: looking up a C++ operator with incomplete operand type `Incomplete` [IncompleteOperandTypeInCppOperatorLookup]
  733. // CHECK:STDERR: let result: i32 = *CreateIncomplete() + complete;
  734. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  735. // CHECK:STDERR: fail_incomplete_operand_carbon_type.carbon:[[@LINE-8]]:1: note: class was forward declared here [ClassForwardDeclaredHere]
  736. // CHECK:STDERR: class Incomplete;
  737. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~
  738. // CHECK:STDERR:
  739. let result: i32 = *CreateIncomplete() + complete;
  740. }
  741. // ============================================================================
  742. // Indirect template instantiation
  743. // ============================================================================
  744. // --- indirect_template_instantiation.carbon
  745. library "[[@TEST_NAME]]";
  746. import Cpp inline '''
  747. template<typename T> struct B {};
  748. template<typename T> struct A {};
  749. using X = B<A<int>>;
  750. int operator+(X, X);
  751. ''';
  752. fn F(x: Cpp.X) -> i32 {
  753. //@dump-sem-ir-begin
  754. return x + x;
  755. //@dump-sem-ir-end
  756. }
  757. // --- fail_indirect_template_instantiation_error.carbon
  758. library "[[@TEST_NAME]]";
  759. import Cpp inline '''
  760. template<typename T> struct B {};
  761. template<typename T> struct A {
  762. // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+3]]:19: error: type 'int' cannot be used prior to '::' because it has no members [CppInteropParseError]
  763. // CHECK:STDERR: 10 | friend typename T::error operator+(B<A>, B<A>);
  764. // CHECK:STDERR: | ^
  765. friend typename T::error operator+(B<A>, B<A>);
  766. };
  767. using X = B<A<int>>;
  768. ''';
  769. fn F(x: Cpp.X) -> i32 {
  770. // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+8]]:12: note: in instantiation of template class 'A<int>' requested here [CppInteropParseNote]
  771. // CHECK:STDERR: 25 | return x + x;
  772. // CHECK:STDERR: | ^
  773. // CHECK:STDERR:
  774. // CHECK:STDERR: fail_indirect_template_instantiation_error.carbon:[[@LINE+4]]:10: error: cannot access member of interface `Core.AddWith(Cpp.B)` in type `Cpp.B` that does not implement that interface [MissingImplInMemberAccess]
  775. // CHECK:STDERR: return x + x;
  776. // CHECK:STDERR: ^~~~~
  777. // CHECK:STDERR:
  778. return x + x;
  779. }
  780. // ============================================================================
  781. // Templated operators
  782. // ============================================================================
  783. // --- templated_operator.h
  784. template<typename T> struct X {};
  785. template<typename T> X<T> operator+(X<T>, X<T>);
  786. using Xint = X<int>;
  787. // --- templated_operator.carbon
  788. library "[[@TEST_NAME]]";
  789. import Cpp library "templated_operator.h";
  790. fn Test(x: Cpp.Xint) -> Cpp.Xint {
  791. return x + x;
  792. }
  793. // ============================================================================
  794. // Operator overloading
  795. // ============================================================================
  796. // --- overloading.h
  797. class C {};
  798. auto operator+(C lhs, C rhs) -> C;
  799. class D {};
  800. auto operator+(D lhs, D rhs) -> D;
  801. // --- import_overloading.carbon
  802. library "[[@TEST_NAME]]";
  803. import Cpp library "overloading.h";
  804. fn F() {
  805. let c1: Cpp.C = Cpp.C.C();
  806. let c2: Cpp.C = Cpp.C.C();
  807. //@dump-sem-ir-begin
  808. let c3: Cpp.C = c1 + c2;
  809. //@dump-sem-ir-end
  810. }
  811. // CHECK:STDOUT: --- import_unary_operators.carbon
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: constants {
  814. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  815. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  816. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  817. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  818. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  819. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  820. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  821. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  822. // CHECK:STDOUT: %const: type = const_type %ptr.d9e [concrete]
  823. // CHECK:STDOUT: %cpp_operator.type.1ea478.1: type = fn_type @cpp_operator.1 [concrete]
  824. // CHECK:STDOUT: %cpp_operator.0a3797.1: %cpp_operator.type.1ea478.1 = struct_value () [concrete]
  825. // CHECK:STDOUT: %cpp_operator.type.1ea478.2: type = fn_type @cpp_operator.2 [concrete]
  826. // CHECK:STDOUT: %cpp_operator.0a3797.2: %cpp_operator.type.1ea478.2 = struct_value () [concrete]
  827. // CHECK:STDOUT: %operator-__carbon_thunk.type: type = fn_type @operator-__carbon_thunk [concrete]
  828. // CHECK:STDOUT: %operator-__carbon_thunk: %operator-__carbon_thunk.type = struct_value () [concrete]
  829. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  830. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  831. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  832. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  833. // CHECK:STDOUT: }
  834. // CHECK:STDOUT:
  835. // CHECK:STDOUT: imports {
  836. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  837. // CHECK:STDOUT: .C = %C.decl
  838. // CHECK:STDOUT: import Cpp//...
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  841. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  842. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  843. // CHECK:STDOUT: <elided>
  844. // CHECK:STDOUT: } {
  845. // CHECK:STDOUT: <elided>
  846. // CHECK:STDOUT: }
  847. // CHECK:STDOUT: %cpp_operator.decl.4206c9.1: %cpp_operator.type.1ea478.1 = fn_decl @cpp_operator.1 [concrete = constants.%cpp_operator.0a3797.1] {
  848. // CHECK:STDOUT: <elided>
  849. // CHECK:STDOUT: } {
  850. // CHECK:STDOUT: <elided>
  851. // CHECK:STDOUT: }
  852. // CHECK:STDOUT: %cpp_operator.decl.4206c9.2: %cpp_operator.type.1ea478.2 = fn_decl @cpp_operator.2 [concrete = constants.%cpp_operator.0a3797.2] {
  853. // CHECK:STDOUT: <elided>
  854. // CHECK:STDOUT: } {
  855. // CHECK:STDOUT: <elided>
  856. // CHECK:STDOUT: }
  857. // CHECK:STDOUT: %operator-__carbon_thunk.decl: %operator-__carbon_thunk.type = fn_decl @operator-__carbon_thunk [concrete = constants.%operator-__carbon_thunk] {
  858. // CHECK:STDOUT: <elided>
  859. // CHECK:STDOUT: } {
  860. // CHECK:STDOUT: <elided>
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT: }
  863. // CHECK:STDOUT:
  864. // CHECK:STDOUT: fn @F() {
  865. // CHECK:STDOUT: !entry:
  866. // CHECK:STDOUT: name_binding_decl {
  867. // CHECK:STDOUT: %c.patt: %pattern_type.217 = ref_binding_pattern c [concrete]
  868. // CHECK:STDOUT: %c.var_patt: %pattern_type.217 = var_pattern %c.patt [concrete]
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT: %c.var: ref %C = var %c.var_patt
  871. // CHECK:STDOUT: %Cpp.ref.loc8_18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  872. // CHECK:STDOUT: %C.ref.loc8_21: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  873. // CHECK:STDOUT: %C.ref.loc8_23: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  874. // CHECK:STDOUT: %.loc8_3: ref %C = splice_block %c.var {}
  875. // CHECK:STDOUT: %addr.loc8: %ptr.d9e = addr_of %.loc8_3
  876. // CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  877. // CHECK:STDOUT: %.loc8_26: init %C = in_place_init %C__carbon_thunk.call, %.loc8_3
  878. // CHECK:STDOUT: assign %c.var, %.loc8_26
  879. // CHECK:STDOUT: %.loc8_13: type = splice_block %C.ref.loc8_13 [concrete = constants.%C] {
  880. // CHECK:STDOUT: %Cpp.ref.loc8_10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  881. // CHECK:STDOUT: %C.ref.loc8_13: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT: %c: ref %C = ref_binding c, %c.var
  884. // CHECK:STDOUT: %c.ref.loc11: ref %C = name_ref c, %c
  885. // CHECK:STDOUT: %cpp_operator.call.loc11: init %const = call imports.%cpp_operator.decl.4206c9.1(%c.ref.loc11)
  886. // CHECK:STDOUT: %c.ref.loc12: ref %C = name_ref c, %c
  887. // CHECK:STDOUT: %cpp_operator.call.loc12: init %const = call imports.%cpp_operator.decl.4206c9.2(%c.ref.loc12)
  888. // CHECK:STDOUT: name_binding_decl {
  889. // CHECK:STDOUT: %minus.patt: %pattern_type.217 = value_binding_pattern minus [concrete]
  890. // CHECK:STDOUT: }
  891. // CHECK:STDOUT: %c.ref.loc15: ref %C = name_ref c, %c
  892. // CHECK:STDOUT: %.loc15_22.1: ref %C = temporary_storage
  893. // CHECK:STDOUT: %.loc15_23.1: %C = acquire_value %c.ref.loc15
  894. // CHECK:STDOUT: %.loc15_23.2: ref %C = value_as_ref %.loc15_23.1
  895. // CHECK:STDOUT: %addr.loc15_22.1: %ptr.d9e = addr_of %.loc15_23.2
  896. // CHECK:STDOUT: %addr.loc15_22.2: %ptr.d9e = addr_of %.loc15_22.1
  897. // CHECK:STDOUT: %operator-__carbon_thunk.call: init %empty_tuple.type = call imports.%operator-__carbon_thunk.decl(%addr.loc15_22.1, %addr.loc15_22.2)
  898. // CHECK:STDOUT: %.loc15_22.2: init %C = in_place_init %operator-__carbon_thunk.call, %.loc15_22.1
  899. // CHECK:STDOUT: %.loc15_17: type = splice_block %C.ref.loc15 [concrete = constants.%C] {
  900. // CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  901. // CHECK:STDOUT: %C.ref.loc15: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  902. // CHECK:STDOUT: }
  903. // CHECK:STDOUT: %.loc15_22.3: ref %C = temporary %.loc15_22.1, %.loc15_22.2
  904. // CHECK:STDOUT: %.loc15_22.4: %C = acquire_value %.loc15_22.3
  905. // CHECK:STDOUT: %minus: %C = value_binding minus, %.loc15_22.4
  906. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc15: <bound method> = bound_method %.loc15_22.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  907. // CHECK:STDOUT: <elided>
  908. // CHECK:STDOUT: %bound_method.loc15: <bound method> = bound_method %.loc15_22.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  909. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc15: init %empty_tuple.type = call %bound_method.loc15(%.loc15_22.3)
  910. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %c.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  911. // CHECK:STDOUT: <elided>
  912. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %c.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  913. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%c.var)
  914. // CHECK:STDOUT: <elided>
  915. // CHECK:STDOUT: }
  916. // CHECK:STDOUT:
  917. // CHECK:STDOUT: --- import_binary_operators.carbon
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: constants {
  920. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  921. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  922. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  923. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  924. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  925. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  926. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  927. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  928. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  929. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  930. // CHECK:STDOUT: %operator-__carbon_thunk.type: type = fn_type @operator-__carbon_thunk [concrete]
  931. // CHECK:STDOUT: %operator-__carbon_thunk: %operator-__carbon_thunk.type = struct_value () [concrete]
  932. // CHECK:STDOUT: %operator*__carbon_thunk.type: type = fn_type @operator*__carbon_thunk [concrete]
  933. // CHECK:STDOUT: %operator*__carbon_thunk: %operator*__carbon_thunk.type = struct_value () [concrete]
  934. // CHECK:STDOUT: %operator/__carbon_thunk.type: type = fn_type @operator/__carbon_thunk [concrete]
  935. // CHECK:STDOUT: %operator/__carbon_thunk: %operator/__carbon_thunk.type = struct_value () [concrete]
  936. // CHECK:STDOUT: %operator%__carbon_thunk.type: type = fn_type @operator%__carbon_thunk [concrete]
  937. // CHECK:STDOUT: %operator%__carbon_thunk: %operator%__carbon_thunk.type = struct_value () [concrete]
  938. // CHECK:STDOUT: %operator&__carbon_thunk.type: type = fn_type @operator&__carbon_thunk [concrete]
  939. // CHECK:STDOUT: %operator&__carbon_thunk: %operator&__carbon_thunk.type = struct_value () [concrete]
  940. // CHECK:STDOUT: %operator|__carbon_thunk.type: type = fn_type @operator|__carbon_thunk [concrete]
  941. // CHECK:STDOUT: %operator|__carbon_thunk: %operator|__carbon_thunk.type = struct_value () [concrete]
  942. // CHECK:STDOUT: %operator^__carbon_thunk.type: type = fn_type @operator^__carbon_thunk [concrete]
  943. // CHECK:STDOUT: %operator^__carbon_thunk: %operator^__carbon_thunk.type = struct_value () [concrete]
  944. // CHECK:STDOUT: %int_3.1ba: Core.IntLiteral = int_value 3 [concrete]
  945. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  946. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  947. // CHECK:STDOUT: %operator<<__carbon_thunk.type: type = fn_type @operator<<__carbon_thunk [concrete]
  948. // CHECK:STDOUT: %operator<<__carbon_thunk: %operator<<__carbon_thunk.type = struct_value () [concrete]
  949. // CHECK:STDOUT: %ImplicitAs.type.d14: type = facet_type <@ImplicitAs, @ImplicitAs(%i32)> [concrete]
  950. // CHECK:STDOUT: %ImplicitAs.Convert.type.1b6: type = fn_type @ImplicitAs.Convert, @ImplicitAs(%i32) [concrete]
  951. // CHECK:STDOUT: %To: Core.IntLiteral = symbolic_binding To, 0 [symbolic]
  952. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%To) [symbolic]
  953. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51 = struct_value () [symbolic]
  954. // CHECK:STDOUT: %ImplicitAs.impl_witness.bc9: <witness> = impl_witness imports.%ImplicitAs.impl_witness_table.132, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  955. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e: type = fn_type @Core.IntLiteral.as.ImplicitAs.impl.Convert, @Core.IntLiteral.as.ImplicitAs.impl(%int_32) [concrete]
  956. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b: %Core.IntLiteral.as.ImplicitAs.impl.Convert.type.51e = struct_value () [concrete]
  957. // CHECK:STDOUT: %ImplicitAs.facet: %ImplicitAs.type.d14 = facet_value Core.IntLiteral, (%ImplicitAs.impl_witness.bc9) [concrete]
  958. // CHECK:STDOUT: %.322: type = fn_type_with_self_type %ImplicitAs.Convert.type.1b6, %ImplicitAs.facet [concrete]
  959. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.87d: <bound method> = bound_method %int_3.1ba, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  960. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn: <specific function> = specific_function %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b, @Core.IntLiteral.as.ImplicitAs.impl.Convert(%int_32) [concrete]
  961. // CHECK:STDOUT: %bound_method.def: <bound method> = bound_method %int_3.1ba, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  962. // CHECK:STDOUT: %int_3.822: %i32 = int_value 3 [concrete]
  963. // CHECK:STDOUT: %int_5.64b: Core.IntLiteral = int_value 5 [concrete]
  964. // CHECK:STDOUT: %operator>>__carbon_thunk.type: type = fn_type @operator>>__carbon_thunk [concrete]
  965. // CHECK:STDOUT: %operator>>__carbon_thunk: %operator>>__carbon_thunk.type = struct_value () [concrete]
  966. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.451: <bound method> = bound_method %int_5.64b, %Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b [concrete]
  967. // CHECK:STDOUT: %bound_method.c57: <bound method> = bound_method %int_5.64b, %Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn [concrete]
  968. // CHECK:STDOUT: %int_5.0f6: %i32 = int_value 5 [concrete]
  969. // CHECK:STDOUT: %const.7c5: type = const_type %ptr.d9e [concrete]
  970. // CHECK:STDOUT: %operator+=__carbon_thunk.type: type = fn_type @operator+=__carbon_thunk [concrete]
  971. // CHECK:STDOUT: %operator+=__carbon_thunk: %operator+=__carbon_thunk.type = struct_value () [concrete]
  972. // CHECK:STDOUT: %operator-=__carbon_thunk.type: type = fn_type @operator-=__carbon_thunk [concrete]
  973. // CHECK:STDOUT: %operator-=__carbon_thunk: %operator-=__carbon_thunk.type = struct_value () [concrete]
  974. // CHECK:STDOUT: %operator*=__carbon_thunk.type: type = fn_type @operator*=__carbon_thunk [concrete]
  975. // CHECK:STDOUT: %operator*=__carbon_thunk: %operator*=__carbon_thunk.type = struct_value () [concrete]
  976. // CHECK:STDOUT: %operator/=__carbon_thunk.type: type = fn_type @operator/=__carbon_thunk [concrete]
  977. // CHECK:STDOUT: %operator/=__carbon_thunk: %operator/=__carbon_thunk.type = struct_value () [concrete]
  978. // CHECK:STDOUT: %operator%=__carbon_thunk.type: type = fn_type @operator%=__carbon_thunk [concrete]
  979. // CHECK:STDOUT: %operator%=__carbon_thunk: %operator%=__carbon_thunk.type = struct_value () [concrete]
  980. // CHECK:STDOUT: %operator&=__carbon_thunk.type: type = fn_type @operator&=__carbon_thunk [concrete]
  981. // CHECK:STDOUT: %operator&=__carbon_thunk: %operator&=__carbon_thunk.type = struct_value () [concrete]
  982. // CHECK:STDOUT: %operator|=__carbon_thunk.type: type = fn_type @operator|=__carbon_thunk [concrete]
  983. // CHECK:STDOUT: %operator|=__carbon_thunk: %operator|=__carbon_thunk.type = struct_value () [concrete]
  984. // CHECK:STDOUT: %operator^=__carbon_thunk.type: type = fn_type @operator^=__carbon_thunk [concrete]
  985. // CHECK:STDOUT: %operator^=__carbon_thunk: %operator^=__carbon_thunk.type = struct_value () [concrete]
  986. // CHECK:STDOUT: %cpp_operator.type.1ea478.19: type = fn_type @cpp_operator.19 [concrete]
  987. // CHECK:STDOUT: %cpp_operator.0a3797.19: %cpp_operator.type.1ea478.19 = struct_value () [concrete]
  988. // CHECK:STDOUT: %cpp_operator.type.1ea478.20: type = fn_type @cpp_operator.20 [concrete]
  989. // CHECK:STDOUT: %cpp_operator.0a3797.20: %cpp_operator.type.1ea478.20 = struct_value () [concrete]
  990. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete]
  991. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete]
  992. // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete]
  993. // CHECK:STDOUT: %ptr.bb2: type = ptr_type bool [concrete]
  994. // CHECK:STDOUT: %operator==__carbon_thunk.type: type = fn_type @operator==__carbon_thunk [concrete]
  995. // CHECK:STDOUT: %operator==__carbon_thunk: %operator==__carbon_thunk.type = struct_value () [concrete]
  996. // CHECK:STDOUT: %operator!=__carbon_thunk.type: type = fn_type @operator!=__carbon_thunk [concrete]
  997. // CHECK:STDOUT: %operator!=__carbon_thunk: %operator!=__carbon_thunk.type = struct_value () [concrete]
  998. // CHECK:STDOUT: %operator>__carbon_thunk.type: type = fn_type @operator>__carbon_thunk [concrete]
  999. // CHECK:STDOUT: %operator>__carbon_thunk: %operator>__carbon_thunk.type = struct_value () [concrete]
  1000. // CHECK:STDOUT: %operator<__carbon_thunk.type: type = fn_type @operator<__carbon_thunk [concrete]
  1001. // CHECK:STDOUT: %operator<__carbon_thunk: %operator<__carbon_thunk.type = struct_value () [concrete]
  1002. // CHECK:STDOUT: %operator>=__carbon_thunk.type: type = fn_type @operator>=__carbon_thunk [concrete]
  1003. // CHECK:STDOUT: %operator>=__carbon_thunk: %operator>=__carbon_thunk.type = struct_value () [concrete]
  1004. // CHECK:STDOUT: %operator<=__carbon_thunk.type: type = fn_type @operator<=__carbon_thunk [concrete]
  1005. // CHECK:STDOUT: %operator<=__carbon_thunk: %operator<=__carbon_thunk.type = struct_value () [concrete]
  1006. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  1007. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  1008. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  1009. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT:
  1012. // CHECK:STDOUT: imports {
  1013. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1014. // CHECK:STDOUT: .C = %C.decl
  1015. // CHECK:STDOUT: import Cpp//...
  1016. // CHECK:STDOUT: }
  1017. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1018. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  1019. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  1020. // CHECK:STDOUT: <elided>
  1021. // CHECK:STDOUT: } {
  1022. // CHECK:STDOUT: <elided>
  1023. // CHECK:STDOUT: }
  1024. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  1025. // CHECK:STDOUT: <elided>
  1026. // CHECK:STDOUT: } {
  1027. // CHECK:STDOUT: <elided>
  1028. // CHECK:STDOUT: }
  1029. // CHECK:STDOUT: %operator-__carbon_thunk.decl: %operator-__carbon_thunk.type = fn_decl @operator-__carbon_thunk [concrete = constants.%operator-__carbon_thunk] {
  1030. // CHECK:STDOUT: <elided>
  1031. // CHECK:STDOUT: } {
  1032. // CHECK:STDOUT: <elided>
  1033. // CHECK:STDOUT: }
  1034. // CHECK:STDOUT: %operator*__carbon_thunk.decl: %operator*__carbon_thunk.type = fn_decl @operator*__carbon_thunk [concrete = constants.%operator*__carbon_thunk] {
  1035. // CHECK:STDOUT: <elided>
  1036. // CHECK:STDOUT: } {
  1037. // CHECK:STDOUT: <elided>
  1038. // CHECK:STDOUT: }
  1039. // CHECK:STDOUT: %operator/__carbon_thunk.decl: %operator/__carbon_thunk.type = fn_decl @operator/__carbon_thunk [concrete = constants.%operator/__carbon_thunk] {
  1040. // CHECK:STDOUT: <elided>
  1041. // CHECK:STDOUT: } {
  1042. // CHECK:STDOUT: <elided>
  1043. // CHECK:STDOUT: }
  1044. // CHECK:STDOUT: %operator%__carbon_thunk.decl: %operator%__carbon_thunk.type = fn_decl @operator%__carbon_thunk [concrete = constants.%operator%__carbon_thunk] {
  1045. // CHECK:STDOUT: <elided>
  1046. // CHECK:STDOUT: } {
  1047. // CHECK:STDOUT: <elided>
  1048. // CHECK:STDOUT: }
  1049. // CHECK:STDOUT: %operator&__carbon_thunk.decl: %operator&__carbon_thunk.type = fn_decl @operator&__carbon_thunk [concrete = constants.%operator&__carbon_thunk] {
  1050. // CHECK:STDOUT: <elided>
  1051. // CHECK:STDOUT: } {
  1052. // CHECK:STDOUT: <elided>
  1053. // CHECK:STDOUT: }
  1054. // CHECK:STDOUT: %operator|__carbon_thunk.decl: %operator|__carbon_thunk.type = fn_decl @operator|__carbon_thunk [concrete = constants.%operator|__carbon_thunk] {
  1055. // CHECK:STDOUT: <elided>
  1056. // CHECK:STDOUT: } {
  1057. // CHECK:STDOUT: <elided>
  1058. // CHECK:STDOUT: }
  1059. // CHECK:STDOUT: %operator^__carbon_thunk.decl: %operator^__carbon_thunk.type = fn_decl @operator^__carbon_thunk [concrete = constants.%operator^__carbon_thunk] {
  1060. // CHECK:STDOUT: <elided>
  1061. // CHECK:STDOUT: } {
  1062. // CHECK:STDOUT: <elided>
  1063. // CHECK:STDOUT: }
  1064. // CHECK:STDOUT: %operator<<__carbon_thunk.decl: %operator<<__carbon_thunk.type = fn_decl @operator<<__carbon_thunk [concrete = constants.%operator<<__carbon_thunk] {
  1065. // CHECK:STDOUT: <elided>
  1066. // CHECK:STDOUT: } {
  1067. // CHECK:STDOUT: <elided>
  1068. // CHECK:STDOUT: }
  1069. // CHECK:STDOUT: %Core.import_ref.e24: @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert.type (%Core.IntLiteral.as.ImplicitAs.impl.Convert.type.f51) = import_ref Core//prelude/types/int, loc{{\d+_\d+}}, loaded [symbolic = @Core.IntLiteral.as.ImplicitAs.impl.%Core.IntLiteral.as.ImplicitAs.impl.Convert (constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.2a1)]
  1070. // CHECK:STDOUT: %ImplicitAs.impl_witness_table.132 = impl_witness_table (%Core.import_ref.e24), @Core.IntLiteral.as.ImplicitAs.impl [concrete]
  1071. // CHECK:STDOUT: %operator>>__carbon_thunk.decl: %operator>>__carbon_thunk.type = fn_decl @operator>>__carbon_thunk [concrete = constants.%operator>>__carbon_thunk] {
  1072. // CHECK:STDOUT: <elided>
  1073. // CHECK:STDOUT: } {
  1074. // CHECK:STDOUT: <elided>
  1075. // CHECK:STDOUT: }
  1076. // CHECK:STDOUT: %operator+=__carbon_thunk.decl: %operator+=__carbon_thunk.type = fn_decl @operator+=__carbon_thunk [concrete = constants.%operator+=__carbon_thunk] {
  1077. // CHECK:STDOUT: <elided>
  1078. // CHECK:STDOUT: } {
  1079. // CHECK:STDOUT: <elided>
  1080. // CHECK:STDOUT: }
  1081. // CHECK:STDOUT: %operator-=__carbon_thunk.decl: %operator-=__carbon_thunk.type = fn_decl @operator-=__carbon_thunk [concrete = constants.%operator-=__carbon_thunk] {
  1082. // CHECK:STDOUT: <elided>
  1083. // CHECK:STDOUT: } {
  1084. // CHECK:STDOUT: <elided>
  1085. // CHECK:STDOUT: }
  1086. // CHECK:STDOUT: %operator*=__carbon_thunk.decl: %operator*=__carbon_thunk.type = fn_decl @operator*=__carbon_thunk [concrete = constants.%operator*=__carbon_thunk] {
  1087. // CHECK:STDOUT: <elided>
  1088. // CHECK:STDOUT: } {
  1089. // CHECK:STDOUT: <elided>
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT: %operator/=__carbon_thunk.decl: %operator/=__carbon_thunk.type = fn_decl @operator/=__carbon_thunk [concrete = constants.%operator/=__carbon_thunk] {
  1092. // CHECK:STDOUT: <elided>
  1093. // CHECK:STDOUT: } {
  1094. // CHECK:STDOUT: <elided>
  1095. // CHECK:STDOUT: }
  1096. // CHECK:STDOUT: %operator%=__carbon_thunk.decl: %operator%=__carbon_thunk.type = fn_decl @operator%=__carbon_thunk [concrete = constants.%operator%=__carbon_thunk] {
  1097. // CHECK:STDOUT: <elided>
  1098. // CHECK:STDOUT: } {
  1099. // CHECK:STDOUT: <elided>
  1100. // CHECK:STDOUT: }
  1101. // CHECK:STDOUT: %operator&=__carbon_thunk.decl: %operator&=__carbon_thunk.type = fn_decl @operator&=__carbon_thunk [concrete = constants.%operator&=__carbon_thunk] {
  1102. // CHECK:STDOUT: <elided>
  1103. // CHECK:STDOUT: } {
  1104. // CHECK:STDOUT: <elided>
  1105. // CHECK:STDOUT: }
  1106. // CHECK:STDOUT: %operator|=__carbon_thunk.decl: %operator|=__carbon_thunk.type = fn_decl @operator|=__carbon_thunk [concrete = constants.%operator|=__carbon_thunk] {
  1107. // CHECK:STDOUT: <elided>
  1108. // CHECK:STDOUT: } {
  1109. // CHECK:STDOUT: <elided>
  1110. // CHECK:STDOUT: }
  1111. // CHECK:STDOUT: %operator^=__carbon_thunk.decl: %operator^=__carbon_thunk.type = fn_decl @operator^=__carbon_thunk [concrete = constants.%operator^=__carbon_thunk] {
  1112. // CHECK:STDOUT: <elided>
  1113. // CHECK:STDOUT: } {
  1114. // CHECK:STDOUT: <elided>
  1115. // CHECK:STDOUT: }
  1116. // CHECK:STDOUT: %cpp_operator.decl.4206c9.19: %cpp_operator.type.1ea478.19 = fn_decl @cpp_operator.19 [concrete = constants.%cpp_operator.0a3797.19] {
  1117. // CHECK:STDOUT: <elided>
  1118. // CHECK:STDOUT: } {
  1119. // CHECK:STDOUT: <elided>
  1120. // CHECK:STDOUT: }
  1121. // CHECK:STDOUT: %cpp_operator.decl.4206c9.20: %cpp_operator.type.1ea478.20 = fn_decl @cpp_operator.20 [concrete = constants.%cpp_operator.0a3797.20] {
  1122. // CHECK:STDOUT: <elided>
  1123. // CHECK:STDOUT: } {
  1124. // CHECK:STDOUT: <elided>
  1125. // CHECK:STDOUT: }
  1126. // CHECK:STDOUT: %operator==__carbon_thunk.decl: %operator==__carbon_thunk.type = fn_decl @operator==__carbon_thunk [concrete = constants.%operator==__carbon_thunk] {
  1127. // CHECK:STDOUT: <elided>
  1128. // CHECK:STDOUT: } {
  1129. // CHECK:STDOUT: <elided>
  1130. // CHECK:STDOUT: }
  1131. // CHECK:STDOUT: %operator!=__carbon_thunk.decl: %operator!=__carbon_thunk.type = fn_decl @operator!=__carbon_thunk [concrete = constants.%operator!=__carbon_thunk] {
  1132. // CHECK:STDOUT: <elided>
  1133. // CHECK:STDOUT: } {
  1134. // CHECK:STDOUT: <elided>
  1135. // CHECK:STDOUT: }
  1136. // CHECK:STDOUT: %operator>__carbon_thunk.decl: %operator>__carbon_thunk.type = fn_decl @operator>__carbon_thunk [concrete = constants.%operator>__carbon_thunk] {
  1137. // CHECK:STDOUT: <elided>
  1138. // CHECK:STDOUT: } {
  1139. // CHECK:STDOUT: <elided>
  1140. // CHECK:STDOUT: }
  1141. // CHECK:STDOUT: %operator<__carbon_thunk.decl: %operator<__carbon_thunk.type = fn_decl @operator<__carbon_thunk [concrete = constants.%operator<__carbon_thunk] {
  1142. // CHECK:STDOUT: <elided>
  1143. // CHECK:STDOUT: } {
  1144. // CHECK:STDOUT: <elided>
  1145. // CHECK:STDOUT: }
  1146. // CHECK:STDOUT: %operator>=__carbon_thunk.decl: %operator>=__carbon_thunk.type = fn_decl @operator>=__carbon_thunk [concrete = constants.%operator>=__carbon_thunk] {
  1147. // CHECK:STDOUT: <elided>
  1148. // CHECK:STDOUT: } {
  1149. // CHECK:STDOUT: <elided>
  1150. // CHECK:STDOUT: }
  1151. // CHECK:STDOUT: %operator<=__carbon_thunk.decl: %operator<=__carbon_thunk.type = fn_decl @operator<=__carbon_thunk [concrete = constants.%operator<=__carbon_thunk] {
  1152. // CHECK:STDOUT: <elided>
  1153. // CHECK:STDOUT: } {
  1154. // CHECK:STDOUT: <elided>
  1155. // CHECK:STDOUT: }
  1156. // CHECK:STDOUT: }
  1157. // CHECK:STDOUT:
  1158. // CHECK:STDOUT: fn @F() {
  1159. // CHECK:STDOUT: !entry:
  1160. // CHECK:STDOUT: name_binding_decl {
  1161. // CHECK:STDOUT: %c1.patt: %pattern_type.217 = ref_binding_pattern c1 [concrete]
  1162. // CHECK:STDOUT: %c1.var_patt: %pattern_type.217 = var_pattern %c1.patt [concrete]
  1163. // CHECK:STDOUT: }
  1164. // CHECK:STDOUT: %c1.var: ref %C = var %c1.var_patt
  1165. // CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1166. // CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1167. // CHECK:STDOUT: %C.ref.loc8_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1168. // CHECK:STDOUT: %.loc8_3: ref %C = splice_block %c1.var {}
  1169. // CHECK:STDOUT: %addr.loc8: %ptr.d9e = addr_of %.loc8_3
  1170. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  1171. // CHECK:STDOUT: %.loc8_27: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_3
  1172. // CHECK:STDOUT: assign %c1.var, %.loc8_27
  1173. // CHECK:STDOUT: %.loc8_14: type = splice_block %C.ref.loc8_14 [concrete = constants.%C] {
  1174. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1175. // CHECK:STDOUT: %C.ref.loc8_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1176. // CHECK:STDOUT: }
  1177. // CHECK:STDOUT: %c1: ref %C = ref_binding c1, %c1.var
  1178. // CHECK:STDOUT: name_binding_decl {
  1179. // CHECK:STDOUT: %c2.patt: %pattern_type.217 = ref_binding_pattern c2 [concrete]
  1180. // CHECK:STDOUT: %c2.var_patt: %pattern_type.217 = var_pattern %c2.patt [concrete]
  1181. // CHECK:STDOUT: }
  1182. // CHECK:STDOUT: %c2.var: ref %C = var %c2.var_patt
  1183. // CHECK:STDOUT: %Cpp.ref.loc9_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1184. // CHECK:STDOUT: %C.ref.loc9_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1185. // CHECK:STDOUT: %C.ref.loc9_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1186. // CHECK:STDOUT: %.loc9_3: ref %C = splice_block %c2.var {}
  1187. // CHECK:STDOUT: %addr.loc9: %ptr.d9e = addr_of %.loc9_3
  1188. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  1189. // CHECK:STDOUT: %.loc9_27: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_3
  1190. // CHECK:STDOUT: assign %c2.var, %.loc9_27
  1191. // CHECK:STDOUT: %.loc9_14: type = splice_block %C.ref.loc9_14 [concrete = constants.%C] {
  1192. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1193. // CHECK:STDOUT: %C.ref.loc9_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1194. // CHECK:STDOUT: }
  1195. // CHECK:STDOUT: %c2: ref %C = ref_binding c2, %c2.var
  1196. // CHECK:STDOUT: name_binding_decl {
  1197. // CHECK:STDOUT: %addition.patt: %pattern_type.217 = value_binding_pattern addition [concrete]
  1198. // CHECK:STDOUT: }
  1199. // CHECK:STDOUT: %c1.ref.loc12: ref %C = name_ref c1, %c1
  1200. // CHECK:STDOUT: %c2.ref.loc12: ref %C = name_ref c2, %c2
  1201. // CHECK:STDOUT: %.loc12_28.1: ref %C = temporary_storage
  1202. // CHECK:STDOUT: %.loc12_25.1: %C = acquire_value %c1.ref.loc12
  1203. // CHECK:STDOUT: %.loc12_30.1: %C = acquire_value %c2.ref.loc12
  1204. // CHECK:STDOUT: %.loc12_25.2: ref %C = value_as_ref %.loc12_25.1
  1205. // CHECK:STDOUT: %addr.loc12_28.1: %ptr.d9e = addr_of %.loc12_25.2
  1206. // CHECK:STDOUT: %.loc12_30.2: ref %C = value_as_ref %.loc12_30.1
  1207. // CHECK:STDOUT: %addr.loc12_28.2: %ptr.d9e = addr_of %.loc12_30.2
  1208. // CHECK:STDOUT: %addr.loc12_28.3: %ptr.d9e = addr_of %.loc12_28.1
  1209. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc12_28.1, %addr.loc12_28.2, %addr.loc12_28.3)
  1210. // CHECK:STDOUT: %.loc12_28.2: init %C = in_place_init %operator+__carbon_thunk.call, %.loc12_28.1
  1211. // CHECK:STDOUT: %.loc12_20: type = splice_block %C.ref.loc12 [concrete = constants.%C] {
  1212. // CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1213. // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1214. // CHECK:STDOUT: }
  1215. // CHECK:STDOUT: %.loc12_28.3: ref %C = temporary %.loc12_28.1, %.loc12_28.2
  1216. // CHECK:STDOUT: %.loc12_28.4: %C = acquire_value %.loc12_28.3
  1217. // CHECK:STDOUT: %addition: %C = value_binding addition, %.loc12_28.4
  1218. // CHECK:STDOUT: name_binding_decl {
  1219. // CHECK:STDOUT: %subtraction.patt: %pattern_type.217 = value_binding_pattern subtraction [concrete]
  1220. // CHECK:STDOUT: }
  1221. // CHECK:STDOUT: %c1.ref.loc13: ref %C = name_ref c1, %c1
  1222. // CHECK:STDOUT: %c2.ref.loc13: ref %C = name_ref c2, %c2
  1223. // CHECK:STDOUT: %.loc13_31.1: ref %C = temporary_storage
  1224. // CHECK:STDOUT: %.loc13_28.1: %C = acquire_value %c1.ref.loc13
  1225. // CHECK:STDOUT: %.loc13_33.1: %C = acquire_value %c2.ref.loc13
  1226. // CHECK:STDOUT: %.loc13_28.2: ref %C = value_as_ref %.loc13_28.1
  1227. // CHECK:STDOUT: %addr.loc13_31.1: %ptr.d9e = addr_of %.loc13_28.2
  1228. // CHECK:STDOUT: %.loc13_33.2: ref %C = value_as_ref %.loc13_33.1
  1229. // CHECK:STDOUT: %addr.loc13_31.2: %ptr.d9e = addr_of %.loc13_33.2
  1230. // CHECK:STDOUT: %addr.loc13_31.3: %ptr.d9e = addr_of %.loc13_31.1
  1231. // CHECK:STDOUT: %operator-__carbon_thunk.call: init %empty_tuple.type = call imports.%operator-__carbon_thunk.decl(%addr.loc13_31.1, %addr.loc13_31.2, %addr.loc13_31.3)
  1232. // CHECK:STDOUT: %.loc13_31.2: init %C = in_place_init %operator-__carbon_thunk.call, %.loc13_31.1
  1233. // CHECK:STDOUT: %.loc13_23: type = splice_block %C.ref.loc13 [concrete = constants.%C] {
  1234. // CHECK:STDOUT: %Cpp.ref.loc13: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1235. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1236. // CHECK:STDOUT: }
  1237. // CHECK:STDOUT: %.loc13_31.3: ref %C = temporary %.loc13_31.1, %.loc13_31.2
  1238. // CHECK:STDOUT: %.loc13_31.4: %C = acquire_value %.loc13_31.3
  1239. // CHECK:STDOUT: %subtraction: %C = value_binding subtraction, %.loc13_31.4
  1240. // CHECK:STDOUT: name_binding_decl {
  1241. // CHECK:STDOUT: %multiplication.patt: %pattern_type.217 = value_binding_pattern multiplication [concrete]
  1242. // CHECK:STDOUT: }
  1243. // CHECK:STDOUT: %c1.ref.loc14: ref %C = name_ref c1, %c1
  1244. // CHECK:STDOUT: %c2.ref.loc14: ref %C = name_ref c2, %c2
  1245. // CHECK:STDOUT: %.loc14_34.1: ref %C = temporary_storage
  1246. // CHECK:STDOUT: %.loc14_31.1: %C = acquire_value %c1.ref.loc14
  1247. // CHECK:STDOUT: %.loc14_36.1: %C = acquire_value %c2.ref.loc14
  1248. // CHECK:STDOUT: %.loc14_31.2: ref %C = value_as_ref %.loc14_31.1
  1249. // CHECK:STDOUT: %addr.loc14_34.1: %ptr.d9e = addr_of %.loc14_31.2
  1250. // CHECK:STDOUT: %.loc14_36.2: ref %C = value_as_ref %.loc14_36.1
  1251. // CHECK:STDOUT: %addr.loc14_34.2: %ptr.d9e = addr_of %.loc14_36.2
  1252. // CHECK:STDOUT: %addr.loc14_34.3: %ptr.d9e = addr_of %.loc14_34.1
  1253. // CHECK:STDOUT: %operator*__carbon_thunk.call: init %empty_tuple.type = call imports.%operator*__carbon_thunk.decl(%addr.loc14_34.1, %addr.loc14_34.2, %addr.loc14_34.3)
  1254. // CHECK:STDOUT: %.loc14_34.2: init %C = in_place_init %operator*__carbon_thunk.call, %.loc14_34.1
  1255. // CHECK:STDOUT: %.loc14_26: type = splice_block %C.ref.loc14 [concrete = constants.%C] {
  1256. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1257. // CHECK:STDOUT: %C.ref.loc14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1258. // CHECK:STDOUT: }
  1259. // CHECK:STDOUT: %.loc14_34.3: ref %C = temporary %.loc14_34.1, %.loc14_34.2
  1260. // CHECK:STDOUT: %.loc14_34.4: %C = acquire_value %.loc14_34.3
  1261. // CHECK:STDOUT: %multiplication: %C = value_binding multiplication, %.loc14_34.4
  1262. // CHECK:STDOUT: name_binding_decl {
  1263. // CHECK:STDOUT: %division.patt: %pattern_type.217 = value_binding_pattern division [concrete]
  1264. // CHECK:STDOUT: }
  1265. // CHECK:STDOUT: %c1.ref.loc15: ref %C = name_ref c1, %c1
  1266. // CHECK:STDOUT: %c2.ref.loc15: ref %C = name_ref c2, %c2
  1267. // CHECK:STDOUT: %.loc15_28.1: ref %C = temporary_storage
  1268. // CHECK:STDOUT: %.loc15_25.1: %C = acquire_value %c1.ref.loc15
  1269. // CHECK:STDOUT: %.loc15_30.1: %C = acquire_value %c2.ref.loc15
  1270. // CHECK:STDOUT: %.loc15_25.2: ref %C = value_as_ref %.loc15_25.1
  1271. // CHECK:STDOUT: %addr.loc15_28.1: %ptr.d9e = addr_of %.loc15_25.2
  1272. // CHECK:STDOUT: %.loc15_30.2: ref %C = value_as_ref %.loc15_30.1
  1273. // CHECK:STDOUT: %addr.loc15_28.2: %ptr.d9e = addr_of %.loc15_30.2
  1274. // CHECK:STDOUT: %addr.loc15_28.3: %ptr.d9e = addr_of %.loc15_28.1
  1275. // CHECK:STDOUT: %operator/__carbon_thunk.call: init %empty_tuple.type = call imports.%operator/__carbon_thunk.decl(%addr.loc15_28.1, %addr.loc15_28.2, %addr.loc15_28.3)
  1276. // CHECK:STDOUT: %.loc15_28.2: init %C = in_place_init %operator/__carbon_thunk.call, %.loc15_28.1
  1277. // CHECK:STDOUT: %.loc15_20: type = splice_block %C.ref.loc15 [concrete = constants.%C] {
  1278. // CHECK:STDOUT: %Cpp.ref.loc15: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1279. // CHECK:STDOUT: %C.ref.loc15: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1280. // CHECK:STDOUT: }
  1281. // CHECK:STDOUT: %.loc15_28.3: ref %C = temporary %.loc15_28.1, %.loc15_28.2
  1282. // CHECK:STDOUT: %.loc15_28.4: %C = acquire_value %.loc15_28.3
  1283. // CHECK:STDOUT: %division: %C = value_binding division, %.loc15_28.4
  1284. // CHECK:STDOUT: name_binding_decl {
  1285. // CHECK:STDOUT: %modulo.patt: %pattern_type.217 = value_binding_pattern modulo [concrete]
  1286. // CHECK:STDOUT: }
  1287. // CHECK:STDOUT: %c1.ref.loc16: ref %C = name_ref c1, %c1
  1288. // CHECK:STDOUT: %c2.ref.loc16: ref %C = name_ref c2, %c2
  1289. // CHECK:STDOUT: %.loc16_26.1: ref %C = temporary_storage
  1290. // CHECK:STDOUT: %.loc16_23.1: %C = acquire_value %c1.ref.loc16
  1291. // CHECK:STDOUT: %.loc16_28.1: %C = acquire_value %c2.ref.loc16
  1292. // CHECK:STDOUT: %.loc16_23.2: ref %C = value_as_ref %.loc16_23.1
  1293. // CHECK:STDOUT: %addr.loc16_26.1: %ptr.d9e = addr_of %.loc16_23.2
  1294. // CHECK:STDOUT: %.loc16_28.2: ref %C = value_as_ref %.loc16_28.1
  1295. // CHECK:STDOUT: %addr.loc16_26.2: %ptr.d9e = addr_of %.loc16_28.2
  1296. // CHECK:STDOUT: %addr.loc16_26.3: %ptr.d9e = addr_of %.loc16_26.1
  1297. // CHECK:STDOUT: %operator%__carbon_thunk.call: init %empty_tuple.type = call imports.%operator%__carbon_thunk.decl(%addr.loc16_26.1, %addr.loc16_26.2, %addr.loc16_26.3)
  1298. // CHECK:STDOUT: %.loc16_26.2: init %C = in_place_init %operator%__carbon_thunk.call, %.loc16_26.1
  1299. // CHECK:STDOUT: %.loc16_18: type = splice_block %C.ref.loc16 [concrete = constants.%C] {
  1300. // CHECK:STDOUT: %Cpp.ref.loc16: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1301. // CHECK:STDOUT: %C.ref.loc16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1302. // CHECK:STDOUT: }
  1303. // CHECK:STDOUT: %.loc16_26.3: ref %C = temporary %.loc16_26.1, %.loc16_26.2
  1304. // CHECK:STDOUT: %.loc16_26.4: %C = acquire_value %.loc16_26.3
  1305. // CHECK:STDOUT: %modulo: %C = value_binding modulo, %.loc16_26.4
  1306. // CHECK:STDOUT: name_binding_decl {
  1307. // CHECK:STDOUT: %bitwise_and.patt: %pattern_type.217 = value_binding_pattern bitwise_and [concrete]
  1308. // CHECK:STDOUT: }
  1309. // CHECK:STDOUT: %c1.ref.loc19: ref %C = name_ref c1, %c1
  1310. // CHECK:STDOUT: %c2.ref.loc19: ref %C = name_ref c2, %c2
  1311. // CHECK:STDOUT: %.loc19_31.1: ref %C = temporary_storage
  1312. // CHECK:STDOUT: %.loc19_28.1: %C = acquire_value %c1.ref.loc19
  1313. // CHECK:STDOUT: %.loc19_33.1: %C = acquire_value %c2.ref.loc19
  1314. // CHECK:STDOUT: %.loc19_28.2: ref %C = value_as_ref %.loc19_28.1
  1315. // CHECK:STDOUT: %addr.loc19_31.1: %ptr.d9e = addr_of %.loc19_28.2
  1316. // CHECK:STDOUT: %.loc19_33.2: ref %C = value_as_ref %.loc19_33.1
  1317. // CHECK:STDOUT: %addr.loc19_31.2: %ptr.d9e = addr_of %.loc19_33.2
  1318. // CHECK:STDOUT: %addr.loc19_31.3: %ptr.d9e = addr_of %.loc19_31.1
  1319. // CHECK:STDOUT: %operator&__carbon_thunk.call: init %empty_tuple.type = call imports.%operator&__carbon_thunk.decl(%addr.loc19_31.1, %addr.loc19_31.2, %addr.loc19_31.3)
  1320. // CHECK:STDOUT: %.loc19_31.2: init %C = in_place_init %operator&__carbon_thunk.call, %.loc19_31.1
  1321. // CHECK:STDOUT: %.loc19_23: type = splice_block %C.ref.loc19 [concrete = constants.%C] {
  1322. // CHECK:STDOUT: %Cpp.ref.loc19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1323. // CHECK:STDOUT: %C.ref.loc19: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1324. // CHECK:STDOUT: }
  1325. // CHECK:STDOUT: %.loc19_31.3: ref %C = temporary %.loc19_31.1, %.loc19_31.2
  1326. // CHECK:STDOUT: %.loc19_31.4: %C = acquire_value %.loc19_31.3
  1327. // CHECK:STDOUT: %bitwise_and: %C = value_binding bitwise_and, %.loc19_31.4
  1328. // CHECK:STDOUT: name_binding_decl {
  1329. // CHECK:STDOUT: %bitwise_or.patt: %pattern_type.217 = value_binding_pattern bitwise_or [concrete]
  1330. // CHECK:STDOUT: }
  1331. // CHECK:STDOUT: %c1.ref.loc20: ref %C = name_ref c1, %c1
  1332. // CHECK:STDOUT: %c2.ref.loc20: ref %C = name_ref c2, %c2
  1333. // CHECK:STDOUT: %.loc20_30.1: ref %C = temporary_storage
  1334. // CHECK:STDOUT: %.loc20_27.1: %C = acquire_value %c1.ref.loc20
  1335. // CHECK:STDOUT: %.loc20_32.1: %C = acquire_value %c2.ref.loc20
  1336. // CHECK:STDOUT: %.loc20_27.2: ref %C = value_as_ref %.loc20_27.1
  1337. // CHECK:STDOUT: %addr.loc20_30.1: %ptr.d9e = addr_of %.loc20_27.2
  1338. // CHECK:STDOUT: %.loc20_32.2: ref %C = value_as_ref %.loc20_32.1
  1339. // CHECK:STDOUT: %addr.loc20_30.2: %ptr.d9e = addr_of %.loc20_32.2
  1340. // CHECK:STDOUT: %addr.loc20_30.3: %ptr.d9e = addr_of %.loc20_30.1
  1341. // CHECK:STDOUT: %operator|__carbon_thunk.call: init %empty_tuple.type = call imports.%operator|__carbon_thunk.decl(%addr.loc20_30.1, %addr.loc20_30.2, %addr.loc20_30.3)
  1342. // CHECK:STDOUT: %.loc20_30.2: init %C = in_place_init %operator|__carbon_thunk.call, %.loc20_30.1
  1343. // CHECK:STDOUT: %.loc20_22: type = splice_block %C.ref.loc20 [concrete = constants.%C] {
  1344. // CHECK:STDOUT: %Cpp.ref.loc20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1345. // CHECK:STDOUT: %C.ref.loc20: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1346. // CHECK:STDOUT: }
  1347. // CHECK:STDOUT: %.loc20_30.3: ref %C = temporary %.loc20_30.1, %.loc20_30.2
  1348. // CHECK:STDOUT: %.loc20_30.4: %C = acquire_value %.loc20_30.3
  1349. // CHECK:STDOUT: %bitwise_or: %C = value_binding bitwise_or, %.loc20_30.4
  1350. // CHECK:STDOUT: name_binding_decl {
  1351. // CHECK:STDOUT: %bitwise_xor.patt: %pattern_type.217 = value_binding_pattern bitwise_xor [concrete]
  1352. // CHECK:STDOUT: }
  1353. // CHECK:STDOUT: %c1.ref.loc21: ref %C = name_ref c1, %c1
  1354. // CHECK:STDOUT: %c2.ref.loc21: ref %C = name_ref c2, %c2
  1355. // CHECK:STDOUT: %.loc21_31.1: ref %C = temporary_storage
  1356. // CHECK:STDOUT: %.loc21_28.1: %C = acquire_value %c1.ref.loc21
  1357. // CHECK:STDOUT: %.loc21_33.1: %C = acquire_value %c2.ref.loc21
  1358. // CHECK:STDOUT: %.loc21_28.2: ref %C = value_as_ref %.loc21_28.1
  1359. // CHECK:STDOUT: %addr.loc21_31.1: %ptr.d9e = addr_of %.loc21_28.2
  1360. // CHECK:STDOUT: %.loc21_33.2: ref %C = value_as_ref %.loc21_33.1
  1361. // CHECK:STDOUT: %addr.loc21_31.2: %ptr.d9e = addr_of %.loc21_33.2
  1362. // CHECK:STDOUT: %addr.loc21_31.3: %ptr.d9e = addr_of %.loc21_31.1
  1363. // CHECK:STDOUT: %operator^__carbon_thunk.call: init %empty_tuple.type = call imports.%operator^__carbon_thunk.decl(%addr.loc21_31.1, %addr.loc21_31.2, %addr.loc21_31.3)
  1364. // CHECK:STDOUT: %.loc21_31.2: init %C = in_place_init %operator^__carbon_thunk.call, %.loc21_31.1
  1365. // CHECK:STDOUT: %.loc21_23: type = splice_block %C.ref.loc21 [concrete = constants.%C] {
  1366. // CHECK:STDOUT: %Cpp.ref.loc21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1367. // CHECK:STDOUT: %C.ref.loc21: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1368. // CHECK:STDOUT: }
  1369. // CHECK:STDOUT: %.loc21_31.3: ref %C = temporary %.loc21_31.1, %.loc21_31.2
  1370. // CHECK:STDOUT: %.loc21_31.4: %C = acquire_value %.loc21_31.3
  1371. // CHECK:STDOUT: %bitwise_xor: %C = value_binding bitwise_xor, %.loc21_31.4
  1372. // CHECK:STDOUT: name_binding_decl {
  1373. // CHECK:STDOUT: %left_shift.patt: %pattern_type.217 = value_binding_pattern left_shift [concrete]
  1374. // CHECK:STDOUT: }
  1375. // CHECK:STDOUT: %c1.ref.loc22: ref %C = name_ref c1, %c1
  1376. // CHECK:STDOUT: %int_3.loc22: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  1377. // CHECK:STDOUT: %.loc22_30.1: ref %C = temporary_storage
  1378. // CHECK:STDOUT: %.loc22_27.1: %C = acquire_value %c1.ref.loc22
  1379. // CHECK:STDOUT: %impl.elem0.loc22: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  1380. // CHECK:STDOUT: %bound_method.loc22_33.1: <bound method> = bound_method %int_3.loc22, %impl.elem0.loc22 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.87d]
  1381. // CHECK:STDOUT: %specific_fn.loc22: <specific function> = specific_function %impl.elem0.loc22, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1382. // CHECK:STDOUT: %bound_method.loc22_33.2: <bound method> = bound_method %int_3.loc22, %specific_fn.loc22 [concrete = constants.%bound_method.def]
  1383. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22: init %i32 = call %bound_method.loc22_33.2(%int_3.loc22) [concrete = constants.%int_3.822]
  1384. // CHECK:STDOUT: %.loc22_33.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc22 [concrete = constants.%int_3.822]
  1385. // CHECK:STDOUT: %.loc22_33.2: %i32 = converted %int_3.loc22, %.loc22_33.1 [concrete = constants.%int_3.822]
  1386. // CHECK:STDOUT: %.loc22_27.2: ref %C = value_as_ref %.loc22_27.1
  1387. // CHECK:STDOUT: %addr.loc22_30.1: %ptr.d9e = addr_of %.loc22_27.2
  1388. // CHECK:STDOUT: %addr.loc22_30.2: %ptr.d9e = addr_of %.loc22_30.1
  1389. // CHECK:STDOUT: %operator<<__carbon_thunk.call: init %empty_tuple.type = call imports.%operator<<__carbon_thunk.decl(%addr.loc22_30.1, %.loc22_33.2, %addr.loc22_30.2)
  1390. // CHECK:STDOUT: %.loc22_30.2: init %C = in_place_init %operator<<__carbon_thunk.call, %.loc22_30.1
  1391. // CHECK:STDOUT: %.loc22_22: type = splice_block %C.ref.loc22 [concrete = constants.%C] {
  1392. // CHECK:STDOUT: %Cpp.ref.loc22: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1393. // CHECK:STDOUT: %C.ref.loc22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1394. // CHECK:STDOUT: }
  1395. // CHECK:STDOUT: %.loc22_30.3: ref %C = temporary %.loc22_30.1, %.loc22_30.2
  1396. // CHECK:STDOUT: %.loc22_30.4: %C = acquire_value %.loc22_30.3
  1397. // CHECK:STDOUT: %left_shift: %C = value_binding left_shift, %.loc22_30.4
  1398. // CHECK:STDOUT: name_binding_decl {
  1399. // CHECK:STDOUT: %right_shift.patt: %pattern_type.217 = value_binding_pattern right_shift [concrete]
  1400. // CHECK:STDOUT: }
  1401. // CHECK:STDOUT: %c1.ref.loc23: ref %C = name_ref c1, %c1
  1402. // CHECK:STDOUT: %int_5.loc23: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b]
  1403. // CHECK:STDOUT: %.loc23_31.1: ref %C = temporary_storage
  1404. // CHECK:STDOUT: %.loc23_28.1: %C = acquire_value %c1.ref.loc23
  1405. // CHECK:STDOUT: %impl.elem0.loc23: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  1406. // CHECK:STDOUT: %bound_method.loc23_34.1: <bound method> = bound_method %int_5.loc23, %impl.elem0.loc23 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.451]
  1407. // CHECK:STDOUT: %specific_fn.loc23: <specific function> = specific_function %impl.elem0.loc23, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1408. // CHECK:STDOUT: %bound_method.loc23_34.2: <bound method> = bound_method %int_5.loc23, %specific_fn.loc23 [concrete = constants.%bound_method.c57]
  1409. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23: init %i32 = call %bound_method.loc23_34.2(%int_5.loc23) [concrete = constants.%int_5.0f6]
  1410. // CHECK:STDOUT: %.loc23_34.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc23 [concrete = constants.%int_5.0f6]
  1411. // CHECK:STDOUT: %.loc23_34.2: %i32 = converted %int_5.loc23, %.loc23_34.1 [concrete = constants.%int_5.0f6]
  1412. // CHECK:STDOUT: %.loc23_28.2: ref %C = value_as_ref %.loc23_28.1
  1413. // CHECK:STDOUT: %addr.loc23_31.1: %ptr.d9e = addr_of %.loc23_28.2
  1414. // CHECK:STDOUT: %addr.loc23_31.2: %ptr.d9e = addr_of %.loc23_31.1
  1415. // CHECK:STDOUT: %operator>>__carbon_thunk.call: init %empty_tuple.type = call imports.%operator>>__carbon_thunk.decl(%addr.loc23_31.1, %.loc23_34.2, %addr.loc23_31.2)
  1416. // CHECK:STDOUT: %.loc23_31.2: init %C = in_place_init %operator>>__carbon_thunk.call, %.loc23_31.1
  1417. // CHECK:STDOUT: %.loc23_23: type = splice_block %C.ref.loc23 [concrete = constants.%C] {
  1418. // CHECK:STDOUT: %Cpp.ref.loc23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1419. // CHECK:STDOUT: %C.ref.loc23: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1420. // CHECK:STDOUT: }
  1421. // CHECK:STDOUT: %.loc23_31.3: ref %C = temporary %.loc23_31.1, %.loc23_31.2
  1422. // CHECK:STDOUT: %.loc23_31.4: %C = acquire_value %.loc23_31.3
  1423. // CHECK:STDOUT: %right_shift: %C = value_binding right_shift, %.loc23_31.4
  1424. // CHECK:STDOUT: %c1.ref.loc26: ref %C = name_ref c1, %c1
  1425. // CHECK:STDOUT: %c2.ref.loc26: ref %C = name_ref c2, %c2
  1426. // CHECK:STDOUT: %.loc26_9.1: %C = acquire_value %c2.ref.loc26
  1427. // CHECK:STDOUT: %.loc26_9.2: ref %C = value_as_ref %.loc26_9.1
  1428. // CHECK:STDOUT: %addr.loc26: %ptr.d9e = addr_of %.loc26_9.2
  1429. // CHECK:STDOUT: %operator+=__carbon_thunk.call: init %const.7c5 = call imports.%operator+=__carbon_thunk.decl(%c1.ref.loc26, %addr.loc26)
  1430. // CHECK:STDOUT: %c1.ref.loc27: ref %C = name_ref c1, %c1
  1431. // CHECK:STDOUT: %c2.ref.loc27: ref %C = name_ref c2, %c2
  1432. // CHECK:STDOUT: %.loc27_9.1: %C = acquire_value %c2.ref.loc27
  1433. // CHECK:STDOUT: %.loc27_9.2: ref %C = value_as_ref %.loc27_9.1
  1434. // CHECK:STDOUT: %addr.loc27: %ptr.d9e = addr_of %.loc27_9.2
  1435. // CHECK:STDOUT: %operator-=__carbon_thunk.call: init %const.7c5 = call imports.%operator-=__carbon_thunk.decl(%c1.ref.loc27, %addr.loc27)
  1436. // CHECK:STDOUT: %c1.ref.loc28: ref %C = name_ref c1, %c1
  1437. // CHECK:STDOUT: %c2.ref.loc28: ref %C = name_ref c2, %c2
  1438. // CHECK:STDOUT: %.loc28_9.1: %C = acquire_value %c2.ref.loc28
  1439. // CHECK:STDOUT: %.loc28_9.2: ref %C = value_as_ref %.loc28_9.1
  1440. // CHECK:STDOUT: %addr.loc28: %ptr.d9e = addr_of %.loc28_9.2
  1441. // CHECK:STDOUT: %operator*=__carbon_thunk.call: init %const.7c5 = call imports.%operator*=__carbon_thunk.decl(%c1.ref.loc28, %addr.loc28)
  1442. // CHECK:STDOUT: %c1.ref.loc29: ref %C = name_ref c1, %c1
  1443. // CHECK:STDOUT: %c2.ref.loc29: ref %C = name_ref c2, %c2
  1444. // CHECK:STDOUT: %.loc29_9.1: %C = acquire_value %c2.ref.loc29
  1445. // CHECK:STDOUT: %.loc29_9.2: ref %C = value_as_ref %.loc29_9.1
  1446. // CHECK:STDOUT: %addr.loc29: %ptr.d9e = addr_of %.loc29_9.2
  1447. // CHECK:STDOUT: %operator/=__carbon_thunk.call: init %const.7c5 = call imports.%operator/=__carbon_thunk.decl(%c1.ref.loc29, %addr.loc29)
  1448. // CHECK:STDOUT: %c1.ref.loc30: ref %C = name_ref c1, %c1
  1449. // CHECK:STDOUT: %c2.ref.loc30: ref %C = name_ref c2, %c2
  1450. // CHECK:STDOUT: %.loc30_9.1: %C = acquire_value %c2.ref.loc30
  1451. // CHECK:STDOUT: %.loc30_9.2: ref %C = value_as_ref %.loc30_9.1
  1452. // CHECK:STDOUT: %addr.loc30: %ptr.d9e = addr_of %.loc30_9.2
  1453. // CHECK:STDOUT: %operator%=__carbon_thunk.call: init %const.7c5 = call imports.%operator%=__carbon_thunk.decl(%c1.ref.loc30, %addr.loc30)
  1454. // CHECK:STDOUT: %c1.ref.loc33: ref %C = name_ref c1, %c1
  1455. // CHECK:STDOUT: %c2.ref.loc33: ref %C = name_ref c2, %c2
  1456. // CHECK:STDOUT: %.loc33_9.1: %C = acquire_value %c2.ref.loc33
  1457. // CHECK:STDOUT: %.loc33_9.2: ref %C = value_as_ref %.loc33_9.1
  1458. // CHECK:STDOUT: %addr.loc33: %ptr.d9e = addr_of %.loc33_9.2
  1459. // CHECK:STDOUT: %operator&=__carbon_thunk.call: init %const.7c5 = call imports.%operator&=__carbon_thunk.decl(%c1.ref.loc33, %addr.loc33)
  1460. // CHECK:STDOUT: %c1.ref.loc34: ref %C = name_ref c1, %c1
  1461. // CHECK:STDOUT: %c2.ref.loc34: ref %C = name_ref c2, %c2
  1462. // CHECK:STDOUT: %.loc34_9.1: %C = acquire_value %c2.ref.loc34
  1463. // CHECK:STDOUT: %.loc34_9.2: ref %C = value_as_ref %.loc34_9.1
  1464. // CHECK:STDOUT: %addr.loc34: %ptr.d9e = addr_of %.loc34_9.2
  1465. // CHECK:STDOUT: %operator|=__carbon_thunk.call: init %const.7c5 = call imports.%operator|=__carbon_thunk.decl(%c1.ref.loc34, %addr.loc34)
  1466. // CHECK:STDOUT: %c1.ref.loc35: ref %C = name_ref c1, %c1
  1467. // CHECK:STDOUT: %c2.ref.loc35: ref %C = name_ref c2, %c2
  1468. // CHECK:STDOUT: %.loc35_9.1: %C = acquire_value %c2.ref.loc35
  1469. // CHECK:STDOUT: %.loc35_9.2: ref %C = value_as_ref %.loc35_9.1
  1470. // CHECK:STDOUT: %addr.loc35: %ptr.d9e = addr_of %.loc35_9.2
  1471. // CHECK:STDOUT: %operator^=__carbon_thunk.call: init %const.7c5 = call imports.%operator^=__carbon_thunk.decl(%c1.ref.loc35, %addr.loc35)
  1472. // CHECK:STDOUT: %c1.ref.loc36: ref %C = name_ref c1, %c1
  1473. // CHECK:STDOUT: %int_3.loc36: Core.IntLiteral = int_value 3 [concrete = constants.%int_3.1ba]
  1474. // CHECK:STDOUT: %impl.elem0.loc36: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  1475. // CHECK:STDOUT: %bound_method.loc36_10.1: <bound method> = bound_method %int_3.loc36, %impl.elem0.loc36 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.87d]
  1476. // CHECK:STDOUT: %specific_fn.loc36: <specific function> = specific_function %impl.elem0.loc36, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1477. // CHECK:STDOUT: %bound_method.loc36_10.2: <bound method> = bound_method %int_3.loc36, %specific_fn.loc36 [concrete = constants.%bound_method.def]
  1478. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36: init %i32 = call %bound_method.loc36_10.2(%int_3.loc36) [concrete = constants.%int_3.822]
  1479. // CHECK:STDOUT: %.loc36_10.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc36 [concrete = constants.%int_3.822]
  1480. // CHECK:STDOUT: %.loc36_10.2: %i32 = converted %int_3.loc36, %.loc36_10.1 [concrete = constants.%int_3.822]
  1481. // CHECK:STDOUT: %cpp_operator.call.loc36: init %const.7c5 = call imports.%cpp_operator.decl.4206c9.19(%c1.ref.loc36, %.loc36_10.2)
  1482. // CHECK:STDOUT: %c1.ref.loc37: ref %C = name_ref c1, %c1
  1483. // CHECK:STDOUT: %int_5.loc37: Core.IntLiteral = int_value 5 [concrete = constants.%int_5.64b]
  1484. // CHECK:STDOUT: %impl.elem0.loc37: %.322 = impl_witness_access constants.%ImplicitAs.impl_witness.bc9, element0 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.e9b]
  1485. // CHECK:STDOUT: %bound_method.loc37_10.1: <bound method> = bound_method %int_5.loc37, %impl.elem0.loc37 [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.bound.451]
  1486. // CHECK:STDOUT: %specific_fn.loc37: <specific function> = specific_function %impl.elem0.loc37, @Core.IntLiteral.as.ImplicitAs.impl.Convert(constants.%int_32) [concrete = constants.%Core.IntLiteral.as.ImplicitAs.impl.Convert.specific_fn]
  1487. // CHECK:STDOUT: %bound_method.loc37_10.2: <bound method> = bound_method %int_5.loc37, %specific_fn.loc37 [concrete = constants.%bound_method.c57]
  1488. // CHECK:STDOUT: %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37: init %i32 = call %bound_method.loc37_10.2(%int_5.loc37) [concrete = constants.%int_5.0f6]
  1489. // CHECK:STDOUT: %.loc37_10.1: %i32 = value_of_initializer %Core.IntLiteral.as.ImplicitAs.impl.Convert.call.loc37 [concrete = constants.%int_5.0f6]
  1490. // CHECK:STDOUT: %.loc37_10.2: %i32 = converted %int_5.loc37, %.loc37_10.1 [concrete = constants.%int_5.0f6]
  1491. // CHECK:STDOUT: %cpp_operator.call.loc37: init %const.7c5 = call imports.%cpp_operator.decl.4206c9.20(%c1.ref.loc37, %.loc37_10.2)
  1492. // CHECK:STDOUT: name_binding_decl {
  1493. // CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete]
  1494. // CHECK:STDOUT: }
  1495. // CHECK:STDOUT: %c1.ref.loc40: ref %C = name_ref c1, %c1
  1496. // CHECK:STDOUT: %c2.ref.loc40: ref %C = name_ref c2, %c2
  1497. // CHECK:STDOUT: %.loc40_21.1: %C = acquire_value %c1.ref.loc40
  1498. // CHECK:STDOUT: %.loc40_27.1: %C = acquire_value %c2.ref.loc40
  1499. // CHECK:STDOUT: %.loc40_21.2: ref %C = value_as_ref %.loc40_21.1
  1500. // CHECK:STDOUT: %addr.loc40_24.1: %ptr.d9e = addr_of %.loc40_21.2
  1501. // CHECK:STDOUT: %.loc40_27.2: ref %C = value_as_ref %.loc40_27.1
  1502. // CHECK:STDOUT: %addr.loc40_24.2: %ptr.d9e = addr_of %.loc40_27.2
  1503. // CHECK:STDOUT: %.loc40_24.1: ref bool = temporary_storage
  1504. // CHECK:STDOUT: %addr.loc40_24.3: %ptr.bb2 = addr_of %.loc40_24.1
  1505. // CHECK:STDOUT: %operator==__carbon_thunk.call: init %empty_tuple.type = call imports.%operator==__carbon_thunk.decl(%addr.loc40_24.1, %addr.loc40_24.2, %addr.loc40_24.3)
  1506. // CHECK:STDOUT: %.loc40_24.2: init bool = in_place_init %operator==__carbon_thunk.call, %.loc40_24.1
  1507. // CHECK:STDOUT: %.loc40_14.1: type = splice_block %.loc40_14.3 [concrete = bool] {
  1508. // CHECK:STDOUT: %Bool.call.loc40: init type = call constants.%Bool() [concrete = bool]
  1509. // CHECK:STDOUT: %.loc40_14.2: type = value_of_initializer %Bool.call.loc40 [concrete = bool]
  1510. // CHECK:STDOUT: %.loc40_14.3: type = converted %Bool.call.loc40, %.loc40_14.2 [concrete = bool]
  1511. // CHECK:STDOUT: }
  1512. // CHECK:STDOUT: %.loc40_24.3: bool = value_of_initializer %.loc40_24.2
  1513. // CHECK:STDOUT: %.loc40_24.4: bool = converted %.loc40_24.2, %.loc40_24.3
  1514. // CHECK:STDOUT: %equal: bool = value_binding equal, %.loc40_24.4
  1515. // CHECK:STDOUT: name_binding_decl {
  1516. // CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete]
  1517. // CHECK:STDOUT: }
  1518. // CHECK:STDOUT: %c1.ref.loc41: ref %C = name_ref c1, %c1
  1519. // CHECK:STDOUT: %c2.ref.loc41: ref %C = name_ref c2, %c2
  1520. // CHECK:STDOUT: %.loc41_25.1: %C = acquire_value %c1.ref.loc41
  1521. // CHECK:STDOUT: %.loc41_31.1: %C = acquire_value %c2.ref.loc41
  1522. // CHECK:STDOUT: %.loc41_25.2: ref %C = value_as_ref %.loc41_25.1
  1523. // CHECK:STDOUT: %addr.loc41_28.1: %ptr.d9e = addr_of %.loc41_25.2
  1524. // CHECK:STDOUT: %.loc41_31.2: ref %C = value_as_ref %.loc41_31.1
  1525. // CHECK:STDOUT: %addr.loc41_28.2: %ptr.d9e = addr_of %.loc41_31.2
  1526. // CHECK:STDOUT: %.loc41_28.1: ref bool = temporary_storage
  1527. // CHECK:STDOUT: %addr.loc41_28.3: %ptr.bb2 = addr_of %.loc41_28.1
  1528. // CHECK:STDOUT: %operator!=__carbon_thunk.call: init %empty_tuple.type = call imports.%operator!=__carbon_thunk.decl(%addr.loc41_28.1, %addr.loc41_28.2, %addr.loc41_28.3)
  1529. // CHECK:STDOUT: %.loc41_28.2: init bool = in_place_init %operator!=__carbon_thunk.call, %.loc41_28.1
  1530. // CHECK:STDOUT: %.loc41_18.1: type = splice_block %.loc41_18.3 [concrete = bool] {
  1531. // CHECK:STDOUT: %Bool.call.loc41: init type = call constants.%Bool() [concrete = bool]
  1532. // CHECK:STDOUT: %.loc41_18.2: type = value_of_initializer %Bool.call.loc41 [concrete = bool]
  1533. // CHECK:STDOUT: %.loc41_18.3: type = converted %Bool.call.loc41, %.loc41_18.2 [concrete = bool]
  1534. // CHECK:STDOUT: }
  1535. // CHECK:STDOUT: %.loc41_28.3: bool = value_of_initializer %.loc41_28.2
  1536. // CHECK:STDOUT: %.loc41_28.4: bool = converted %.loc41_28.2, %.loc41_28.3
  1537. // CHECK:STDOUT: %not_equal: bool = value_binding not_equal, %.loc41_28.4
  1538. // CHECK:STDOUT: name_binding_decl {
  1539. // CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete]
  1540. // CHECK:STDOUT: }
  1541. // CHECK:STDOUT: %c1.ref.loc42: ref %C = name_ref c1, %c1
  1542. // CHECK:STDOUT: %c2.ref.loc42: ref %C = name_ref c2, %c2
  1543. // CHECK:STDOUT: %.loc42_28.1: %C = acquire_value %c1.ref.loc42
  1544. // CHECK:STDOUT: %.loc42_33.1: %C = acquire_value %c2.ref.loc42
  1545. // CHECK:STDOUT: %.loc42_28.2: ref %C = value_as_ref %.loc42_28.1
  1546. // CHECK:STDOUT: %addr.loc42_31.1: %ptr.d9e = addr_of %.loc42_28.2
  1547. // CHECK:STDOUT: %.loc42_33.2: ref %C = value_as_ref %.loc42_33.1
  1548. // CHECK:STDOUT: %addr.loc42_31.2: %ptr.d9e = addr_of %.loc42_33.2
  1549. // CHECK:STDOUT: %.loc42_31.1: ref bool = temporary_storage
  1550. // CHECK:STDOUT: %addr.loc42_31.3: %ptr.bb2 = addr_of %.loc42_31.1
  1551. // CHECK:STDOUT: %operator>__carbon_thunk.call: init %empty_tuple.type = call imports.%operator>__carbon_thunk.decl(%addr.loc42_31.1, %addr.loc42_31.2, %addr.loc42_31.3)
  1552. // CHECK:STDOUT: %.loc42_31.2: init bool = in_place_init %operator>__carbon_thunk.call, %.loc42_31.1
  1553. // CHECK:STDOUT: %.loc42_21.1: type = splice_block %.loc42_21.3 [concrete = bool] {
  1554. // CHECK:STDOUT: %Bool.call.loc42: init type = call constants.%Bool() [concrete = bool]
  1555. // CHECK:STDOUT: %.loc42_21.2: type = value_of_initializer %Bool.call.loc42 [concrete = bool]
  1556. // CHECK:STDOUT: %.loc42_21.3: type = converted %Bool.call.loc42, %.loc42_21.2 [concrete = bool]
  1557. // CHECK:STDOUT: }
  1558. // CHECK:STDOUT: %.loc42_31.3: bool = value_of_initializer %.loc42_31.2
  1559. // CHECK:STDOUT: %.loc42_31.4: bool = converted %.loc42_31.2, %.loc42_31.3
  1560. // CHECK:STDOUT: %greater_than: bool = value_binding greater_than, %.loc42_31.4
  1561. // CHECK:STDOUT: name_binding_decl {
  1562. // CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete]
  1563. // CHECK:STDOUT: }
  1564. // CHECK:STDOUT: %c1.ref.loc43: ref %C = name_ref c1, %c1
  1565. // CHECK:STDOUT: %c2.ref.loc43: ref %C = name_ref c2, %c2
  1566. // CHECK:STDOUT: %.loc43_25.1: %C = acquire_value %c1.ref.loc43
  1567. // CHECK:STDOUT: %.loc43_30.1: %C = acquire_value %c2.ref.loc43
  1568. // CHECK:STDOUT: %.loc43_25.2: ref %C = value_as_ref %.loc43_25.1
  1569. // CHECK:STDOUT: %addr.loc43_28.1: %ptr.d9e = addr_of %.loc43_25.2
  1570. // CHECK:STDOUT: %.loc43_30.2: ref %C = value_as_ref %.loc43_30.1
  1571. // CHECK:STDOUT: %addr.loc43_28.2: %ptr.d9e = addr_of %.loc43_30.2
  1572. // CHECK:STDOUT: %.loc43_28.1: ref bool = temporary_storage
  1573. // CHECK:STDOUT: %addr.loc43_28.3: %ptr.bb2 = addr_of %.loc43_28.1
  1574. // CHECK:STDOUT: %operator<__carbon_thunk.call: init %empty_tuple.type = call imports.%operator<__carbon_thunk.decl(%addr.loc43_28.1, %addr.loc43_28.2, %addr.loc43_28.3)
  1575. // CHECK:STDOUT: %.loc43_28.2: init bool = in_place_init %operator<__carbon_thunk.call, %.loc43_28.1
  1576. // CHECK:STDOUT: %.loc43_18.1: type = splice_block %.loc43_18.3 [concrete = bool] {
  1577. // CHECK:STDOUT: %Bool.call.loc43: init type = call constants.%Bool() [concrete = bool]
  1578. // CHECK:STDOUT: %.loc43_18.2: type = value_of_initializer %Bool.call.loc43 [concrete = bool]
  1579. // CHECK:STDOUT: %.loc43_18.3: type = converted %Bool.call.loc43, %.loc43_18.2 [concrete = bool]
  1580. // CHECK:STDOUT: }
  1581. // CHECK:STDOUT: %.loc43_28.3: bool = value_of_initializer %.loc43_28.2
  1582. // CHECK:STDOUT: %.loc43_28.4: bool = converted %.loc43_28.2, %.loc43_28.3
  1583. // CHECK:STDOUT: %less_than: bool = value_binding less_than, %.loc43_28.4
  1584. // CHECK:STDOUT: name_binding_decl {
  1585. // CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete]
  1586. // CHECK:STDOUT: }
  1587. // CHECK:STDOUT: %c1.ref.loc44: ref %C = name_ref c1, %c1
  1588. // CHECK:STDOUT: %c2.ref.loc44: ref %C = name_ref c2, %c2
  1589. // CHECK:STDOUT: %.loc44_37.1: %C = acquire_value %c1.ref.loc44
  1590. // CHECK:STDOUT: %.loc44_43.1: %C = acquire_value %c2.ref.loc44
  1591. // CHECK:STDOUT: %.loc44_37.2: ref %C = value_as_ref %.loc44_37.1
  1592. // CHECK:STDOUT: %addr.loc44_40.1: %ptr.d9e = addr_of %.loc44_37.2
  1593. // CHECK:STDOUT: %.loc44_43.2: ref %C = value_as_ref %.loc44_43.1
  1594. // CHECK:STDOUT: %addr.loc44_40.2: %ptr.d9e = addr_of %.loc44_43.2
  1595. // CHECK:STDOUT: %.loc44_40.1: ref bool = temporary_storage
  1596. // CHECK:STDOUT: %addr.loc44_40.3: %ptr.bb2 = addr_of %.loc44_40.1
  1597. // CHECK:STDOUT: %operator>=__carbon_thunk.call: init %empty_tuple.type = call imports.%operator>=__carbon_thunk.decl(%addr.loc44_40.1, %addr.loc44_40.2, %addr.loc44_40.3)
  1598. // CHECK:STDOUT: %.loc44_40.2: init bool = in_place_init %operator>=__carbon_thunk.call, %.loc44_40.1
  1599. // CHECK:STDOUT: %.loc44_30.1: type = splice_block %.loc44_30.3 [concrete = bool] {
  1600. // CHECK:STDOUT: %Bool.call.loc44: init type = call constants.%Bool() [concrete = bool]
  1601. // CHECK:STDOUT: %.loc44_30.2: type = value_of_initializer %Bool.call.loc44 [concrete = bool]
  1602. // CHECK:STDOUT: %.loc44_30.3: type = converted %Bool.call.loc44, %.loc44_30.2 [concrete = bool]
  1603. // CHECK:STDOUT: }
  1604. // CHECK:STDOUT: %.loc44_40.3: bool = value_of_initializer %.loc44_40.2
  1605. // CHECK:STDOUT: %.loc44_40.4: bool = converted %.loc44_40.2, %.loc44_40.3
  1606. // CHECK:STDOUT: %greater_than_or_equal: bool = value_binding greater_than_or_equal, %.loc44_40.4
  1607. // CHECK:STDOUT: name_binding_decl {
  1608. // CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete]
  1609. // CHECK:STDOUT: }
  1610. // CHECK:STDOUT: %c1.ref.loc45: ref %C = name_ref c1, %c1
  1611. // CHECK:STDOUT: %c2.ref.loc45: ref %C = name_ref c2, %c2
  1612. // CHECK:STDOUT: %.loc45_34.1: %C = acquire_value %c1.ref.loc45
  1613. // CHECK:STDOUT: %.loc45_40.1: %C = acquire_value %c2.ref.loc45
  1614. // CHECK:STDOUT: %.loc45_34.2: ref %C = value_as_ref %.loc45_34.1
  1615. // CHECK:STDOUT: %addr.loc45_37.1: %ptr.d9e = addr_of %.loc45_34.2
  1616. // CHECK:STDOUT: %.loc45_40.2: ref %C = value_as_ref %.loc45_40.1
  1617. // CHECK:STDOUT: %addr.loc45_37.2: %ptr.d9e = addr_of %.loc45_40.2
  1618. // CHECK:STDOUT: %.loc45_37.1: ref bool = temporary_storage
  1619. // CHECK:STDOUT: %addr.loc45_37.3: %ptr.bb2 = addr_of %.loc45_37.1
  1620. // CHECK:STDOUT: %operator<=__carbon_thunk.call: init %empty_tuple.type = call imports.%operator<=__carbon_thunk.decl(%addr.loc45_37.1, %addr.loc45_37.2, %addr.loc45_37.3)
  1621. // CHECK:STDOUT: %.loc45_37.2: init bool = in_place_init %operator<=__carbon_thunk.call, %.loc45_37.1
  1622. // CHECK:STDOUT: %.loc45_27.1: type = splice_block %.loc45_27.3 [concrete = bool] {
  1623. // CHECK:STDOUT: %Bool.call.loc45: init type = call constants.%Bool() [concrete = bool]
  1624. // CHECK:STDOUT: %.loc45_27.2: type = value_of_initializer %Bool.call.loc45 [concrete = bool]
  1625. // CHECK:STDOUT: %.loc45_27.3: type = converted %Bool.call.loc45, %.loc45_27.2 [concrete = bool]
  1626. // CHECK:STDOUT: }
  1627. // CHECK:STDOUT: %.loc45_37.3: bool = value_of_initializer %.loc45_37.2
  1628. // CHECK:STDOUT: %.loc45_37.4: bool = converted %.loc45_37.2, %.loc45_37.3
  1629. // CHECK:STDOUT: %less_than_or_equal: bool = value_binding less_than_or_equal, %.loc45_37.4
  1630. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc23: <bound method> = bound_method %.loc23_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1631. // CHECK:STDOUT: <elided>
  1632. // CHECK:STDOUT: %bound_method.loc23_31: <bound method> = bound_method %.loc23_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  1633. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc23: init %empty_tuple.type = call %bound_method.loc23_31(%.loc23_31.3)
  1634. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc22: <bound method> = bound_method %.loc22_30.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1635. // CHECK:STDOUT: <elided>
  1636. // CHECK:STDOUT: %bound_method.loc22_30: <bound method> = bound_method %.loc22_30.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  1637. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc22: init %empty_tuple.type = call %bound_method.loc22_30(%.loc22_30.3)
  1638. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc21: <bound method> = bound_method %.loc21_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1639. // CHECK:STDOUT: <elided>
  1640. // CHECK:STDOUT: %bound_method.loc21: <bound method> = bound_method %.loc21_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  1641. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc21: init %empty_tuple.type = call %bound_method.loc21(%.loc21_31.3)
  1642. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc20: <bound method> = bound_method %.loc20_30.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1643. // CHECK:STDOUT: <elided>
  1644. // CHECK:STDOUT: %bound_method.loc20: <bound method> = bound_method %.loc20_30.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.4
  1645. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc20: init %empty_tuple.type = call %bound_method.loc20(%.loc20_30.3)
  1646. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc19: <bound method> = bound_method %.loc19_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1647. // CHECK:STDOUT: <elided>
  1648. // CHECK:STDOUT: %bound_method.loc19: <bound method> = bound_method %.loc19_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.5
  1649. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc19: init %empty_tuple.type = call %bound_method.loc19(%.loc19_31.3)
  1650. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc16: <bound method> = bound_method %.loc16_26.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1651. // CHECK:STDOUT: <elided>
  1652. // CHECK:STDOUT: %bound_method.loc16: <bound method> = bound_method %.loc16_26.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.6
  1653. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc16: init %empty_tuple.type = call %bound_method.loc16(%.loc16_26.3)
  1654. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc15: <bound method> = bound_method %.loc15_28.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1655. // CHECK:STDOUT: <elided>
  1656. // CHECK:STDOUT: %bound_method.loc15: <bound method> = bound_method %.loc15_28.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.7
  1657. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc15: init %empty_tuple.type = call %bound_method.loc15(%.loc15_28.3)
  1658. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc14: <bound method> = bound_method %.loc14_34.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1659. // CHECK:STDOUT: <elided>
  1660. // CHECK:STDOUT: %bound_method.loc14: <bound method> = bound_method %.loc14_34.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.8
  1661. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc14: init %empty_tuple.type = call %bound_method.loc14(%.loc14_34.3)
  1662. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc13: <bound method> = bound_method %.loc13_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1663. // CHECK:STDOUT: <elided>
  1664. // CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %.loc13_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.9
  1665. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc13: init %empty_tuple.type = call %bound_method.loc13(%.loc13_31.3)
  1666. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %.loc12_28.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1667. // CHECK:STDOUT: <elided>
  1668. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %.loc12_28.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.10
  1669. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%.loc12_28.3)
  1670. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %c2.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1671. // CHECK:STDOUT: <elided>
  1672. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %c2.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.11
  1673. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%c2.var)
  1674. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %c1.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1675. // CHECK:STDOUT: <elided>
  1676. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %c1.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.12
  1677. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%c1.var)
  1678. // CHECK:STDOUT: <elided>
  1679. // CHECK:STDOUT: }
  1680. // CHECK:STDOUT:
  1681. // CHECK:STDOUT: --- multiple_calls.carbon
  1682. // CHECK:STDOUT:
  1683. // CHECK:STDOUT: constants {
  1684. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1685. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  1686. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  1687. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  1688. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  1689. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  1690. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  1691. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  1692. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  1693. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  1694. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  1695. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  1696. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  1697. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  1698. // CHECK:STDOUT: }
  1699. // CHECK:STDOUT:
  1700. // CHECK:STDOUT: imports {
  1701. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1702. // CHECK:STDOUT: .C = %C.decl
  1703. // CHECK:STDOUT: import Cpp//...
  1704. // CHECK:STDOUT: }
  1705. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1706. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  1707. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  1708. // CHECK:STDOUT: <elided>
  1709. // CHECK:STDOUT: } {
  1710. // CHECK:STDOUT: <elided>
  1711. // CHECK:STDOUT: }
  1712. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  1713. // CHECK:STDOUT: <elided>
  1714. // CHECK:STDOUT: } {
  1715. // CHECK:STDOUT: <elided>
  1716. // CHECK:STDOUT: }
  1717. // CHECK:STDOUT: }
  1718. // CHECK:STDOUT:
  1719. // CHECK:STDOUT: fn @F() {
  1720. // CHECK:STDOUT: !entry:
  1721. // CHECK:STDOUT: name_binding_decl {
  1722. // CHECK:STDOUT: %c1.patt: %pattern_type.217 = value_binding_pattern c1 [concrete]
  1723. // CHECK:STDOUT: }
  1724. // CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1725. // CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1726. // CHECK:STDOUT: %C.ref.loc8_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1727. // CHECK:STDOUT: %.loc8_27.1: ref %C = temporary_storage
  1728. // CHECK:STDOUT: %addr.loc8: %ptr.d9e = addr_of %.loc8_27.1
  1729. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  1730. // CHECK:STDOUT: %.loc8_27.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_27.1
  1731. // CHECK:STDOUT: %.loc8_14: type = splice_block %C.ref.loc8_14 [concrete = constants.%C] {
  1732. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1733. // CHECK:STDOUT: %C.ref.loc8_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1734. // CHECK:STDOUT: }
  1735. // CHECK:STDOUT: %.loc8_27.3: ref %C = temporary %.loc8_27.1, %.loc8_27.2
  1736. // CHECK:STDOUT: %.loc8_27.4: %C = acquire_value %.loc8_27.3
  1737. // CHECK:STDOUT: %c1: %C = value_binding c1, %.loc8_27.4
  1738. // CHECK:STDOUT: name_binding_decl {
  1739. // CHECK:STDOUT: %c2.patt: %pattern_type.217 = value_binding_pattern c2 [concrete]
  1740. // CHECK:STDOUT: }
  1741. // CHECK:STDOUT: %Cpp.ref.loc9_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1742. // CHECK:STDOUT: %C.ref.loc9_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1743. // CHECK:STDOUT: %C.ref.loc9_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1744. // CHECK:STDOUT: %.loc9_27.1: ref %C = temporary_storage
  1745. // CHECK:STDOUT: %addr.loc9: %ptr.d9e = addr_of %.loc9_27.1
  1746. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  1747. // CHECK:STDOUT: %.loc9_27.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_27.1
  1748. // CHECK:STDOUT: %.loc9_14: type = splice_block %C.ref.loc9_14 [concrete = constants.%C] {
  1749. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1750. // CHECK:STDOUT: %C.ref.loc9_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1751. // CHECK:STDOUT: }
  1752. // CHECK:STDOUT: %.loc9_27.3: ref %C = temporary %.loc9_27.1, %.loc9_27.2
  1753. // CHECK:STDOUT: %.loc9_27.4: %C = acquire_value %.loc9_27.3
  1754. // CHECK:STDOUT: %c2: %C = value_binding c2, %.loc9_27.4
  1755. // CHECK:STDOUT: name_binding_decl {
  1756. // CHECK:STDOUT: %c3.patt: %pattern_type.217 = value_binding_pattern c3 [concrete]
  1757. // CHECK:STDOUT: }
  1758. // CHECK:STDOUT: %c1.ref.loc10: %C = name_ref c1, %c1
  1759. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  1760. // CHECK:STDOUT: %.loc10_22.1: ref %C = temporary_storage
  1761. // CHECK:STDOUT: %.loc10_19: ref %C = value_as_ref %c1.ref.loc10
  1762. // CHECK:STDOUT: %addr.loc10_22.1: %ptr.d9e = addr_of %.loc10_19
  1763. // CHECK:STDOUT: %.loc10_24: ref %C = value_as_ref %c2.ref
  1764. // CHECK:STDOUT: %addr.loc10_22.2: %ptr.d9e = addr_of %.loc10_24
  1765. // CHECK:STDOUT: %addr.loc10_22.3: %ptr.d9e = addr_of %.loc10_22.1
  1766. // CHECK:STDOUT: %operator+__carbon_thunk.call.loc10: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_22.1, %addr.loc10_22.2, %addr.loc10_22.3)
  1767. // CHECK:STDOUT: %.loc10_22.2: init %C = in_place_init %operator+__carbon_thunk.call.loc10, %.loc10_22.1
  1768. // CHECK:STDOUT: %.loc10_14: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  1769. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1770. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1771. // CHECK:STDOUT: }
  1772. // CHECK:STDOUT: %.loc10_22.3: ref %C = temporary %.loc10_22.1, %.loc10_22.2
  1773. // CHECK:STDOUT: %.loc10_22.4: %C = acquire_value %.loc10_22.3
  1774. // CHECK:STDOUT: %c3: %C = value_binding c3, %.loc10_22.4
  1775. // CHECK:STDOUT: name_binding_decl {
  1776. // CHECK:STDOUT: %c4.patt: %pattern_type.217 = value_binding_pattern c4 [concrete]
  1777. // CHECK:STDOUT: }
  1778. // CHECK:STDOUT: %c1.ref.loc11: %C = name_ref c1, %c1
  1779. // CHECK:STDOUT: %c3.ref.loc11: %C = name_ref c3, %c3
  1780. // CHECK:STDOUT: %.loc11_22.1: ref %C = temporary_storage
  1781. // CHECK:STDOUT: %.loc11_19: ref %C = value_as_ref %c1.ref.loc11
  1782. // CHECK:STDOUT: %addr.loc11_22.1: %ptr.d9e = addr_of %.loc11_19
  1783. // CHECK:STDOUT: %.loc11_24: ref %C = value_as_ref %c3.ref.loc11
  1784. // CHECK:STDOUT: %addr.loc11_22.2: %ptr.d9e = addr_of %.loc11_24
  1785. // CHECK:STDOUT: %addr.loc11_22.3: %ptr.d9e = addr_of %.loc11_22.1
  1786. // CHECK:STDOUT: %operator+__carbon_thunk.call.loc11: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc11_22.1, %addr.loc11_22.2, %addr.loc11_22.3)
  1787. // CHECK:STDOUT: %.loc11_22.2: init %C = in_place_init %operator+__carbon_thunk.call.loc11, %.loc11_22.1
  1788. // CHECK:STDOUT: %.loc11_14: type = splice_block %C.ref.loc11 [concrete = constants.%C] {
  1789. // CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1790. // CHECK:STDOUT: %C.ref.loc11: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1791. // CHECK:STDOUT: }
  1792. // CHECK:STDOUT: %.loc11_22.3: ref %C = temporary %.loc11_22.1, %.loc11_22.2
  1793. // CHECK:STDOUT: %.loc11_22.4: %C = acquire_value %.loc11_22.3
  1794. // CHECK:STDOUT: %c4: %C = value_binding c4, %.loc11_22.4
  1795. // CHECK:STDOUT: name_binding_decl {
  1796. // CHECK:STDOUT: %c5.patt: %pattern_type.217 = value_binding_pattern c5 [concrete]
  1797. // CHECK:STDOUT: }
  1798. // CHECK:STDOUT: %c4.ref: %C = name_ref c4, %c4
  1799. // CHECK:STDOUT: %c3.ref.loc12: %C = name_ref c3, %c3
  1800. // CHECK:STDOUT: %.loc12_22.1: ref %C = temporary_storage
  1801. // CHECK:STDOUT: %.loc12_19: ref %C = value_as_ref %c4.ref
  1802. // CHECK:STDOUT: %addr.loc12_22.1: %ptr.d9e = addr_of %.loc12_19
  1803. // CHECK:STDOUT: %.loc12_24: ref %C = value_as_ref %c3.ref.loc12
  1804. // CHECK:STDOUT: %addr.loc12_22.2: %ptr.d9e = addr_of %.loc12_24
  1805. // CHECK:STDOUT: %addr.loc12_22.3: %ptr.d9e = addr_of %.loc12_22.1
  1806. // CHECK:STDOUT: %operator+__carbon_thunk.call.loc12: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc12_22.1, %addr.loc12_22.2, %addr.loc12_22.3)
  1807. // CHECK:STDOUT: %.loc12_22.2: init %C = in_place_init %operator+__carbon_thunk.call.loc12, %.loc12_22.1
  1808. // CHECK:STDOUT: %.loc12_14: type = splice_block %C.ref.loc12 [concrete = constants.%C] {
  1809. // CHECK:STDOUT: %Cpp.ref.loc12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1810. // CHECK:STDOUT: %C.ref.loc12: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1811. // CHECK:STDOUT: }
  1812. // CHECK:STDOUT: %.loc12_22.3: ref %C = temporary %.loc12_22.1, %.loc12_22.2
  1813. // CHECK:STDOUT: %.loc12_22.4: %C = acquire_value %.loc12_22.3
  1814. // CHECK:STDOUT: %c5: %C = value_binding c5, %.loc12_22.4
  1815. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %.loc12_22.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1816. // CHECK:STDOUT: <elided>
  1817. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %.loc12_22.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  1818. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%.loc12_22.3)
  1819. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc11: <bound method> = bound_method %.loc11_22.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1820. // CHECK:STDOUT: <elided>
  1821. // CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %.loc11_22.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  1822. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc11: init %empty_tuple.type = call %bound_method.loc11(%.loc11_22.3)
  1823. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_22.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1824. // CHECK:STDOUT: <elided>
  1825. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_22.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  1826. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_22.3)
  1827. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_27.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1828. // CHECK:STDOUT: <elided>
  1829. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_27.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.4
  1830. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_27.3)
  1831. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_27.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1832. // CHECK:STDOUT: <elided>
  1833. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_27.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.5
  1834. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_27.3)
  1835. // CHECK:STDOUT: <elided>
  1836. // CHECK:STDOUT: }
  1837. // CHECK:STDOUT:
  1838. // CHECK:STDOUT: --- fail_todo_rewrite_spaceship.carbon
  1839. // CHECK:STDOUT:
  1840. // CHECK:STDOUT: constants {
  1841. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1842. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  1843. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  1844. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  1845. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  1846. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  1847. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  1848. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  1849. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete]
  1850. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete]
  1851. // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete]
  1852. // CHECK:STDOUT: %ptr.bb2: type = ptr_type bool [concrete]
  1853. // CHECK:STDOUT: %operator>__carbon_thunk.type: type = fn_type @operator>__carbon_thunk [concrete]
  1854. // CHECK:STDOUT: %operator>__carbon_thunk: %operator>__carbon_thunk.type = struct_value () [concrete]
  1855. // CHECK:STDOUT: %operator<=__carbon_thunk.type: type = fn_type @operator<=__carbon_thunk [concrete]
  1856. // CHECK:STDOUT: %operator<=__carbon_thunk: %operator<=__carbon_thunk.type = struct_value () [concrete]
  1857. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  1858. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  1859. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  1860. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  1861. // CHECK:STDOUT: }
  1862. // CHECK:STDOUT:
  1863. // CHECK:STDOUT: imports {
  1864. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1865. // CHECK:STDOUT: .C = %C.decl
  1866. // CHECK:STDOUT: import Cpp//...
  1867. // CHECK:STDOUT: }
  1868. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  1869. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  1870. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  1871. // CHECK:STDOUT: <elided>
  1872. // CHECK:STDOUT: } {
  1873. // CHECK:STDOUT: <elided>
  1874. // CHECK:STDOUT: }
  1875. // CHECK:STDOUT: %operator>__carbon_thunk.decl: %operator>__carbon_thunk.type = fn_decl @operator>__carbon_thunk [concrete = constants.%operator>__carbon_thunk] {
  1876. // CHECK:STDOUT: <elided>
  1877. // CHECK:STDOUT: } {
  1878. // CHECK:STDOUT: <elided>
  1879. // CHECK:STDOUT: }
  1880. // CHECK:STDOUT: %operator<=__carbon_thunk.decl: %operator<=__carbon_thunk.type = fn_decl @operator<=__carbon_thunk [concrete = constants.%operator<=__carbon_thunk] {
  1881. // CHECK:STDOUT: <elided>
  1882. // CHECK:STDOUT: } {
  1883. // CHECK:STDOUT: <elided>
  1884. // CHECK:STDOUT: }
  1885. // CHECK:STDOUT: }
  1886. // CHECK:STDOUT:
  1887. // CHECK:STDOUT: fn @F() {
  1888. // CHECK:STDOUT: !entry:
  1889. // CHECK:STDOUT: name_binding_decl {
  1890. // CHECK:STDOUT: %c1.patt: %pattern_type.217 = ref_binding_pattern c1 [concrete]
  1891. // CHECK:STDOUT: %c1.var_patt: %pattern_type.217 = var_pattern %c1.patt [concrete]
  1892. // CHECK:STDOUT: }
  1893. // CHECK:STDOUT: %c1.var: ref %C = var %c1.var_patt
  1894. // CHECK:STDOUT: %Cpp.ref.loc15_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1895. // CHECK:STDOUT: %C.ref.loc15_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1896. // CHECK:STDOUT: %C.ref.loc15_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1897. // CHECK:STDOUT: %.loc15_3: ref %C = splice_block %c1.var {}
  1898. // CHECK:STDOUT: %addr.loc15: %ptr.d9e = addr_of %.loc15_3
  1899. // CHECK:STDOUT: %C__carbon_thunk.call.loc15: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc15)
  1900. // CHECK:STDOUT: %.loc15_27: init %C = in_place_init %C__carbon_thunk.call.loc15, %.loc15_3
  1901. // CHECK:STDOUT: assign %c1.var, %.loc15_27
  1902. // CHECK:STDOUT: %.loc15_14: type = splice_block %C.ref.loc15_14 [concrete = constants.%C] {
  1903. // CHECK:STDOUT: %Cpp.ref.loc15_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1904. // CHECK:STDOUT: %C.ref.loc15_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1905. // CHECK:STDOUT: }
  1906. // CHECK:STDOUT: %c1: ref %C = ref_binding c1, %c1.var
  1907. // CHECK:STDOUT: name_binding_decl {
  1908. // CHECK:STDOUT: %c2.patt: %pattern_type.217 = ref_binding_pattern c2 [concrete]
  1909. // CHECK:STDOUT: %c2.var_patt: %pattern_type.217 = var_pattern %c2.patt [concrete]
  1910. // CHECK:STDOUT: }
  1911. // CHECK:STDOUT: %c2.var: ref %C = var %c2.var_patt
  1912. // CHECK:STDOUT: %Cpp.ref.loc16_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1913. // CHECK:STDOUT: %C.ref.loc16_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1914. // CHECK:STDOUT: %C.ref.loc16_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  1915. // CHECK:STDOUT: %.loc16_3: ref %C = splice_block %c2.var {}
  1916. // CHECK:STDOUT: %addr.loc16: %ptr.d9e = addr_of %.loc16_3
  1917. // CHECK:STDOUT: %C__carbon_thunk.call.loc16: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc16)
  1918. // CHECK:STDOUT: %.loc16_27: init %C = in_place_init %C__carbon_thunk.call.loc16, %.loc16_3
  1919. // CHECK:STDOUT: assign %c2.var, %.loc16_27
  1920. // CHECK:STDOUT: %.loc16_14: type = splice_block %C.ref.loc16_14 [concrete = constants.%C] {
  1921. // CHECK:STDOUT: %Cpp.ref.loc16_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1922. // CHECK:STDOUT: %C.ref.loc16_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  1923. // CHECK:STDOUT: }
  1924. // CHECK:STDOUT: %c2: ref %C = ref_binding c2, %c2.var
  1925. // CHECK:STDOUT: name_binding_decl {
  1926. // CHECK:STDOUT: %greater_than.patt: %pattern_type.831 = value_binding_pattern greater_than [concrete]
  1927. // CHECK:STDOUT: }
  1928. // CHECK:STDOUT: %c1.ref.loc19: ref %C = name_ref c1, %c1
  1929. // CHECK:STDOUT: %c2.ref.loc19: ref %C = name_ref c2, %c2
  1930. // CHECK:STDOUT: %.loc19_28.1: %C = acquire_value %c1.ref.loc19
  1931. // CHECK:STDOUT: %.loc19_33.1: %C = acquire_value %c2.ref.loc19
  1932. // CHECK:STDOUT: %.loc19_28.2: ref %C = value_as_ref %.loc19_28.1
  1933. // CHECK:STDOUT: %addr.loc19_31.1: %ptr.d9e = addr_of %.loc19_28.2
  1934. // CHECK:STDOUT: %.loc19_33.2: ref %C = value_as_ref %.loc19_33.1
  1935. // CHECK:STDOUT: %addr.loc19_31.2: %ptr.d9e = addr_of %.loc19_33.2
  1936. // CHECK:STDOUT: %.loc19_31.1: ref bool = temporary_storage
  1937. // CHECK:STDOUT: %addr.loc19_31.3: %ptr.bb2 = addr_of %.loc19_31.1
  1938. // CHECK:STDOUT: %operator>__carbon_thunk.call: init %empty_tuple.type = call imports.%operator>__carbon_thunk.decl(%addr.loc19_31.1, %addr.loc19_31.2, %addr.loc19_31.3)
  1939. // CHECK:STDOUT: %.loc19_31.2: init bool = in_place_init %operator>__carbon_thunk.call, %.loc19_31.1
  1940. // CHECK:STDOUT: %.loc19_21.1: type = splice_block %.loc19_21.3 [concrete = bool] {
  1941. // CHECK:STDOUT: %Bool.call.loc19: init type = call constants.%Bool() [concrete = bool]
  1942. // CHECK:STDOUT: %.loc19_21.2: type = value_of_initializer %Bool.call.loc19 [concrete = bool]
  1943. // CHECK:STDOUT: %.loc19_21.3: type = converted %Bool.call.loc19, %.loc19_21.2 [concrete = bool]
  1944. // CHECK:STDOUT: }
  1945. // CHECK:STDOUT: %.loc19_31.3: bool = value_of_initializer %.loc19_31.2
  1946. // CHECK:STDOUT: %.loc19_31.4: bool = converted %.loc19_31.2, %.loc19_31.3
  1947. // CHECK:STDOUT: %greater_than: bool = value_binding greater_than, %.loc19_31.4
  1948. // CHECK:STDOUT: name_binding_decl {
  1949. // CHECK:STDOUT: %less_than.patt: %pattern_type.831 = value_binding_pattern less_than [concrete]
  1950. // CHECK:STDOUT: }
  1951. // CHECK:STDOUT: %c1.ref.loc26: ref %C = name_ref c1, %c1
  1952. // CHECK:STDOUT: %c2.ref.loc26: ref %C = name_ref c2, %c2
  1953. // CHECK:STDOUT: %.loc26_18.1: type = splice_block %.loc26_18.3 [concrete = bool] {
  1954. // CHECK:STDOUT: %Bool.call.loc26: init type = call constants.%Bool() [concrete = bool]
  1955. // CHECK:STDOUT: %.loc26_18.2: type = value_of_initializer %Bool.call.loc26 [concrete = bool]
  1956. // CHECK:STDOUT: %.loc26_18.3: type = converted %Bool.call.loc26, %.loc26_18.2 [concrete = bool]
  1957. // CHECK:STDOUT: }
  1958. // CHECK:STDOUT: %less_than: bool = value_binding less_than, <error> [concrete = <error>]
  1959. // CHECK:STDOUT: name_binding_decl {
  1960. // CHECK:STDOUT: %greater_than_or_equal.patt: %pattern_type.831 = value_binding_pattern greater_than_or_equal [concrete]
  1961. // CHECK:STDOUT: }
  1962. // CHECK:STDOUT: %c1.ref.loc33: ref %C = name_ref c1, %c1
  1963. // CHECK:STDOUT: %c2.ref.loc33: ref %C = name_ref c2, %c2
  1964. // CHECK:STDOUT: %.loc33_30.1: type = splice_block %.loc33_30.3 [concrete = bool] {
  1965. // CHECK:STDOUT: %Bool.call.loc33: init type = call constants.%Bool() [concrete = bool]
  1966. // CHECK:STDOUT: %.loc33_30.2: type = value_of_initializer %Bool.call.loc33 [concrete = bool]
  1967. // CHECK:STDOUT: %.loc33_30.3: type = converted %Bool.call.loc33, %.loc33_30.2 [concrete = bool]
  1968. // CHECK:STDOUT: }
  1969. // CHECK:STDOUT: %greater_than_or_equal: bool = value_binding greater_than_or_equal, <error> [concrete = <error>]
  1970. // CHECK:STDOUT: name_binding_decl {
  1971. // CHECK:STDOUT: %less_than_or_equal.patt: %pattern_type.831 = value_binding_pattern less_than_or_equal [concrete]
  1972. // CHECK:STDOUT: }
  1973. // CHECK:STDOUT: %c1.ref.loc36: ref %C = name_ref c1, %c1
  1974. // CHECK:STDOUT: %c2.ref.loc36: ref %C = name_ref c2, %c2
  1975. // CHECK:STDOUT: %.loc36_34.1: %C = acquire_value %c1.ref.loc36
  1976. // CHECK:STDOUT: %.loc36_40.1: %C = acquire_value %c2.ref.loc36
  1977. // CHECK:STDOUT: %.loc36_34.2: ref %C = value_as_ref %.loc36_34.1
  1978. // CHECK:STDOUT: %addr.loc36_37.1: %ptr.d9e = addr_of %.loc36_34.2
  1979. // CHECK:STDOUT: %.loc36_40.2: ref %C = value_as_ref %.loc36_40.1
  1980. // CHECK:STDOUT: %addr.loc36_37.2: %ptr.d9e = addr_of %.loc36_40.2
  1981. // CHECK:STDOUT: %.loc36_37.1: ref bool = temporary_storage
  1982. // CHECK:STDOUT: %addr.loc36_37.3: %ptr.bb2 = addr_of %.loc36_37.1
  1983. // CHECK:STDOUT: %operator<=__carbon_thunk.call: init %empty_tuple.type = call imports.%operator<=__carbon_thunk.decl(%addr.loc36_37.1, %addr.loc36_37.2, %addr.loc36_37.3)
  1984. // CHECK:STDOUT: %.loc36_37.2: init bool = in_place_init %operator<=__carbon_thunk.call, %.loc36_37.1
  1985. // CHECK:STDOUT: %.loc36_27.1: type = splice_block %.loc36_27.3 [concrete = bool] {
  1986. // CHECK:STDOUT: %Bool.call.loc36: init type = call constants.%Bool() [concrete = bool]
  1987. // CHECK:STDOUT: %.loc36_27.2: type = value_of_initializer %Bool.call.loc36 [concrete = bool]
  1988. // CHECK:STDOUT: %.loc36_27.3: type = converted %Bool.call.loc36, %.loc36_27.2 [concrete = bool]
  1989. // CHECK:STDOUT: }
  1990. // CHECK:STDOUT: %.loc36_37.3: bool = value_of_initializer %.loc36_37.2
  1991. // CHECK:STDOUT: %.loc36_37.4: bool = converted %.loc36_37.2, %.loc36_37.3
  1992. // CHECK:STDOUT: %less_than_or_equal: bool = value_binding less_than_or_equal, %.loc36_37.4
  1993. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc16: <bound method> = bound_method %c2.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1994. // CHECK:STDOUT: <elided>
  1995. // CHECK:STDOUT: %bound_method.loc16: <bound method> = bound_method %c2.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  1996. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc16: init %empty_tuple.type = call %bound_method.loc16(%c2.var)
  1997. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc15: <bound method> = bound_method %c1.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  1998. // CHECK:STDOUT: <elided>
  1999. // CHECK:STDOUT: %bound_method.loc15: <bound method> = bound_method %c1.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2000. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc15: init %empty_tuple.type = call %bound_method.loc15(%c1.var)
  2001. // CHECK:STDOUT: <elided>
  2002. // CHECK:STDOUT: }
  2003. // CHECK:STDOUT:
  2004. // CHECK:STDOUT: --- fail_todo_rewrite_equal.carbon
  2005. // CHECK:STDOUT:
  2006. // CHECK:STDOUT: constants {
  2007. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2008. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2009. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  2010. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2011. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2012. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  2013. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2014. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2015. // CHECK:STDOUT: %Bool.type: type = fn_type @Bool [concrete]
  2016. // CHECK:STDOUT: %Bool: %Bool.type = struct_value () [concrete]
  2017. // CHECK:STDOUT: %pattern_type.831: type = pattern_type bool [concrete]
  2018. // CHECK:STDOUT: %ptr.bb2: type = ptr_type bool [concrete]
  2019. // CHECK:STDOUT: %operator==__carbon_thunk.type: type = fn_type @operator==__carbon_thunk [concrete]
  2020. // CHECK:STDOUT: %operator==__carbon_thunk: %operator==__carbon_thunk.type = struct_value () [concrete]
  2021. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2022. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2023. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2024. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  2025. // CHECK:STDOUT: }
  2026. // CHECK:STDOUT:
  2027. // CHECK:STDOUT: imports {
  2028. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2029. // CHECK:STDOUT: .C = %C.decl
  2030. // CHECK:STDOUT: import Cpp//...
  2031. // CHECK:STDOUT: }
  2032. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2033. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2034. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2035. // CHECK:STDOUT: <elided>
  2036. // CHECK:STDOUT: } {
  2037. // CHECK:STDOUT: <elided>
  2038. // CHECK:STDOUT: }
  2039. // CHECK:STDOUT: %operator==__carbon_thunk.decl: %operator==__carbon_thunk.type = fn_decl @operator==__carbon_thunk [concrete = constants.%operator==__carbon_thunk] {
  2040. // CHECK:STDOUT: <elided>
  2041. // CHECK:STDOUT: } {
  2042. // CHECK:STDOUT: <elided>
  2043. // CHECK:STDOUT: }
  2044. // CHECK:STDOUT: }
  2045. // CHECK:STDOUT:
  2046. // CHECK:STDOUT: fn @F() {
  2047. // CHECK:STDOUT: !entry:
  2048. // CHECK:STDOUT: name_binding_decl {
  2049. // CHECK:STDOUT: %c1.patt: %pattern_type.217 = ref_binding_pattern c1 [concrete]
  2050. // CHECK:STDOUT: %c1.var_patt: %pattern_type.217 = var_pattern %c1.patt [concrete]
  2051. // CHECK:STDOUT: }
  2052. // CHECK:STDOUT: %c1.var: ref %C = var %c1.var_patt
  2053. // CHECK:STDOUT: %Cpp.ref.loc12_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2054. // CHECK:STDOUT: %C.ref.loc12_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2055. // CHECK:STDOUT: %C.ref.loc12_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2056. // CHECK:STDOUT: %.loc12_3: ref %C = splice_block %c1.var {}
  2057. // CHECK:STDOUT: %addr.loc12: %ptr.d9e = addr_of %.loc12_3
  2058. // CHECK:STDOUT: %C__carbon_thunk.call.loc12: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc12)
  2059. // CHECK:STDOUT: %.loc12_27: init %C = in_place_init %C__carbon_thunk.call.loc12, %.loc12_3
  2060. // CHECK:STDOUT: assign %c1.var, %.loc12_27
  2061. // CHECK:STDOUT: %.loc12_14: type = splice_block %C.ref.loc12_14 [concrete = constants.%C] {
  2062. // CHECK:STDOUT: %Cpp.ref.loc12_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2063. // CHECK:STDOUT: %C.ref.loc12_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2064. // CHECK:STDOUT: }
  2065. // CHECK:STDOUT: %c1: ref %C = ref_binding c1, %c1.var
  2066. // CHECK:STDOUT: name_binding_decl {
  2067. // CHECK:STDOUT: %c2.patt: %pattern_type.217 = ref_binding_pattern c2 [concrete]
  2068. // CHECK:STDOUT: %c2.var_patt: %pattern_type.217 = var_pattern %c2.patt [concrete]
  2069. // CHECK:STDOUT: }
  2070. // CHECK:STDOUT: %c2.var: ref %C = var %c2.var_patt
  2071. // CHECK:STDOUT: %Cpp.ref.loc13_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2072. // CHECK:STDOUT: %C.ref.loc13_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2073. // CHECK:STDOUT: %C.ref.loc13_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2074. // CHECK:STDOUT: %.loc13_3: ref %C = splice_block %c2.var {}
  2075. // CHECK:STDOUT: %addr.loc13: %ptr.d9e = addr_of %.loc13_3
  2076. // CHECK:STDOUT: %C__carbon_thunk.call.loc13: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc13)
  2077. // CHECK:STDOUT: %.loc13_27: init %C = in_place_init %C__carbon_thunk.call.loc13, %.loc13_3
  2078. // CHECK:STDOUT: assign %c2.var, %.loc13_27
  2079. // CHECK:STDOUT: %.loc13_14: type = splice_block %C.ref.loc13_14 [concrete = constants.%C] {
  2080. // CHECK:STDOUT: %Cpp.ref.loc13_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2081. // CHECK:STDOUT: %C.ref.loc13_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2082. // CHECK:STDOUT: }
  2083. // CHECK:STDOUT: %c2: ref %C = ref_binding c2, %c2.var
  2084. // CHECK:STDOUT: name_binding_decl {
  2085. // CHECK:STDOUT: %equal.patt: %pattern_type.831 = value_binding_pattern equal [concrete]
  2086. // CHECK:STDOUT: }
  2087. // CHECK:STDOUT: %c1.ref.loc16: ref %C = name_ref c1, %c1
  2088. // CHECK:STDOUT: %c2.ref.loc16: ref %C = name_ref c2, %c2
  2089. // CHECK:STDOUT: %.loc16_21.1: %C = acquire_value %c1.ref.loc16
  2090. // CHECK:STDOUT: %.loc16_27.1: %C = acquire_value %c2.ref.loc16
  2091. // CHECK:STDOUT: %.loc16_21.2: ref %C = value_as_ref %.loc16_21.1
  2092. // CHECK:STDOUT: %addr.loc16_24.1: %ptr.d9e = addr_of %.loc16_21.2
  2093. // CHECK:STDOUT: %.loc16_27.2: ref %C = value_as_ref %.loc16_27.1
  2094. // CHECK:STDOUT: %addr.loc16_24.2: %ptr.d9e = addr_of %.loc16_27.2
  2095. // CHECK:STDOUT: %.loc16_24.1: ref bool = temporary_storage
  2096. // CHECK:STDOUT: %addr.loc16_24.3: %ptr.bb2 = addr_of %.loc16_24.1
  2097. // CHECK:STDOUT: %operator==__carbon_thunk.call: init %empty_tuple.type = call imports.%operator==__carbon_thunk.decl(%addr.loc16_24.1, %addr.loc16_24.2, %addr.loc16_24.3)
  2098. // CHECK:STDOUT: %.loc16_24.2: init bool = in_place_init %operator==__carbon_thunk.call, %.loc16_24.1
  2099. // CHECK:STDOUT: %.loc16_14.1: type = splice_block %.loc16_14.3 [concrete = bool] {
  2100. // CHECK:STDOUT: %Bool.call.loc16: init type = call constants.%Bool() [concrete = bool]
  2101. // CHECK:STDOUT: %.loc16_14.2: type = value_of_initializer %Bool.call.loc16 [concrete = bool]
  2102. // CHECK:STDOUT: %.loc16_14.3: type = converted %Bool.call.loc16, %.loc16_14.2 [concrete = bool]
  2103. // CHECK:STDOUT: }
  2104. // CHECK:STDOUT: %.loc16_24.3: bool = value_of_initializer %.loc16_24.2
  2105. // CHECK:STDOUT: %.loc16_24.4: bool = converted %.loc16_24.2, %.loc16_24.3
  2106. // CHECK:STDOUT: %equal: bool = value_binding equal, %.loc16_24.4
  2107. // CHECK:STDOUT: name_binding_decl {
  2108. // CHECK:STDOUT: %not_equal.patt: %pattern_type.831 = value_binding_pattern not_equal [concrete]
  2109. // CHECK:STDOUT: }
  2110. // CHECK:STDOUT: %c1.ref.loc23: ref %C = name_ref c1, %c1
  2111. // CHECK:STDOUT: %c2.ref.loc23: ref %C = name_ref c2, %c2
  2112. // CHECK:STDOUT: %.loc23_18.1: type = splice_block %.loc23_18.3 [concrete = bool] {
  2113. // CHECK:STDOUT: %Bool.call.loc23: init type = call constants.%Bool() [concrete = bool]
  2114. // CHECK:STDOUT: %.loc23_18.2: type = value_of_initializer %Bool.call.loc23 [concrete = bool]
  2115. // CHECK:STDOUT: %.loc23_18.3: type = converted %Bool.call.loc23, %.loc23_18.2 [concrete = bool]
  2116. // CHECK:STDOUT: }
  2117. // CHECK:STDOUT: %not_equal: bool = value_binding not_equal, <error> [concrete = <error>]
  2118. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc13: <bound method> = bound_method %c2.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2119. // CHECK:STDOUT: <elided>
  2120. // CHECK:STDOUT: %bound_method.loc13: <bound method> = bound_method %c2.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2121. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc13: init %empty_tuple.type = call %bound_method.loc13(%c2.var)
  2122. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc12: <bound method> = bound_method %c1.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2123. // CHECK:STDOUT: <elided>
  2124. // CHECK:STDOUT: %bound_method.loc12: <bound method> = bound_method %c1.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2125. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc12: init %empty_tuple.type = call %bound_method.loc12(%c1.var)
  2126. // CHECK:STDOUT: <elided>
  2127. // CHECK:STDOUT: }
  2128. // CHECK:STDOUT:
  2129. // CHECK:STDOUT: --- import_single_namespace.carbon
  2130. // CHECK:STDOUT:
  2131. // CHECK:STDOUT: constants {
  2132. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2133. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2134. // CHECK:STDOUT: %pattern_type.69f: type = pattern_type %C [concrete]
  2135. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2136. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2137. // CHECK:STDOUT: %ptr.838: type = ptr_type %C [concrete]
  2138. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2139. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2140. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2141. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2142. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2143. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2144. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.98c: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2145. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.2f1: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.98c = struct_value () [concrete]
  2146. // CHECK:STDOUT: }
  2147. // CHECK:STDOUT:
  2148. // CHECK:STDOUT: imports {
  2149. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2150. // CHECK:STDOUT: .N = %N
  2151. // CHECK:STDOUT: import Cpp//...
  2152. // CHECK:STDOUT: }
  2153. // CHECK:STDOUT: %N: <namespace> = namespace [concrete] {
  2154. // CHECK:STDOUT: .C = %C.decl
  2155. // CHECK:STDOUT: import Cpp//...
  2156. // CHECK:STDOUT: }
  2157. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2158. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2159. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2160. // CHECK:STDOUT: <elided>
  2161. // CHECK:STDOUT: } {
  2162. // CHECK:STDOUT: <elided>
  2163. // CHECK:STDOUT: }
  2164. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2165. // CHECK:STDOUT: <elided>
  2166. // CHECK:STDOUT: } {
  2167. // CHECK:STDOUT: <elided>
  2168. // CHECK:STDOUT: }
  2169. // CHECK:STDOUT: }
  2170. // CHECK:STDOUT:
  2171. // CHECK:STDOUT: fn @F() {
  2172. // CHECK:STDOUT: !entry:
  2173. // CHECK:STDOUT: name_binding_decl {
  2174. // CHECK:STDOUT: %c1.patt: %pattern_type.69f = value_binding_pattern c1 [concrete]
  2175. // CHECK:STDOUT: }
  2176. // CHECK:STDOUT: %Cpp.ref.loc8_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2177. // CHECK:STDOUT: %N.ref.loc8_24: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2178. // CHECK:STDOUT: %C.ref.loc8_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2179. // CHECK:STDOUT: %C.ref.loc8_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2180. // CHECK:STDOUT: %.loc8_31.1: ref %C = temporary_storage
  2181. // CHECK:STDOUT: %addr.loc8: %ptr.838 = addr_of %.loc8_31.1
  2182. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  2183. // CHECK:STDOUT: %.loc8_31.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_31.1
  2184. // CHECK:STDOUT: %.loc8_16: type = splice_block %C.ref.loc8_16 [concrete = constants.%C] {
  2185. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2186. // CHECK:STDOUT: %N.ref.loc8_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2187. // CHECK:STDOUT: %C.ref.loc8_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2188. // CHECK:STDOUT: }
  2189. // CHECK:STDOUT: %.loc8_31.3: ref %C = temporary %.loc8_31.1, %.loc8_31.2
  2190. // CHECK:STDOUT: %.loc8_31.4: %C = acquire_value %.loc8_31.3
  2191. // CHECK:STDOUT: %c1: %C = value_binding c1, %.loc8_31.4
  2192. // CHECK:STDOUT: name_binding_decl {
  2193. // CHECK:STDOUT: %c2.patt: %pattern_type.69f = value_binding_pattern c2 [concrete]
  2194. // CHECK:STDOUT: }
  2195. // CHECK:STDOUT: %Cpp.ref.loc9_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2196. // CHECK:STDOUT: %N.ref.loc9_24: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2197. // CHECK:STDOUT: %C.ref.loc9_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2198. // CHECK:STDOUT: %C.ref.loc9_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2199. // CHECK:STDOUT: %.loc9_31.1: ref %C = temporary_storage
  2200. // CHECK:STDOUT: %addr.loc9: %ptr.838 = addr_of %.loc9_31.1
  2201. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  2202. // CHECK:STDOUT: %.loc9_31.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_31.1
  2203. // CHECK:STDOUT: %.loc9_16: type = splice_block %C.ref.loc9_16 [concrete = constants.%C] {
  2204. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2205. // CHECK:STDOUT: %N.ref.loc9_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2206. // CHECK:STDOUT: %C.ref.loc9_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2207. // CHECK:STDOUT: }
  2208. // CHECK:STDOUT: %.loc9_31.3: ref %C = temporary %.loc9_31.1, %.loc9_31.2
  2209. // CHECK:STDOUT: %.loc9_31.4: %C = acquire_value %.loc9_31.3
  2210. // CHECK:STDOUT: %c2: %C = value_binding c2, %.loc9_31.4
  2211. // CHECK:STDOUT: name_binding_decl {
  2212. // CHECK:STDOUT: %c3.patt: %pattern_type.69f = value_binding_pattern c3 [concrete]
  2213. // CHECK:STDOUT: }
  2214. // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
  2215. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  2216. // CHECK:STDOUT: %.loc10_24.1: ref %C = temporary_storage
  2217. // CHECK:STDOUT: %.loc10_21: ref %C = value_as_ref %c1.ref
  2218. // CHECK:STDOUT: %addr.loc10_24.1: %ptr.838 = addr_of %.loc10_21
  2219. // CHECK:STDOUT: %.loc10_26: ref %C = value_as_ref %c2.ref
  2220. // CHECK:STDOUT: %addr.loc10_24.2: %ptr.838 = addr_of %.loc10_26
  2221. // CHECK:STDOUT: %addr.loc10_24.3: %ptr.838 = addr_of %.loc10_24.1
  2222. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_24.1, %addr.loc10_24.2, %addr.loc10_24.3)
  2223. // CHECK:STDOUT: %.loc10_24.2: init %C = in_place_init %operator+__carbon_thunk.call, %.loc10_24.1
  2224. // CHECK:STDOUT: %.loc10_16: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  2225. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2226. // CHECK:STDOUT: %N.ref.loc10: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2227. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2228. // CHECK:STDOUT: }
  2229. // CHECK:STDOUT: %.loc10_24.3: ref %C = temporary %.loc10_24.1, %.loc10_24.2
  2230. // CHECK:STDOUT: %.loc10_24.4: %C = acquire_value %.loc10_24.3
  2231. // CHECK:STDOUT: %c3: %C = value_binding c3, %.loc10_24.4
  2232. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_24.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2f1
  2233. // CHECK:STDOUT: <elided>
  2234. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_24.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2235. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_24.3)
  2236. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2f1
  2237. // CHECK:STDOUT: <elided>
  2238. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2239. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_31.3)
  2240. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2f1
  2241. // CHECK:STDOUT: <elided>
  2242. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  2243. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_31.3)
  2244. // CHECK:STDOUT: <elided>
  2245. // CHECK:STDOUT: }
  2246. // CHECK:STDOUT:
  2247. // CHECK:STDOUT: --- import_multiple_namespaces.carbon
  2248. // CHECK:STDOUT:
  2249. // CHECK:STDOUT: constants {
  2250. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2251. // CHECK:STDOUT: %C1: type = class_type @C1 [concrete]
  2252. // CHECK:STDOUT: %pattern_type.20f: type = pattern_type %C1 [concrete]
  2253. // CHECK:STDOUT: %C1.C1.cpp_overload_set.type: type = cpp_overload_set_type @C1.C1.cpp_overload_set [concrete]
  2254. // CHECK:STDOUT: %C1.C1.cpp_overload_set.value: %C1.C1.cpp_overload_set.type = cpp_overload_set_value @C1.C1.cpp_overload_set [concrete]
  2255. // CHECK:STDOUT: %ptr.087: type = ptr_type %C1 [concrete]
  2256. // CHECK:STDOUT: %C1__carbon_thunk.type: type = fn_type @C1__carbon_thunk [concrete]
  2257. // CHECK:STDOUT: %C1__carbon_thunk: %C1__carbon_thunk.type = struct_value () [concrete]
  2258. // CHECK:STDOUT: %C2: type = class_type @C2 [concrete]
  2259. // CHECK:STDOUT: %pattern_type.846: type = pattern_type %C2 [concrete]
  2260. // CHECK:STDOUT: %C2.C2.cpp_overload_set.type: type = cpp_overload_set_type @C2.C2.cpp_overload_set [concrete]
  2261. // CHECK:STDOUT: %C2.C2.cpp_overload_set.value: %C2.C2.cpp_overload_set.type = cpp_overload_set_value @C2.C2.cpp_overload_set [concrete]
  2262. // CHECK:STDOUT: %ptr.51f: type = ptr_type %C2 [concrete]
  2263. // CHECK:STDOUT: %C2__carbon_thunk.type: type = fn_type @C2__carbon_thunk [concrete]
  2264. // CHECK:STDOUT: %C2__carbon_thunk: %C2__carbon_thunk.type = struct_value () [concrete]
  2265. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2266. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2267. // CHECK:STDOUT: %operator-__carbon_thunk.type: type = fn_type @operator-__carbon_thunk [concrete]
  2268. // CHECK:STDOUT: %operator-__carbon_thunk: %operator-__carbon_thunk.type = struct_value () [concrete]
  2269. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2270. // CHECK:STDOUT: %facet_value.d7a: %type_where = facet_value %C2, () [concrete]
  2271. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.be9: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.d7a) [concrete]
  2272. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.e94: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.be9 = struct_value () [concrete]
  2273. // CHECK:STDOUT: %facet_value.e5d: %type_where = facet_value %C1, () [concrete]
  2274. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.83f: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value.e5d) [concrete]
  2275. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.5d9: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.83f = struct_value () [concrete]
  2276. // CHECK:STDOUT: }
  2277. // CHECK:STDOUT:
  2278. // CHECK:STDOUT: imports {
  2279. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2280. // CHECK:STDOUT: .N1 = %N1
  2281. // CHECK:STDOUT: .N2 = %N2
  2282. // CHECK:STDOUT: import Cpp//...
  2283. // CHECK:STDOUT: }
  2284. // CHECK:STDOUT: %N1: <namespace> = namespace [concrete] {
  2285. // CHECK:STDOUT: .C1 = %C1.decl
  2286. // CHECK:STDOUT: import Cpp//...
  2287. // CHECK:STDOUT: }
  2288. // CHECK:STDOUT: %C1.decl: type = class_decl @C1 [concrete = constants.%C1] {} {}
  2289. // CHECK:STDOUT: %C1.C1.cpp_overload_set.value: %C1.C1.cpp_overload_set.type = cpp_overload_set_value @C1.C1.cpp_overload_set [concrete = constants.%C1.C1.cpp_overload_set.value]
  2290. // CHECK:STDOUT: %C1__carbon_thunk.decl: %C1__carbon_thunk.type = fn_decl @C1__carbon_thunk [concrete = constants.%C1__carbon_thunk] {
  2291. // CHECK:STDOUT: <elided>
  2292. // CHECK:STDOUT: } {
  2293. // CHECK:STDOUT: <elided>
  2294. // CHECK:STDOUT: }
  2295. // CHECK:STDOUT: %N2: <namespace> = namespace [concrete] {
  2296. // CHECK:STDOUT: .C2 = %C2.decl
  2297. // CHECK:STDOUT: import Cpp//...
  2298. // CHECK:STDOUT: }
  2299. // CHECK:STDOUT: %C2.decl: type = class_decl @C2 [concrete = constants.%C2] {} {}
  2300. // CHECK:STDOUT: %C2.C2.cpp_overload_set.value: %C2.C2.cpp_overload_set.type = cpp_overload_set_value @C2.C2.cpp_overload_set [concrete = constants.%C2.C2.cpp_overload_set.value]
  2301. // CHECK:STDOUT: %C2__carbon_thunk.decl: %C2__carbon_thunk.type = fn_decl @C2__carbon_thunk [concrete = constants.%C2__carbon_thunk] {
  2302. // CHECK:STDOUT: <elided>
  2303. // CHECK:STDOUT: } {
  2304. // CHECK:STDOUT: <elided>
  2305. // CHECK:STDOUT: }
  2306. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2307. // CHECK:STDOUT: <elided>
  2308. // CHECK:STDOUT: } {
  2309. // CHECK:STDOUT: <elided>
  2310. // CHECK:STDOUT: }
  2311. // CHECK:STDOUT: %operator-__carbon_thunk.decl: %operator-__carbon_thunk.type = fn_decl @operator-__carbon_thunk [concrete = constants.%operator-__carbon_thunk] {
  2312. // CHECK:STDOUT: <elided>
  2313. // CHECK:STDOUT: } {
  2314. // CHECK:STDOUT: <elided>
  2315. // CHECK:STDOUT: }
  2316. // CHECK:STDOUT: }
  2317. // CHECK:STDOUT:
  2318. // CHECK:STDOUT: fn @F() {
  2319. // CHECK:STDOUT: !entry:
  2320. // CHECK:STDOUT: name_binding_decl {
  2321. // CHECK:STDOUT: %c1.patt: %pattern_type.20f = value_binding_pattern c1 [concrete]
  2322. // CHECK:STDOUT: }
  2323. // CHECK:STDOUT: %Cpp.ref.loc8_23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2324. // CHECK:STDOUT: %N1.ref.loc8_26: <namespace> = name_ref N1, imports.%N1 [concrete = imports.%N1]
  2325. // CHECK:STDOUT: %C1.ref.loc8_29: type = name_ref C1, imports.%C1.decl [concrete = constants.%C1]
  2326. // CHECK:STDOUT: %C1.ref.loc8_32: %C1.C1.cpp_overload_set.type = name_ref C1, imports.%C1.C1.cpp_overload_set.value [concrete = constants.%C1.C1.cpp_overload_set.value]
  2327. // CHECK:STDOUT: %.loc8_36.1: ref %C1 = temporary_storage
  2328. // CHECK:STDOUT: %addr.loc8: %ptr.087 = addr_of %.loc8_36.1
  2329. // CHECK:STDOUT: %C1__carbon_thunk.call: init %empty_tuple.type = call imports.%C1__carbon_thunk.decl(%addr.loc8)
  2330. // CHECK:STDOUT: %.loc8_36.2: init %C1 = in_place_init %C1__carbon_thunk.call, %.loc8_36.1
  2331. // CHECK:STDOUT: %.loc8_17: type = splice_block %C1.ref.loc8_17 [concrete = constants.%C1] {
  2332. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2333. // CHECK:STDOUT: %N1.ref.loc8_14: <namespace> = name_ref N1, imports.%N1 [concrete = imports.%N1]
  2334. // CHECK:STDOUT: %C1.ref.loc8_17: type = name_ref C1, imports.%C1.decl [concrete = constants.%C1]
  2335. // CHECK:STDOUT: }
  2336. // CHECK:STDOUT: %.loc8_36.3: ref %C1 = temporary %.loc8_36.1, %.loc8_36.2
  2337. // CHECK:STDOUT: %.loc8_36.4: %C1 = acquire_value %.loc8_36.3
  2338. // CHECK:STDOUT: %c1: %C1 = value_binding c1, %.loc8_36.4
  2339. // CHECK:STDOUT: name_binding_decl {
  2340. // CHECK:STDOUT: %c2.patt: %pattern_type.846 = value_binding_pattern c2 [concrete]
  2341. // CHECK:STDOUT: }
  2342. // CHECK:STDOUT: %Cpp.ref.loc9_23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2343. // CHECK:STDOUT: %N2.ref.loc9_26: <namespace> = name_ref N2, imports.%N2 [concrete = imports.%N2]
  2344. // CHECK:STDOUT: %C2.ref.loc9_29: type = name_ref C2, imports.%C2.decl [concrete = constants.%C2]
  2345. // CHECK:STDOUT: %C2.ref.loc9_32: %C2.C2.cpp_overload_set.type = name_ref C2, imports.%C2.C2.cpp_overload_set.value [concrete = constants.%C2.C2.cpp_overload_set.value]
  2346. // CHECK:STDOUT: %.loc9_36.1: ref %C2 = temporary_storage
  2347. // CHECK:STDOUT: %addr.loc9: %ptr.51f = addr_of %.loc9_36.1
  2348. // CHECK:STDOUT: %C2__carbon_thunk.call: init %empty_tuple.type = call imports.%C2__carbon_thunk.decl(%addr.loc9)
  2349. // CHECK:STDOUT: %.loc9_36.2: init %C2 = in_place_init %C2__carbon_thunk.call, %.loc9_36.1
  2350. // CHECK:STDOUT: %.loc9_17: type = splice_block %C2.ref.loc9_17 [concrete = constants.%C2] {
  2351. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2352. // CHECK:STDOUT: %N2.ref.loc9_14: <namespace> = name_ref N2, imports.%N2 [concrete = imports.%N2]
  2353. // CHECK:STDOUT: %C2.ref.loc9_17: type = name_ref C2, imports.%C2.decl [concrete = constants.%C2]
  2354. // CHECK:STDOUT: }
  2355. // CHECK:STDOUT: %.loc9_36.3: ref %C2 = temporary %.loc9_36.1, %.loc9_36.2
  2356. // CHECK:STDOUT: %.loc9_36.4: %C2 = acquire_value %.loc9_36.3
  2357. // CHECK:STDOUT: %c2: %C2 = value_binding c2, %.loc9_36.4
  2358. // CHECK:STDOUT: name_binding_decl {
  2359. // CHECK:STDOUT: %c3.patt: %pattern_type.846 = value_binding_pattern c3 [concrete]
  2360. // CHECK:STDOUT: }
  2361. // CHECK:STDOUT: %c1.ref.loc10: %C1 = name_ref c1, %c1
  2362. // CHECK:STDOUT: %c2.ref.loc10: %C2 = name_ref c2, %c2
  2363. // CHECK:STDOUT: %.loc10_26.1: ref %C2 = temporary_storage
  2364. // CHECK:STDOUT: %.loc10_23: ref %C1 = value_as_ref %c1.ref.loc10
  2365. // CHECK:STDOUT: %addr.loc10_26.1: %ptr.087 = addr_of %.loc10_23
  2366. // CHECK:STDOUT: %.loc10_28: ref %C2 = value_as_ref %c2.ref.loc10
  2367. // CHECK:STDOUT: %addr.loc10_26.2: %ptr.51f = addr_of %.loc10_28
  2368. // CHECK:STDOUT: %addr.loc10_26.3: %ptr.51f = addr_of %.loc10_26.1
  2369. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_26.1, %addr.loc10_26.2, %addr.loc10_26.3)
  2370. // CHECK:STDOUT: %.loc10_26.2: init %C2 = in_place_init %operator+__carbon_thunk.call, %.loc10_26.1
  2371. // CHECK:STDOUT: %.loc10_17: type = splice_block %C2.ref.loc10 [concrete = constants.%C2] {
  2372. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2373. // CHECK:STDOUT: %N2.ref.loc10: <namespace> = name_ref N2, imports.%N2 [concrete = imports.%N2]
  2374. // CHECK:STDOUT: %C2.ref.loc10: type = name_ref C2, imports.%C2.decl [concrete = constants.%C2]
  2375. // CHECK:STDOUT: }
  2376. // CHECK:STDOUT: %.loc10_26.3: ref %C2 = temporary %.loc10_26.1, %.loc10_26.2
  2377. // CHECK:STDOUT: %.loc10_26.4: %C2 = acquire_value %.loc10_26.3
  2378. // CHECK:STDOUT: %c3: %C2 = value_binding c3, %.loc10_26.4
  2379. // CHECK:STDOUT: name_binding_decl {
  2380. // CHECK:STDOUT: %c4.patt: %pattern_type.846 = value_binding_pattern c4 [concrete]
  2381. // CHECK:STDOUT: }
  2382. // CHECK:STDOUT: %c2.ref.loc11: %C2 = name_ref c2, %c2
  2383. // CHECK:STDOUT: %c1.ref.loc11: %C1 = name_ref c1, %c1
  2384. // CHECK:STDOUT: %.loc11_26.1: ref %C2 = temporary_storage
  2385. // CHECK:STDOUT: %.loc11_23: ref %C2 = value_as_ref %c2.ref.loc11
  2386. // CHECK:STDOUT: %addr.loc11_26.1: %ptr.51f = addr_of %.loc11_23
  2387. // CHECK:STDOUT: %.loc11_28: ref %C1 = value_as_ref %c1.ref.loc11
  2388. // CHECK:STDOUT: %addr.loc11_26.2: %ptr.087 = addr_of %.loc11_28
  2389. // CHECK:STDOUT: %addr.loc11_26.3: %ptr.51f = addr_of %.loc11_26.1
  2390. // CHECK:STDOUT: %operator-__carbon_thunk.call: init %empty_tuple.type = call imports.%operator-__carbon_thunk.decl(%addr.loc11_26.1, %addr.loc11_26.2, %addr.loc11_26.3)
  2391. // CHECK:STDOUT: %.loc11_26.2: init %C2 = in_place_init %operator-__carbon_thunk.call, %.loc11_26.1
  2392. // CHECK:STDOUT: %.loc11_17: type = splice_block %C2.ref.loc11 [concrete = constants.%C2] {
  2393. // CHECK:STDOUT: %Cpp.ref.loc11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2394. // CHECK:STDOUT: %N2.ref.loc11: <namespace> = name_ref N2, imports.%N2 [concrete = imports.%N2]
  2395. // CHECK:STDOUT: %C2.ref.loc11: type = name_ref C2, imports.%C2.decl [concrete = constants.%C2]
  2396. // CHECK:STDOUT: }
  2397. // CHECK:STDOUT: %.loc11_26.3: ref %C2 = temporary %.loc11_26.1, %.loc11_26.2
  2398. // CHECK:STDOUT: %.loc11_26.4: %C2 = acquire_value %.loc11_26.3
  2399. // CHECK:STDOUT: %c4: %C2 = value_binding c4, %.loc11_26.4
  2400. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc11: <bound method> = bound_method %.loc11_26.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e94
  2401. // CHECK:STDOUT: <elided>
  2402. // CHECK:STDOUT: %bound_method.loc11: <bound method> = bound_method %.loc11_26.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2403. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc11: init %empty_tuple.type = call %bound_method.loc11(%.loc11_26.3)
  2404. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_26.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e94
  2405. // CHECK:STDOUT: <elided>
  2406. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_26.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2407. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_26.3)
  2408. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_36.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.e94
  2409. // CHECK:STDOUT: <elided>
  2410. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_36.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  2411. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_36.3)
  2412. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_36.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.5d9
  2413. // CHECK:STDOUT: <elided>
  2414. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_36.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.4
  2415. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_36.3)
  2416. // CHECK:STDOUT: <elided>
  2417. // CHECK:STDOUT: }
  2418. // CHECK:STDOUT:
  2419. // CHECK:STDOUT: --- fail_todo_import_operands_in_namespace_operator_in_global.carbon
  2420. // CHECK:STDOUT:
  2421. // CHECK:STDOUT: constants {
  2422. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2423. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2424. // CHECK:STDOUT: %pattern_type.69f: type = pattern_type %C [concrete]
  2425. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2426. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2427. // CHECK:STDOUT: %ptr.838: type = ptr_type %C [concrete]
  2428. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2429. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2430. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2431. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2432. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.98c: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2433. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.2f1: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.98c = struct_value () [concrete]
  2434. // CHECK:STDOUT: }
  2435. // CHECK:STDOUT:
  2436. // CHECK:STDOUT: imports {
  2437. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2438. // CHECK:STDOUT: .N = %N
  2439. // CHECK:STDOUT: import Cpp//...
  2440. // CHECK:STDOUT: }
  2441. // CHECK:STDOUT: %N: <namespace> = namespace [concrete] {
  2442. // CHECK:STDOUT: .C = %C.decl
  2443. // CHECK:STDOUT: import Cpp//...
  2444. // CHECK:STDOUT: }
  2445. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2446. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2447. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2448. // CHECK:STDOUT: <elided>
  2449. // CHECK:STDOUT: } {
  2450. // CHECK:STDOUT: <elided>
  2451. // CHECK:STDOUT: }
  2452. // CHECK:STDOUT: }
  2453. // CHECK:STDOUT:
  2454. // CHECK:STDOUT: fn @F() {
  2455. // CHECK:STDOUT: !entry:
  2456. // CHECK:STDOUT: name_binding_decl {
  2457. // CHECK:STDOUT: %c1.patt: %pattern_type.69f = value_binding_pattern c1 [concrete]
  2458. // CHECK:STDOUT: }
  2459. // CHECK:STDOUT: %Cpp.ref.loc8_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2460. // CHECK:STDOUT: %N.ref.loc8_24: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2461. // CHECK:STDOUT: %C.ref.loc8_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2462. // CHECK:STDOUT: %C.ref.loc8_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2463. // CHECK:STDOUT: %.loc8_31.1: ref %C = temporary_storage
  2464. // CHECK:STDOUT: %addr.loc8: %ptr.838 = addr_of %.loc8_31.1
  2465. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  2466. // CHECK:STDOUT: %.loc8_31.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_31.1
  2467. // CHECK:STDOUT: %.loc8_16: type = splice_block %C.ref.loc8_16 [concrete = constants.%C] {
  2468. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2469. // CHECK:STDOUT: %N.ref.loc8_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2470. // CHECK:STDOUT: %C.ref.loc8_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2471. // CHECK:STDOUT: }
  2472. // CHECK:STDOUT: %.loc8_31.3: ref %C = temporary %.loc8_31.1, %.loc8_31.2
  2473. // CHECK:STDOUT: %.loc8_31.4: %C = acquire_value %.loc8_31.3
  2474. // CHECK:STDOUT: %c1: %C = value_binding c1, %.loc8_31.4
  2475. // CHECK:STDOUT: name_binding_decl {
  2476. // CHECK:STDOUT: %c2.patt: %pattern_type.69f = value_binding_pattern c2 [concrete]
  2477. // CHECK:STDOUT: }
  2478. // CHECK:STDOUT: %Cpp.ref.loc9_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2479. // CHECK:STDOUT: %N.ref.loc9_24: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2480. // CHECK:STDOUT: %C.ref.loc9_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2481. // CHECK:STDOUT: %C.ref.loc9_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2482. // CHECK:STDOUT: %.loc9_31.1: ref %C = temporary_storage
  2483. // CHECK:STDOUT: %addr.loc9: %ptr.838 = addr_of %.loc9_31.1
  2484. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  2485. // CHECK:STDOUT: %.loc9_31.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_31.1
  2486. // CHECK:STDOUT: %.loc9_16: type = splice_block %C.ref.loc9_16 [concrete = constants.%C] {
  2487. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2488. // CHECK:STDOUT: %N.ref.loc9_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2489. // CHECK:STDOUT: %C.ref.loc9_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2490. // CHECK:STDOUT: }
  2491. // CHECK:STDOUT: %.loc9_31.3: ref %C = temporary %.loc9_31.1, %.loc9_31.2
  2492. // CHECK:STDOUT: %.loc9_31.4: %C = acquire_value %.loc9_31.3
  2493. // CHECK:STDOUT: %c2: %C = value_binding c2, %.loc9_31.4
  2494. // CHECK:STDOUT: name_binding_decl {
  2495. // CHECK:STDOUT: %c3.patt: %pattern_type.69f = value_binding_pattern c3 [concrete]
  2496. // CHECK:STDOUT: }
  2497. // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
  2498. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  2499. // CHECK:STDOUT: %.loc14: type = splice_block %C.ref.loc14 [concrete = constants.%C] {
  2500. // CHECK:STDOUT: %Cpp.ref.loc14: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2501. // CHECK:STDOUT: %N.ref.loc14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2502. // CHECK:STDOUT: %C.ref.loc14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2503. // CHECK:STDOUT: }
  2504. // CHECK:STDOUT: %c3: %C = value_binding c3, <error> [concrete = <error>]
  2505. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2f1
  2506. // CHECK:STDOUT: <elided>
  2507. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2508. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_31.3)
  2509. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.2f1
  2510. // CHECK:STDOUT: <elided>
  2511. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2512. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_31.3)
  2513. // CHECK:STDOUT: <elided>
  2514. // CHECK:STDOUT: }
  2515. // CHECK:STDOUT:
  2516. // CHECK:STDOUT: --- import_inner_class.carbon
  2517. // CHECK:STDOUT:
  2518. // CHECK:STDOUT: constants {
  2519. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2520. // CHECK:STDOUT: %O: type = class_type @O [concrete]
  2521. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2522. // CHECK:STDOUT: %pattern_type.b28: type = pattern_type %C [concrete]
  2523. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2524. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2525. // CHECK:STDOUT: %ptr.de2: type = ptr_type %C [concrete]
  2526. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2527. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2528. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2529. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2530. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2531. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2532. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.1f9: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2533. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.156: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.1f9 = struct_value () [concrete]
  2534. // CHECK:STDOUT: }
  2535. // CHECK:STDOUT:
  2536. // CHECK:STDOUT: imports {
  2537. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2538. // CHECK:STDOUT: .O = %O.decl
  2539. // CHECK:STDOUT: import Cpp//...
  2540. // CHECK:STDOUT: }
  2541. // CHECK:STDOUT: %O.decl: type = class_decl @O [concrete = constants.%O] {} {}
  2542. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2543. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2544. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2545. // CHECK:STDOUT: <elided>
  2546. // CHECK:STDOUT: } {
  2547. // CHECK:STDOUT: <elided>
  2548. // CHECK:STDOUT: }
  2549. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2550. // CHECK:STDOUT: <elided>
  2551. // CHECK:STDOUT: } {
  2552. // CHECK:STDOUT: <elided>
  2553. // CHECK:STDOUT: }
  2554. // CHECK:STDOUT: }
  2555. // CHECK:STDOUT:
  2556. // CHECK:STDOUT: fn @F() {
  2557. // CHECK:STDOUT: !entry:
  2558. // CHECK:STDOUT: name_binding_decl {
  2559. // CHECK:STDOUT: %c1.patt: %pattern_type.b28 = value_binding_pattern c1 [concrete]
  2560. // CHECK:STDOUT: }
  2561. // CHECK:STDOUT: %Cpp.ref.loc8_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2562. // CHECK:STDOUT: %O.ref.loc8_24: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2563. // CHECK:STDOUT: %C.ref.loc8_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2564. // CHECK:STDOUT: %C.ref.loc8_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2565. // CHECK:STDOUT: %.loc8_31.1: ref %C = temporary_storage
  2566. // CHECK:STDOUT: %addr.loc8: %ptr.de2 = addr_of %.loc8_31.1
  2567. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  2568. // CHECK:STDOUT: %.loc8_31.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_31.1
  2569. // CHECK:STDOUT: %.loc8_16: type = splice_block %C.ref.loc8_16 [concrete = constants.%C] {
  2570. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2571. // CHECK:STDOUT: %O.ref.loc8_14: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2572. // CHECK:STDOUT: %C.ref.loc8_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2573. // CHECK:STDOUT: }
  2574. // CHECK:STDOUT: %.loc8_31.3: ref %C = temporary %.loc8_31.1, %.loc8_31.2
  2575. // CHECK:STDOUT: %.loc8_31.4: %C = acquire_value %.loc8_31.3
  2576. // CHECK:STDOUT: %c1: %C = value_binding c1, %.loc8_31.4
  2577. // CHECK:STDOUT: name_binding_decl {
  2578. // CHECK:STDOUT: %c2.patt: %pattern_type.b28 = value_binding_pattern c2 [concrete]
  2579. // CHECK:STDOUT: }
  2580. // CHECK:STDOUT: %Cpp.ref.loc9_21: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2581. // CHECK:STDOUT: %O.ref.loc9_24: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2582. // CHECK:STDOUT: %C.ref.loc9_26: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2583. // CHECK:STDOUT: %C.ref.loc9_28: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2584. // CHECK:STDOUT: %.loc9_31.1: ref %C = temporary_storage
  2585. // CHECK:STDOUT: %addr.loc9: %ptr.de2 = addr_of %.loc9_31.1
  2586. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  2587. // CHECK:STDOUT: %.loc9_31.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_31.1
  2588. // CHECK:STDOUT: %.loc9_16: type = splice_block %C.ref.loc9_16 [concrete = constants.%C] {
  2589. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2590. // CHECK:STDOUT: %O.ref.loc9_14: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2591. // CHECK:STDOUT: %C.ref.loc9_16: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2592. // CHECK:STDOUT: }
  2593. // CHECK:STDOUT: %.loc9_31.3: ref %C = temporary %.loc9_31.1, %.loc9_31.2
  2594. // CHECK:STDOUT: %.loc9_31.4: %C = acquire_value %.loc9_31.3
  2595. // CHECK:STDOUT: %c2: %C = value_binding c2, %.loc9_31.4
  2596. // CHECK:STDOUT: name_binding_decl {
  2597. // CHECK:STDOUT: %c3.patt: %pattern_type.b28 = value_binding_pattern c3 [concrete]
  2598. // CHECK:STDOUT: }
  2599. // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
  2600. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  2601. // CHECK:STDOUT: %.loc10_24.1: ref %C = temporary_storage
  2602. // CHECK:STDOUT: %.loc10_21: ref %C = value_as_ref %c1.ref
  2603. // CHECK:STDOUT: %addr.loc10_24.1: %ptr.de2 = addr_of %.loc10_21
  2604. // CHECK:STDOUT: %.loc10_26: ref %C = value_as_ref %c2.ref
  2605. // CHECK:STDOUT: %addr.loc10_24.2: %ptr.de2 = addr_of %.loc10_26
  2606. // CHECK:STDOUT: %addr.loc10_24.3: %ptr.de2 = addr_of %.loc10_24.1
  2607. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_24.1, %addr.loc10_24.2, %addr.loc10_24.3)
  2608. // CHECK:STDOUT: %.loc10_24.2: init %C = in_place_init %operator+__carbon_thunk.call, %.loc10_24.1
  2609. // CHECK:STDOUT: %.loc10_16: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  2610. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2611. // CHECK:STDOUT: %O.ref.loc10: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2612. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2613. // CHECK:STDOUT: }
  2614. // CHECK:STDOUT: %.loc10_24.3: ref %C = temporary %.loc10_24.1, %.loc10_24.2
  2615. // CHECK:STDOUT: %.loc10_24.4: %C = acquire_value %.loc10_24.3
  2616. // CHECK:STDOUT: %c3: %C = value_binding c3, %.loc10_24.4
  2617. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_24.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.156
  2618. // CHECK:STDOUT: <elided>
  2619. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_24.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2620. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_24.3)
  2621. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.156
  2622. // CHECK:STDOUT: <elided>
  2623. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2624. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_31.3)
  2625. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_31.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.156
  2626. // CHECK:STDOUT: <elided>
  2627. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_31.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  2628. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_31.3)
  2629. // CHECK:STDOUT: <elided>
  2630. // CHECK:STDOUT: }
  2631. // CHECK:STDOUT:
  2632. // CHECK:STDOUT: --- import_inner_class_in_namespace.carbon
  2633. // CHECK:STDOUT:
  2634. // CHECK:STDOUT: constants {
  2635. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2636. // CHECK:STDOUT: %O: type = class_type @O [concrete]
  2637. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2638. // CHECK:STDOUT: %pattern_type.84b: type = pattern_type %C [concrete]
  2639. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2640. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2641. // CHECK:STDOUT: %ptr.4b2: type = ptr_type %C [concrete]
  2642. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2643. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2644. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2645. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2646. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2647. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2648. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.fb7: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2649. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.c6d: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.fb7 = struct_value () [concrete]
  2650. // CHECK:STDOUT: }
  2651. // CHECK:STDOUT:
  2652. // CHECK:STDOUT: imports {
  2653. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2654. // CHECK:STDOUT: .N = %N
  2655. // CHECK:STDOUT: import Cpp//...
  2656. // CHECK:STDOUT: }
  2657. // CHECK:STDOUT: %N: <namespace> = namespace [concrete] {
  2658. // CHECK:STDOUT: .O = %O.decl
  2659. // CHECK:STDOUT: import Cpp//...
  2660. // CHECK:STDOUT: }
  2661. // CHECK:STDOUT: %O.decl: type = class_decl @O [concrete = constants.%O] {} {}
  2662. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2663. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2664. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2665. // CHECK:STDOUT: <elided>
  2666. // CHECK:STDOUT: } {
  2667. // CHECK:STDOUT: <elided>
  2668. // CHECK:STDOUT: }
  2669. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2670. // CHECK:STDOUT: <elided>
  2671. // CHECK:STDOUT: } {
  2672. // CHECK:STDOUT: <elided>
  2673. // CHECK:STDOUT: }
  2674. // CHECK:STDOUT: }
  2675. // CHECK:STDOUT:
  2676. // CHECK:STDOUT: fn @F() {
  2677. // CHECK:STDOUT: !entry:
  2678. // CHECK:STDOUT: name_binding_decl {
  2679. // CHECK:STDOUT: %c1.patt: %pattern_type.84b = value_binding_pattern c1 [concrete]
  2680. // CHECK:STDOUT: }
  2681. // CHECK:STDOUT: %Cpp.ref.loc8_23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2682. // CHECK:STDOUT: %N.ref.loc8_26: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2683. // CHECK:STDOUT: %O.ref.loc8_28: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2684. // CHECK:STDOUT: %C.ref.loc8_30: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2685. // CHECK:STDOUT: %C.ref.loc8_32: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2686. // CHECK:STDOUT: %.loc8_35.1: ref %C = temporary_storage
  2687. // CHECK:STDOUT: %addr.loc8: %ptr.4b2 = addr_of %.loc8_35.1
  2688. // CHECK:STDOUT: %C__carbon_thunk.call.loc8: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  2689. // CHECK:STDOUT: %.loc8_35.2: init %C = in_place_init %C__carbon_thunk.call.loc8, %.loc8_35.1
  2690. // CHECK:STDOUT: %.loc8_18: type = splice_block %C.ref.loc8_18 [concrete = constants.%C] {
  2691. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2692. // CHECK:STDOUT: %N.ref.loc8_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2693. // CHECK:STDOUT: %O.ref.loc8_16: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2694. // CHECK:STDOUT: %C.ref.loc8_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2695. // CHECK:STDOUT: }
  2696. // CHECK:STDOUT: %.loc8_35.3: ref %C = temporary %.loc8_35.1, %.loc8_35.2
  2697. // CHECK:STDOUT: %.loc8_35.4: %C = acquire_value %.loc8_35.3
  2698. // CHECK:STDOUT: %c1: %C = value_binding c1, %.loc8_35.4
  2699. // CHECK:STDOUT: name_binding_decl {
  2700. // CHECK:STDOUT: %c2.patt: %pattern_type.84b = value_binding_pattern c2 [concrete]
  2701. // CHECK:STDOUT: }
  2702. // CHECK:STDOUT: %Cpp.ref.loc9_23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2703. // CHECK:STDOUT: %N.ref.loc9_26: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2704. // CHECK:STDOUT: %O.ref.loc9_28: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2705. // CHECK:STDOUT: %C.ref.loc9_30: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2706. // CHECK:STDOUT: %C.ref.loc9_32: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2707. // CHECK:STDOUT: %.loc9_35.1: ref %C = temporary_storage
  2708. // CHECK:STDOUT: %addr.loc9: %ptr.4b2 = addr_of %.loc9_35.1
  2709. // CHECK:STDOUT: %C__carbon_thunk.call.loc9: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc9)
  2710. // CHECK:STDOUT: %.loc9_35.2: init %C = in_place_init %C__carbon_thunk.call.loc9, %.loc9_35.1
  2711. // CHECK:STDOUT: %.loc9_18: type = splice_block %C.ref.loc9_18 [concrete = constants.%C] {
  2712. // CHECK:STDOUT: %Cpp.ref.loc9_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2713. // CHECK:STDOUT: %N.ref.loc9_14: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2714. // CHECK:STDOUT: %O.ref.loc9_16: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2715. // CHECK:STDOUT: %C.ref.loc9_18: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2716. // CHECK:STDOUT: }
  2717. // CHECK:STDOUT: %.loc9_35.3: ref %C = temporary %.loc9_35.1, %.loc9_35.2
  2718. // CHECK:STDOUT: %.loc9_35.4: %C = acquire_value %.loc9_35.3
  2719. // CHECK:STDOUT: %c2: %C = value_binding c2, %.loc9_35.4
  2720. // CHECK:STDOUT: name_binding_decl {
  2721. // CHECK:STDOUT: %c3.patt: %pattern_type.84b = value_binding_pattern c3 [concrete]
  2722. // CHECK:STDOUT: }
  2723. // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
  2724. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  2725. // CHECK:STDOUT: %.loc10_26.1: ref %C = temporary_storage
  2726. // CHECK:STDOUT: %.loc10_23: ref %C = value_as_ref %c1.ref
  2727. // CHECK:STDOUT: %addr.loc10_26.1: %ptr.4b2 = addr_of %.loc10_23
  2728. // CHECK:STDOUT: %.loc10_28: ref %C = value_as_ref %c2.ref
  2729. // CHECK:STDOUT: %addr.loc10_26.2: %ptr.4b2 = addr_of %.loc10_28
  2730. // CHECK:STDOUT: %addr.loc10_26.3: %ptr.4b2 = addr_of %.loc10_26.1
  2731. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_26.1, %addr.loc10_26.2, %addr.loc10_26.3)
  2732. // CHECK:STDOUT: %.loc10_26.2: init %C = in_place_init %operator+__carbon_thunk.call, %.loc10_26.1
  2733. // CHECK:STDOUT: %.loc10_18: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  2734. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2735. // CHECK:STDOUT: %N.ref.loc10: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  2736. // CHECK:STDOUT: %O.ref.loc10: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  2737. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2738. // CHECK:STDOUT: }
  2739. // CHECK:STDOUT: %.loc10_26.3: ref %C = temporary %.loc10_26.1, %.loc10_26.2
  2740. // CHECK:STDOUT: %.loc10_26.4: %C = acquire_value %.loc10_26.3
  2741. // CHECK:STDOUT: %c3: %C = value_binding c3, %.loc10_26.4
  2742. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_26.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.c6d
  2743. // CHECK:STDOUT: <elided>
  2744. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_26.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2745. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_26.3)
  2746. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %.loc9_35.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.c6d
  2747. // CHECK:STDOUT: <elided>
  2748. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %.loc9_35.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2749. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%.loc9_35.3)
  2750. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_35.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.c6d
  2751. // CHECK:STDOUT: <elided>
  2752. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_35.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  2753. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%.loc8_35.3)
  2754. // CHECK:STDOUT: <elided>
  2755. // CHECK:STDOUT: }
  2756. // CHECK:STDOUT:
  2757. // CHECK:STDOUT: --- import_member_add_with.carbon
  2758. // CHECK:STDOUT:
  2759. // CHECK:STDOUT: constants {
  2760. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2761. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2762. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  2763. // CHECK:STDOUT: %C.C.cpp_overload_set.type: type = cpp_overload_set_type @C.C.cpp_overload_set [concrete]
  2764. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete]
  2765. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  2766. // CHECK:STDOUT: %C__carbon_thunk.type: type = fn_type @C__carbon_thunk [concrete]
  2767. // CHECK:STDOUT: %C__carbon_thunk: %C__carbon_thunk.type = struct_value () [concrete]
  2768. // CHECK:STDOUT: %C.cpp_operator.type.dab96a.1: type = fn_type @C.cpp_operator.1 [concrete]
  2769. // CHECK:STDOUT: %C.cpp_operator.d21c75.1: %C.cpp_operator.type.dab96a.1 = struct_value () [concrete]
  2770. // CHECK:STDOUT: %operator-__carbon_thunk.type: type = fn_type @operator-__carbon_thunk [concrete]
  2771. // CHECK:STDOUT: %operator-__carbon_thunk: %operator-__carbon_thunk.type = struct_value () [concrete]
  2772. // CHECK:STDOUT: %C.cpp_operator.type.dab96a.2: type = fn_type @C.cpp_operator.2 [concrete]
  2773. // CHECK:STDOUT: %C.cpp_operator.d21c75.2: %C.cpp_operator.type.dab96a.2 = struct_value () [concrete]
  2774. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2775. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2776. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2777. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2778. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2779. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  2780. // CHECK:STDOUT: }
  2781. // CHECK:STDOUT:
  2782. // CHECK:STDOUT: imports {
  2783. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2784. // CHECK:STDOUT: .C = %C.decl
  2785. // CHECK:STDOUT: import Cpp//...
  2786. // CHECK:STDOUT: }
  2787. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2788. // CHECK:STDOUT: %C.C.cpp_overload_set.value: %C.C.cpp_overload_set.type = cpp_overload_set_value @C.C.cpp_overload_set [concrete = constants.%C.C.cpp_overload_set.value]
  2789. // CHECK:STDOUT: %C__carbon_thunk.decl: %C__carbon_thunk.type = fn_decl @C__carbon_thunk [concrete = constants.%C__carbon_thunk] {
  2790. // CHECK:STDOUT: <elided>
  2791. // CHECK:STDOUT: } {
  2792. // CHECK:STDOUT: <elided>
  2793. // CHECK:STDOUT: }
  2794. // CHECK:STDOUT: %C.cpp_operator.decl.828f43.1: %C.cpp_operator.type.dab96a.1 = fn_decl @C.cpp_operator.1 [concrete = constants.%C.cpp_operator.d21c75.1] {
  2795. // CHECK:STDOUT: %self.patt: %pattern_type.217 = ref_binding_pattern self [concrete]
  2796. // CHECK:STDOUT: %self.param_patt: %pattern_type.217 = ref_param_pattern %self.patt, call_param0 [concrete]
  2797. // CHECK:STDOUT: <elided>
  2798. // CHECK:STDOUT: } {
  2799. // CHECK:STDOUT: %self.param: ref %C = ref_param call_param0
  2800. // CHECK:STDOUT: %self: ref %C = ref_binding self, %self.param
  2801. // CHECK:STDOUT: <elided>
  2802. // CHECK:STDOUT: }
  2803. // CHECK:STDOUT: %operator-__carbon_thunk.decl: %operator-__carbon_thunk.type = fn_decl @operator-__carbon_thunk [concrete = constants.%operator-__carbon_thunk] {
  2804. // CHECK:STDOUT: <elided>
  2805. // CHECK:STDOUT: } {
  2806. // CHECK:STDOUT: <elided>
  2807. // CHECK:STDOUT: }
  2808. // CHECK:STDOUT: %C.cpp_operator.decl.828f43.2: %C.cpp_operator.type.dab96a.2 = fn_decl @C.cpp_operator.2 [concrete = constants.%C.cpp_operator.d21c75.2] {
  2809. // CHECK:STDOUT: %self.patt: %pattern_type.217 = ref_binding_pattern self [concrete]
  2810. // CHECK:STDOUT: %self.param_patt: %pattern_type.217 = ref_param_pattern %self.patt, call_param0 [concrete]
  2811. // CHECK:STDOUT: <elided>
  2812. // CHECK:STDOUT: } {
  2813. // CHECK:STDOUT: %self.param: ref %C = ref_param call_param0
  2814. // CHECK:STDOUT: %self: ref %C = ref_binding self, %self.param
  2815. // CHECK:STDOUT: <elided>
  2816. // CHECK:STDOUT: }
  2817. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2818. // CHECK:STDOUT: <elided>
  2819. // CHECK:STDOUT: } {
  2820. // CHECK:STDOUT: <elided>
  2821. // CHECK:STDOUT: }
  2822. // CHECK:STDOUT: }
  2823. // CHECK:STDOUT:
  2824. // CHECK:STDOUT: fn @F() {
  2825. // CHECK:STDOUT: !entry:
  2826. // CHECK:STDOUT: name_binding_decl {
  2827. // CHECK:STDOUT: %c1.patt: %pattern_type.217 = ref_binding_pattern c1 [concrete]
  2828. // CHECK:STDOUT: %c1.var_patt: %pattern_type.217 = var_pattern %c1.patt [concrete]
  2829. // CHECK:STDOUT: }
  2830. // CHECK:STDOUT: %c1.var: ref %C = var %c1.var_patt
  2831. // CHECK:STDOUT: %Cpp.ref.loc8_19: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2832. // CHECK:STDOUT: %C.ref.loc8_22: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2833. // CHECK:STDOUT: %C.ref.loc8_24: %C.C.cpp_overload_set.type = name_ref C, imports.%C.C.cpp_overload_set.value [concrete = constants.%C.C.cpp_overload_set.value]
  2834. // CHECK:STDOUT: %.loc8_3: ref %C = splice_block %c1.var {}
  2835. // CHECK:STDOUT: %addr.loc8: %ptr.d9e = addr_of %.loc8_3
  2836. // CHECK:STDOUT: %C__carbon_thunk.call: init %empty_tuple.type = call imports.%C__carbon_thunk.decl(%addr.loc8)
  2837. // CHECK:STDOUT: %.loc8_27: init %C = in_place_init %C__carbon_thunk.call, %.loc8_3
  2838. // CHECK:STDOUT: assign %c1.var, %.loc8_27
  2839. // CHECK:STDOUT: %.loc8_14: type = splice_block %C.ref.loc8_14 [concrete = constants.%C] {
  2840. // CHECK:STDOUT: %Cpp.ref.loc8_11: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2841. // CHECK:STDOUT: %C.ref.loc8_14: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2842. // CHECK:STDOUT: }
  2843. // CHECK:STDOUT: %c1: ref %C = ref_binding c1, %c1.var
  2844. // CHECK:STDOUT: name_binding_decl {
  2845. // CHECK:STDOUT: %c2.patt: %pattern_type.217 = ref_binding_pattern c2 [concrete]
  2846. // CHECK:STDOUT: %c2.var_patt: %pattern_type.217 = var_pattern %c2.patt [concrete]
  2847. // CHECK:STDOUT: }
  2848. // CHECK:STDOUT: %c2.var: ref %C = var %c2.var_patt
  2849. // CHECK:STDOUT: %c1.ref.loc9: ref %C = name_ref c1, %c1
  2850. // CHECK:STDOUT: %C.cpp_operator.bound.loc9: <bound method> = bound_method %c1.ref.loc9, imports.%C.cpp_operator.decl.828f43.1
  2851. // CHECK:STDOUT: %.loc9_3: ref %C = splice_block %c2.var {}
  2852. // CHECK:STDOUT: %addr.loc9: %ptr.d9e = addr_of %.loc9_3
  2853. // CHECK:STDOUT: %operator-__carbon_thunk.call: init %empty_tuple.type = call imports.%operator-__carbon_thunk.decl(%c1.ref.loc9, %addr.loc9)
  2854. // CHECK:STDOUT: %.loc9_19: init %C = in_place_init %operator-__carbon_thunk.call, %.loc9_3
  2855. // CHECK:STDOUT: assign %c2.var, %.loc9_19
  2856. // CHECK:STDOUT: %.loc9_14: type = splice_block %C.ref.loc9 [concrete = constants.%C] {
  2857. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2858. // CHECK:STDOUT: %C.ref.loc9: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2859. // CHECK:STDOUT: }
  2860. // CHECK:STDOUT: %c2: ref %C = ref_binding c2, %c2.var
  2861. // CHECK:STDOUT: name_binding_decl {
  2862. // CHECK:STDOUT: %c3.patt: %pattern_type.217 = ref_binding_pattern c3 [concrete]
  2863. // CHECK:STDOUT: %c3.var_patt: %pattern_type.217 = var_pattern %c3.patt [concrete]
  2864. // CHECK:STDOUT: }
  2865. // CHECK:STDOUT: %c3.var: ref %C = var %c3.var_patt
  2866. // CHECK:STDOUT: %c1.ref.loc10: ref %C = name_ref c1, %c1
  2867. // CHECK:STDOUT: %c2.ref: ref %C = name_ref c2, %c2
  2868. // CHECK:STDOUT: %C.cpp_operator.bound.loc10: <bound method> = bound_method %c1.ref.loc10, imports.%C.cpp_operator.decl.828f43.2
  2869. // CHECK:STDOUT: %.loc10_3: ref %C = splice_block %c3.var {}
  2870. // CHECK:STDOUT: %.loc10_24.1: %C = acquire_value %c2.ref
  2871. // CHECK:STDOUT: %.loc10_24.2: ref %C = value_as_ref %.loc10_24.1
  2872. // CHECK:STDOUT: %addr.loc10_22.1: %ptr.d9e = addr_of %.loc10_24.2
  2873. // CHECK:STDOUT: %addr.loc10_22.2: %ptr.d9e = addr_of %.loc10_3
  2874. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%c1.ref.loc10, %addr.loc10_22.1, %addr.loc10_22.2)
  2875. // CHECK:STDOUT: %.loc10_22: init %C = in_place_init %operator+__carbon_thunk.call, %.loc10_3
  2876. // CHECK:STDOUT: assign %c3.var, %.loc10_22
  2877. // CHECK:STDOUT: %.loc10_14: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  2878. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2879. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2880. // CHECK:STDOUT: }
  2881. // CHECK:STDOUT: %c3: ref %C = ref_binding c3, %c3.var
  2882. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %c3.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2883. // CHECK:STDOUT: <elided>
  2884. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %c3.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2885. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%c3.var)
  2886. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %c2.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2887. // CHECK:STDOUT: <elided>
  2888. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %c2.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.2
  2889. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%c2.var)
  2890. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %c1.var, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2891. // CHECK:STDOUT: <elided>
  2892. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %c1.var, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.3
  2893. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%c1.var)
  2894. // CHECK:STDOUT: <elided>
  2895. // CHECK:STDOUT: }
  2896. // CHECK:STDOUT:
  2897. // CHECK:STDOUT: --- indirect_template_instantiation.carbon
  2898. // CHECK:STDOUT:
  2899. // CHECK:STDOUT: constants {
  2900. // CHECK:STDOUT: %B: type = class_type @B [concrete]
  2901. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  2902. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  2903. // CHECK:STDOUT: %ptr.a04: type = ptr_type %B [concrete]
  2904. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2905. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2906. // CHECK:STDOUT: }
  2907. // CHECK:STDOUT:
  2908. // CHECK:STDOUT: imports {
  2909. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2910. // CHECK:STDOUT: <elided>
  2911. // CHECK:STDOUT: } {
  2912. // CHECK:STDOUT: <elided>
  2913. // CHECK:STDOUT: }
  2914. // CHECK:STDOUT: }
  2915. // CHECK:STDOUT:
  2916. // CHECK:STDOUT: fn @F(%x.param: %B) -> %i32 {
  2917. // CHECK:STDOUT: !entry:
  2918. // CHECK:STDOUT: %x.ref.loc14_10: %B = name_ref x, %x
  2919. // CHECK:STDOUT: %x.ref.loc14_14: %B = name_ref x, %x
  2920. // CHECK:STDOUT: %.loc14_10: ref %B = value_as_ref %x.ref.loc14_10
  2921. // CHECK:STDOUT: %addr.loc14_12.1: %ptr.a04 = addr_of %.loc14_10
  2922. // CHECK:STDOUT: %.loc14_14: ref %B = value_as_ref %x.ref.loc14_14
  2923. // CHECK:STDOUT: %addr.loc14_12.2: %ptr.a04 = addr_of %.loc14_14
  2924. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %i32 = call imports.%operator+__carbon_thunk.decl(%addr.loc14_12.1, %addr.loc14_12.2)
  2925. // CHECK:STDOUT: return %operator+__carbon_thunk.call to %return
  2926. // CHECK:STDOUT: }
  2927. // CHECK:STDOUT:
  2928. // CHECK:STDOUT: --- import_overloading.carbon
  2929. // CHECK:STDOUT:
  2930. // CHECK:STDOUT: constants {
  2931. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  2932. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  2933. // CHECK:STDOUT: %pattern_type.217: type = pattern_type %C [concrete]
  2934. // CHECK:STDOUT: %ptr.d9e: type = ptr_type %C [concrete]
  2935. // CHECK:STDOUT: %operator+__carbon_thunk.type: type = fn_type @operator+__carbon_thunk [concrete]
  2936. // CHECK:STDOUT: %operator+__carbon_thunk: %operator+__carbon_thunk.type = struct_value () [concrete]
  2937. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanDestroy>> [concrete]
  2938. // CHECK:STDOUT: %facet_value: %type_where = facet_value %C, () [concrete]
  2939. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248: type = fn_type @DestroyT.binding.as_type.as.Destroy.impl.Op, @DestroyT.binding.as_type.as.Destroy.impl(%facet_value) [concrete]
  2940. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.f77: %DestroyT.binding.as_type.as.Destroy.impl.Op.type.248 = struct_value () [concrete]
  2941. // CHECK:STDOUT: }
  2942. // CHECK:STDOUT:
  2943. // CHECK:STDOUT: imports {
  2944. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  2945. // CHECK:STDOUT: .C = %C.decl
  2946. // CHECK:STDOUT: import Cpp//...
  2947. // CHECK:STDOUT: }
  2948. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  2949. // CHECK:STDOUT: %operator+__carbon_thunk.decl: %operator+__carbon_thunk.type = fn_decl @operator+__carbon_thunk [concrete = constants.%operator+__carbon_thunk] {
  2950. // CHECK:STDOUT: <elided>
  2951. // CHECK:STDOUT: } {
  2952. // CHECK:STDOUT: <elided>
  2953. // CHECK:STDOUT: }
  2954. // CHECK:STDOUT: }
  2955. // CHECK:STDOUT:
  2956. // CHECK:STDOUT: fn @F() {
  2957. // CHECK:STDOUT: !entry:
  2958. // CHECK:STDOUT: <elided>
  2959. // CHECK:STDOUT: name_binding_decl {
  2960. // CHECK:STDOUT: %c3.patt: %pattern_type.217 = value_binding_pattern c3 [concrete]
  2961. // CHECK:STDOUT: }
  2962. // CHECK:STDOUT: %c1.ref: %C = name_ref c1, %c1
  2963. // CHECK:STDOUT: %c2.ref: %C = name_ref c2, %c2
  2964. // CHECK:STDOUT: %.loc10_22.1: ref %C = temporary_storage
  2965. // CHECK:STDOUT: %.loc10_19: ref %C = value_as_ref %c1.ref
  2966. // CHECK:STDOUT: %addr.loc10_22.1: %ptr.d9e = addr_of %.loc10_19
  2967. // CHECK:STDOUT: %.loc10_24: ref %C = value_as_ref %c2.ref
  2968. // CHECK:STDOUT: %addr.loc10_22.2: %ptr.d9e = addr_of %.loc10_24
  2969. // CHECK:STDOUT: %addr.loc10_22.3: %ptr.d9e = addr_of %.loc10_22.1
  2970. // CHECK:STDOUT: %operator+__carbon_thunk.call: init %empty_tuple.type = call imports.%operator+__carbon_thunk.decl(%addr.loc10_22.1, %addr.loc10_22.2, %addr.loc10_22.3)
  2971. // CHECK:STDOUT: %.loc10_22.2: init %C = in_place_init %operator+__carbon_thunk.call, %.loc10_22.1
  2972. // CHECK:STDOUT: %.loc10_14: type = splice_block %C.ref.loc10 [concrete = constants.%C] {
  2973. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  2974. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, imports.%C.decl [concrete = constants.%C]
  2975. // CHECK:STDOUT: }
  2976. // CHECK:STDOUT: %.loc10_22.3: ref %C = temporary %.loc10_22.1, %.loc10_22.2
  2977. // CHECK:STDOUT: %.loc10_22.4: %C = acquire_value %.loc10_22.3
  2978. // CHECK:STDOUT: %c3: %C = value_binding c3, %.loc10_22.4
  2979. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %.loc10_22.3, constants.%DestroyT.binding.as_type.as.Destroy.impl.Op.f77
  2980. // CHECK:STDOUT: <elided>
  2981. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %.loc10_22.3, %DestroyT.binding.as_type.as.Destroy.impl.Op.specific_fn.1
  2982. // CHECK:STDOUT: %DestroyT.binding.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%.loc10_22.3)
  2983. // CHECK:STDOUT: <elided>
  2984. // CHECK:STDOUT: }
  2985. // CHECK:STDOUT: