implicit_as.carbon 108 KB

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