struct.carbon 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251
  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/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/function/struct.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/function/struct.carbon
  12. // ============================================================================
  13. // Forward-declared struct as parameter type
  14. // ============================================================================
  15. // --- decl_value_param_type.h
  16. struct S;
  17. auto foo(S) -> void;
  18. // --- fail_import_decl_value_param_type.carbon
  19. library "[[@TEST_NAME]]";
  20. import Cpp library "decl_value_param_type.h";
  21. fn F() {
  22. // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE+8]]:11: error: invalid use of incomplete type `Cpp.S` [IncompleteTypeInConversion]
  23. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  24. // CHECK:STDERR: ^~~~~~~~~~~
  25. // CHECK:STDERR: fail_import_decl_value_param_type.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  26. // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  27. // CHECK:STDERR: struct S;
  28. // CHECK:STDERR: ^
  29. // CHECK:STDERR:
  30. Cpp.foo({} as Cpp.S);
  31. }
  32. // --- fail_import_decl_value_param_type_previously_imported.carbon
  33. library "[[@TEST_NAME]]";
  34. import Cpp library "decl_value_param_type.h";
  35. fn F() {
  36. // CHECK:STDERR: fail_import_decl_value_param_type_previously_imported.carbon:[[@LINE+12]]:10: error: binding pattern has incomplete type `S` in name binding declaration [IncompleteTypeInBindingDecl]
  37. // CHECK:STDERR: let s: Cpp.S;
  38. // CHECK:STDERR: ^~~~~
  39. // CHECK:STDERR: fail_import_decl_value_param_type_previously_imported.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  40. // CHECK:STDERR: ./decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  41. // CHECK:STDERR: struct S;
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR:
  44. // CHECK:STDERR: fail_import_decl_value_param_type_previously_imported.carbon:[[@LINE+4]]:15: error: expected `=`; `let` declaration must have an initializer [ExpectedInitializerAfterLet]
  45. // CHECK:STDERR: let s: Cpp.S;
  46. // CHECK:STDERR: ^
  47. // CHECK:STDERR:
  48. let s: Cpp.S;
  49. Cpp.foo(s);
  50. }
  51. // ============================================================================
  52. // Forward-declared struct as parameter type imported twice
  53. // ============================================================================
  54. // --- double_decl_value_param_type.h
  55. struct S;
  56. auto foo1(S) -> void;
  57. auto foo2(S) -> void;
  58. // --- fail_import_double_decl_value_param_type.carbon
  59. library "[[@TEST_NAME]]";
  60. import Cpp library "double_decl_value_param_type.h";
  61. fn F() {
  62. // CHECK:STDERR: fail_import_double_decl_value_param_type.carbon:[[@LINE+8]]:12: error: invalid use of incomplete type `Cpp.S` [IncompleteTypeInConversion]
  63. // CHECK:STDERR: Cpp.foo1({} as Cpp.S);
  64. // CHECK:STDERR: ^~~~~~~~~~~
  65. // CHECK:STDERR: fail_import_double_decl_value_param_type.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  66. // CHECK:STDERR: ./double_decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  67. // CHECK:STDERR: struct S;
  68. // CHECK:STDERR: ^
  69. // CHECK:STDERR:
  70. Cpp.foo1({} as Cpp.S);
  71. // CHECK:STDERR: fail_import_double_decl_value_param_type.carbon:[[@LINE+8]]:12: error: invalid use of incomplete type `Cpp.S` [IncompleteTypeInConversion]
  72. // CHECK:STDERR: Cpp.foo2({} as Cpp.S);
  73. // CHECK:STDERR: ^~~~~~~~~~~
  74. // CHECK:STDERR: fail_import_double_decl_value_param_type.carbon:[[@LINE-15]]:10: in file included here [InCppInclude]
  75. // CHECK:STDERR: ./double_decl_value_param_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  76. // CHECK:STDERR: struct S;
  77. // CHECK:STDERR: ^
  78. // CHECK:STDERR:
  79. Cpp.foo2({} as Cpp.S);
  80. }
  81. // ============================================================================
  82. // Defined struct without data members as parameter type
  83. // ============================================================================
  84. // --- definition_no_data_members_value_param_type.h
  85. struct S {};
  86. auto foo(S) -> void;
  87. // --- import_definition_no_data_members_value_param_type.carbon
  88. library "[[@TEST_NAME]]";
  89. import Cpp library "definition_no_data_members_value_param_type.h";
  90. fn F() {
  91. //@dump-sem-ir-begin
  92. Cpp.foo({} as Cpp.S);
  93. //@dump-sem-ir-end
  94. }
  95. // ============================================================================
  96. // Non copyable struct as parameter type
  97. // ============================================================================
  98. // --- non_copyable_param_type.h
  99. struct S {
  100. S(const S&) = delete;
  101. };
  102. auto foo(S) -> void;
  103. // --- fail_import_non_copyable_param_type.carbon
  104. library "[[@TEST_NAME]]";
  105. // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
  106. // CHECK:STDERR: ./non_copyable_param_type.h:6:6: error: call to deleted constructor of 'S' [CppInteropParseError]
  107. // CHECK:STDERR: 6 | auto foo(S) -> void;
  108. // CHECK:STDERR: | ^~~
  109. // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
  110. // CHECK:STDERR: ./non_copyable_param_type.h:3:3: note: 'S' has been explicitly marked deleted here [CppInteropParseNote]
  111. // CHECK:STDERR: 3 | S(const S&) = delete;
  112. // CHECK:STDERR: | ^
  113. // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
  114. // CHECK:STDERR: ./non_copyable_param_type.h:6:11: note: passing argument to parameter here [CppInteropParseNote]
  115. // CHECK:STDERR: 6 | auto foo(S) -> void;
  116. // CHECK:STDERR: | ^
  117. import Cpp library "non_copyable_param_type.h";
  118. fn F() {
  119. //@dump-sem-ir-begin
  120. // CHECK:STDERR: fail_import_non_copyable_param_type.carbon:[[@LINE+4]]:3: note: in thunk for C++ function used here [InCppThunk]
  121. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  122. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  123. // CHECK:STDERR:
  124. Cpp.foo({} as Cpp.S);
  125. //@dump-sem-ir-end
  126. }
  127. // ============================================================================
  128. // Defined struct with a single data member as parameter type
  129. // ============================================================================
  130. // --- definition_single_data_member_value_param_type.h
  131. struct D {};
  132. struct S {
  133. D d;
  134. };
  135. auto foo(S) -> void;
  136. // --- fail_todo_import_definition_single_data_member_value_param_type.carbon
  137. library "[[@TEST_NAME]]";
  138. import Cpp library "definition_single_data_member_value_param_type.h";
  139. fn F() {
  140. //@dump-sem-ir-begin
  141. // CHECK:STDERR: fail_todo_import_definition_single_data_member_value_param_type.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `{}` to `Cpp.S` with `as` [ConversionFailure]
  142. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  143. // CHECK:STDERR: ^~~~~~~~~~~
  144. // CHECK:STDERR: fail_todo_import_definition_single_data_member_value_param_type.carbon:[[@LINE+4]]:11: note: type `{}` does not implement interface `Core.As(Cpp.S)` [MissingImplInMemberAccessNote]
  145. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  146. // CHECK:STDERR: ^~~~~~~~~~~
  147. // CHECK:STDERR:
  148. Cpp.foo({} as Cpp.S);
  149. //@dump-sem-ir-end
  150. }
  151. // ============================================================================
  152. // Defined struct with multiple data members as parameter type
  153. // ============================================================================
  154. // --- definition_multiple_data_members_value_param_type.h
  155. struct D {};
  156. struct S {
  157. D d1;
  158. D d2;
  159. D d3;
  160. };
  161. auto foo(S) -> void;
  162. // --- fail_todo_import_definition_multiple_data_members_value_param_type.carbon
  163. library "[[@TEST_NAME]]";
  164. import Cpp library "definition_multiple_data_members_value_param_type.h";
  165. fn F() {
  166. //@dump-sem-ir-begin
  167. // CHECK:STDERR: fail_todo_import_definition_multiple_data_members_value_param_type.carbon:[[@LINE+7]]:11: error: cannot convert expression of type `{}` to `Cpp.S` with `as` [ConversionFailure]
  168. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  169. // CHECK:STDERR: ^~~~~~~~~~~
  170. // CHECK:STDERR: fail_todo_import_definition_multiple_data_members_value_param_type.carbon:[[@LINE+4]]:11: note: type `{}` does not implement interface `Core.As(Cpp.S)` [MissingImplInMemberAccessNote]
  171. // CHECK:STDERR: Cpp.foo({} as Cpp.S);
  172. // CHECK:STDERR: ^~~~~~~~~~~
  173. // CHECK:STDERR:
  174. Cpp.foo({} as Cpp.S);
  175. //@dump-sem-ir-end
  176. }
  177. // ============================================================================
  178. // Defined struct in namespace
  179. // ============================================================================
  180. // --- definition_in_namespace_value_param_type.h
  181. namespace N { struct S {}; }
  182. auto foo(N::S) -> void;
  183. // --- import_definition_in_namespace_value_param_type.carbon
  184. library "[[@TEST_NAME]]";
  185. import Cpp library "definition_in_namespace_value_param_type.h";
  186. fn F() {
  187. //@dump-sem-ir-begin
  188. Cpp.foo({} as Cpp.N.S);
  189. // Check that the parameter type was imported correctly.
  190. var x: Cpp.N.S;
  191. //@dump-sem-ir-end
  192. }
  193. // ============================================================================
  194. // Defined struct in relative namespace
  195. // ============================================================================
  196. // --- definition_in_relative_namespace_value_param_type.h
  197. namespace N1 {
  198. namespace N2 { struct S {}; }
  199. auto foo(N2::S) -> void;
  200. }
  201. // --- import_definition_in_relative_namespace_value_param_type.carbon
  202. library "[[@TEST_NAME]]";
  203. import Cpp library "definition_in_relative_namespace_value_param_type.h";
  204. fn F() {
  205. //@dump-sem-ir-begin
  206. Cpp.N1.foo({} as Cpp.N1.N2.S);
  207. //@dump-sem-ir-end
  208. }
  209. // ============================================================================
  210. // Defined struct in struct
  211. // ============================================================================
  212. // --- definition_in_outer_definition.h
  213. struct O {
  214. struct S {};
  215. };
  216. auto foo(O::S) -> void;
  217. // --- import_definition_in_outer_definition.carbon
  218. library "[[@TEST_NAME]]";
  219. import Cpp library "definition_in_outer_definition.h";
  220. fn F() {
  221. //@dump-sem-ir-begin
  222. Cpp.foo({} as Cpp.O.S);
  223. var x: Cpp.O;
  224. //@dump-sem-ir-end
  225. }
  226. // ============================================================================
  227. // Defined struct and explicitly used
  228. // ============================================================================
  229. // --- definition_with_static_method.h
  230. struct S {
  231. static void bar();
  232. };
  233. auto foo(S) -> void;
  234. // --- import_definition_and_static_method_call_before.carbon
  235. library "[[@TEST_NAME]]";
  236. import Cpp library "definition_with_static_method.h";
  237. fn F() {
  238. //@dump-sem-ir-begin
  239. Cpp.S.bar();
  240. Cpp.foo({} as Cpp.S);
  241. //@dump-sem-ir-end
  242. }
  243. // --- import_definition_and_static_method_call_after.carbon
  244. library "[[@TEST_NAME]]";
  245. import Cpp library "definition_with_static_method.h";
  246. fn F() {
  247. //@dump-sem-ir-begin
  248. Cpp.foo({} as Cpp.S);
  249. Cpp.S.bar();
  250. //@dump-sem-ir-end
  251. }
  252. // ============================================================================
  253. // Incomplete struct
  254. // ============================================================================
  255. // --- incomplete.h
  256. struct Incomplete;
  257. // --- fail_import_incomplete.carbon
  258. library "[[@TEST_NAME]]";
  259. import Cpp library "incomplete.h";
  260. fn F() {
  261. // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE+8]]:3: error: member access into incomplete class `Cpp.Incomplete` [QualifiedExprInIncompleteClassScope]
  262. // CHECK:STDERR: Cpp.Incomplete.foo();
  263. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  264. // CHECK:STDERR: fail_import_incomplete.carbon:[[@LINE-6]]:10: in file included here [InCppInclude]
  265. // CHECK:STDERR: ./incomplete.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  266. // CHECK:STDERR: struct Incomplete;
  267. // CHECK:STDERR: ^
  268. // CHECK:STDERR:
  269. Cpp.Incomplete.foo();
  270. }
  271. // ============================================================================
  272. // Pointer to forward-declared struct as parameter type
  273. // ============================================================================
  274. // --- decl_pointer_param_type.h
  275. struct S;
  276. auto foo(S* _Nonnull) -> void;
  277. // --- import_decl_pointer_param_type.carbon
  278. library "[[@TEST_NAME]]";
  279. import Cpp library "decl_pointer_param_type.h";
  280. fn F(s: Cpp.S*) {
  281. //@dump-sem-ir-begin
  282. Cpp.foo(s);
  283. //@dump-sem-ir-end
  284. }
  285. // ============================================================================
  286. // Pointer to defined struct as parameter type
  287. // ============================================================================
  288. // --- definition_pointer_param_type.h
  289. struct S {};
  290. auto foo(S* _Nonnull) -> void;
  291. // --- import_definition_pointer_param_type.carbon
  292. library "[[@TEST_NAME]]";
  293. import Cpp library "definition_pointer_param_type.h";
  294. fn F(s: Cpp.S*) {
  295. //@dump-sem-ir-begin
  296. Cpp.foo(s);
  297. //@dump-sem-ir-end
  298. }
  299. // ============================================================================
  300. // Forward-declared struct as return type
  301. // ============================================================================
  302. // --- decl_value_return_type.h
  303. struct S;
  304. auto foo() -> S;
  305. // --- fail_import_decl_value_return_type.carbon
  306. library "[[@TEST_NAME]]";
  307. // TODO: We should only produce one error here.
  308. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+12]]:10: in file included here [InCppInclude]
  309. // CHECK:STDERR: ./decl_value_return_type.h:4:6: error: calling 'foo' with incomplete return type 'S' [CppInteropParseError]
  310. // CHECK:STDERR: 4 | auto foo() -> S;
  311. // CHECK:STDERR: | ^~~
  312. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+8]]:10: in file included here [InCppInclude]
  313. // CHECK:STDERR: ./decl_value_return_type.h:4:6: note: 'foo' declared here [CppInteropParseNote]
  314. // CHECK:STDERR: 4 | auto foo() -> S;
  315. // CHECK:STDERR: | ^
  316. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+4]]:10: in file included here [InCppInclude]
  317. // CHECK:STDERR: ./decl_value_return_type.h:2:8: note: forward declaration of 'S' [CppInteropParseNote]
  318. // CHECK:STDERR: 2 | struct S;
  319. // CHECK:STDERR: | ^
  320. import Cpp library "decl_value_return_type.h";
  321. fn F() {
  322. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+13]]:3: note: in thunk for C++ function used here [InCppThunk]
  323. // CHECK:STDERR: Cpp.foo();
  324. // CHECK:STDERR: ^~~~~~~~~
  325. // CHECK:STDERR:
  326. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE+9]]:3: error: function returns incomplete type `Cpp.S` [IncompleteTypeInFunctionReturnType]
  327. // CHECK:STDERR: Cpp.foo();
  328. // CHECK:STDERR: ^~~~~~~~~
  329. // CHECK:STDERR: fail_import_decl_value_return_type.carbon:[[@LINE-10]]:10: in file included here [InCppInclude]
  330. // CHECK:STDERR: ./decl_value_return_type.h:2:8: note: class was forward declared here [ClassForwardDeclaredHere]
  331. // CHECK:STDERR: struct S;
  332. // CHECK:STDERR: ^
  333. // CHECK:STDERR: fail_import_decl_value_return_type.carbon: note: return type declared here [IncompleteReturnTypeHere]
  334. // CHECK:STDERR:
  335. Cpp.foo();
  336. }
  337. // ============================================================================
  338. // Defined struct as return type
  339. // ============================================================================
  340. // --- definition_value_return_type.h
  341. struct S {};
  342. auto foo() -> S;
  343. // --- import_definition_value_return_type.carbon
  344. library "[[@TEST_NAME]]";
  345. import Cpp library "definition_value_return_type.h";
  346. fn F() {
  347. //@dump-sem-ir-begin
  348. Cpp.foo();
  349. //@dump-sem-ir-end
  350. }
  351. // ============================================================================
  352. // Pointer to forward-declared struct as return type
  353. // ============================================================================
  354. // --- decl_pointer_return_type.h
  355. struct S;
  356. auto foo() -> S* _Nonnull;
  357. // --- import_decl_pointer_return_type.carbon
  358. library "[[@TEST_NAME]]";
  359. import Cpp library "decl_pointer_return_type.h";
  360. fn F() {
  361. //@dump-sem-ir-begin
  362. Cpp.foo();
  363. //@dump-sem-ir-end
  364. }
  365. // ============================================================================
  366. // Pointer to defined struct as return type
  367. // ============================================================================
  368. // --- definition_pointer_return_type.h
  369. struct S {};
  370. auto foo() -> S* _Nonnull;
  371. // --- import_definition_pointer_return_type.carbon
  372. library "[[@TEST_NAME]]";
  373. import Cpp library "definition_pointer_return_type.h";
  374. fn F() {
  375. //@dump-sem-ir-begin
  376. Cpp.foo();
  377. //@dump-sem-ir-end
  378. }
  379. // CHECK:STDOUT: --- import_definition_no_data_members_value_param_type.carbon
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: constants {
  382. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  383. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  384. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  385. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  386. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  387. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  388. // CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
  389. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  390. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  391. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  392. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  393. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.df1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  394. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.cc2: %AggregateT.as_type.as.Destroy.impl.Op.type.df1 = struct_value () [concrete]
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: imports {
  398. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  399. // CHECK:STDOUT: .foo = %.a21
  400. // CHECK:STDOUT: .S = %S.decl
  401. // CHECK:STDOUT: import Cpp//...
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  404. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  405. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  406. // CHECK:STDOUT: <elided>
  407. // CHECK:STDOUT: } {
  408. // CHECK:STDOUT: <elided>
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: fn @F() {
  413. // CHECK:STDOUT: !entry:
  414. // CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  415. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  416. // CHECK:STDOUT: %.loc8_12.1: %empty_struct_type = struct_literal ()
  417. // CHECK:STDOUT: %Cpp.ref.loc8_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  418. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  419. // CHECK:STDOUT: %.loc8_12.2: ref %S = temporary_storage
  420. // CHECK:STDOUT: %.loc8_12.3: init %S = class_init (), %.loc8_12.2 [concrete = constants.%S.val]
  421. // CHECK:STDOUT: %.loc8_12.4: ref %S = temporary %.loc8_12.2, %.loc8_12.3
  422. // CHECK:STDOUT: %.loc8_14.1: ref %S = converted %.loc8_12.1, %.loc8_12.4
  423. // CHECK:STDOUT: %.loc8_14.2: %S = bind_value %.loc8_14.1
  424. // CHECK:STDOUT: %.loc8_14.3: ref %S = value_as_ref %.loc8_14.2
  425. // CHECK:STDOUT: %addr.loc8_22: %ptr.5c7 = addr_of %.loc8_14.3
  426. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_22)
  427. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  428. // CHECK:STDOUT: %.loc8_12.5: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  429. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc8_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.cc2
  430. // CHECK:STDOUT: <elided>
  431. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  432. // CHECK:STDOUT: %addr.loc8_12: %ptr.5c7 = addr_of %.loc8_12.4
  433. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc8_12)
  434. // CHECK:STDOUT: <elided>
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: --- fail_import_non_copyable_param_type.carbon
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: constants {
  440. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  441. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  442. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  443. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  444. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  445. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  446. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  447. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  448. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  449. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  450. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.df1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  451. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.cc2: %AggregateT.as_type.as.Destroy.impl.Op.type.df1 = struct_value () [concrete]
  452. // CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
  453. // CHECK:STDOUT: }
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: imports {
  456. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  457. // CHECK:STDOUT: .foo = %.a21
  458. // CHECK:STDOUT: .S = %S.decl
  459. // CHECK:STDOUT: import Cpp//...
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  462. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  463. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  464. // CHECK:STDOUT: <elided>
  465. // CHECK:STDOUT: } {
  466. // CHECK:STDOUT: <elided>
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: fn @F() {
  471. // CHECK:STDOUT: !entry:
  472. // CHECK:STDOUT: %Cpp.ref.loc24_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  473. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  474. // CHECK:STDOUT: %.loc24_12.1: %empty_struct_type = struct_literal ()
  475. // CHECK:STDOUT: %Cpp.ref.loc24_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  476. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  477. // CHECK:STDOUT: %.loc24_12.2: ref %S = temporary_storage
  478. // CHECK:STDOUT: %.loc24_12.3: init %S = class_init (), %.loc24_12.2 [concrete = constants.%S.val]
  479. // CHECK:STDOUT: %.loc24_12.4: ref %S = temporary %.loc24_12.2, %.loc24_12.3
  480. // CHECK:STDOUT: %.loc24_14.1: ref %S = converted %.loc24_12.1, %.loc24_12.4
  481. // CHECK:STDOUT: %.loc24_14.2: %S = bind_value %.loc24_14.1
  482. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%.loc24_14.2)
  483. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  484. // CHECK:STDOUT: %.loc24_12.5: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  485. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc24_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.cc2
  486. // CHECK:STDOUT: <elided>
  487. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc24_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  488. // CHECK:STDOUT: %addr: %ptr.5c7 = addr_of %.loc24_12.4
  489. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr)
  490. // CHECK:STDOUT: <elided>
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: --- fail_todo_import_definition_single_data_member_value_param_type.carbon
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: constants {
  496. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @As.Convert [concrete]
  497. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  498. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  499. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: imports {
  503. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  504. // CHECK:STDOUT: .foo = %.a21
  505. // CHECK:STDOUT: .S = %S.decl
  506. // CHECK:STDOUT: import Cpp//...
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @As.Convert [concrete = constants.%empty_struct]
  509. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT:
  512. // CHECK:STDOUT: fn @F() {
  513. // CHECK:STDOUT: !entry:
  514. // CHECK:STDOUT: %Cpp.ref.loc15_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  515. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  516. // CHECK:STDOUT: %.loc15_12: %empty_struct_type = struct_literal ()
  517. // CHECK:STDOUT: %Cpp.ref.loc15_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  518. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  519. // CHECK:STDOUT: %.loc15_14: %S = converted %.loc15_12, <error> [concrete = <error>]
  520. // CHECK:STDOUT: <elided>
  521. // CHECK:STDOUT: }
  522. // CHECK:STDOUT:
  523. // CHECK:STDOUT: --- fail_todo_import_definition_multiple_data_members_value_param_type.carbon
  524. // CHECK:STDOUT:
  525. // CHECK:STDOUT: constants {
  526. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @As.Convert [concrete]
  527. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  528. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  529. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: imports {
  533. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  534. // CHECK:STDOUT: .foo = %.a21
  535. // CHECK:STDOUT: .S = %S.decl
  536. // CHECK:STDOUT: import Cpp//...
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @As.Convert [concrete = constants.%empty_struct]
  539. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: fn @F() {
  543. // CHECK:STDOUT: !entry:
  544. // CHECK:STDOUT: %Cpp.ref.loc15_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  545. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  546. // CHECK:STDOUT: %.loc15_12: %empty_struct_type = struct_literal ()
  547. // CHECK:STDOUT: %Cpp.ref.loc15_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  548. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  549. // CHECK:STDOUT: %.loc15_14: %S = converted %.loc15_12, <error> [concrete = <error>]
  550. // CHECK:STDOUT: <elided>
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: --- import_definition_in_namespace_value_param_type.carbon
  554. // CHECK:STDOUT:
  555. // CHECK:STDOUT: constants {
  556. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  557. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  558. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  559. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  560. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  561. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  562. // CHECK:STDOUT: %pattern_type.cd8: type = pattern_type %S [concrete]
  563. // CHECK:STDOUT: %ptr.edf: type = ptr_type %S [concrete]
  564. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  565. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  566. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  567. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  568. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.1c1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  569. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.dc3: %AggregateT.as_type.as.Destroy.impl.Op.type.1c1 = struct_value () [concrete]
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: imports {
  573. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  574. // CHECK:STDOUT: .foo = %.a21
  575. // CHECK:STDOUT: .N = %N
  576. // CHECK:STDOUT: import Cpp//...
  577. // CHECK:STDOUT: }
  578. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  579. // CHECK:STDOUT: %N: <namespace> = namespace [concrete] {
  580. // CHECK:STDOUT: .S = %S.decl
  581. // CHECK:STDOUT: import Cpp//...
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  584. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  585. // CHECK:STDOUT: <elided>
  586. // CHECK:STDOUT: } {
  587. // CHECK:STDOUT: <elided>
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: fn @F() {
  592. // CHECK:STDOUT: !entry:
  593. // CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  594. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  595. // CHECK:STDOUT: %.loc8_12.1: %empty_struct_type = struct_literal ()
  596. // CHECK:STDOUT: %Cpp.ref.loc8_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  597. // CHECK:STDOUT: %N.ref.loc8: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  598. // CHECK:STDOUT: %S.ref.loc8: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  599. // CHECK:STDOUT: %.loc8_12.2: ref %S = temporary_storage
  600. // CHECK:STDOUT: %.loc8_12.3: init %S = class_init (), %.loc8_12.2 [concrete = constants.%S.val]
  601. // CHECK:STDOUT: %.loc8_12.4: ref %S = temporary %.loc8_12.2, %.loc8_12.3
  602. // CHECK:STDOUT: %.loc8_14.1: ref %S = converted %.loc8_12.1, %.loc8_12.4
  603. // CHECK:STDOUT: %.loc8_14.2: %S = bind_value %.loc8_14.1
  604. // CHECK:STDOUT: %.loc8_14.3: ref %S = value_as_ref %.loc8_14.2
  605. // CHECK:STDOUT: %addr.loc8_24: %ptr.edf = addr_of %.loc8_14.3
  606. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_24)
  607. // CHECK:STDOUT: name_binding_decl {
  608. // CHECK:STDOUT: %x.patt: %pattern_type.cd8 = binding_pattern x [concrete]
  609. // CHECK:STDOUT: %x.var_patt: %pattern_type.cd8 = var_pattern %x.patt [concrete]
  610. // CHECK:STDOUT: }
  611. // CHECK:STDOUT: %x.var: ref %S = var %x.var_patt
  612. // CHECK:STDOUT: %.loc10_15: type = splice_block %S.ref.loc10 [concrete = constants.%S] {
  613. // CHECK:STDOUT: %Cpp.ref.loc10: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  614. // CHECK:STDOUT: %N.ref.loc10: <namespace> = name_ref N, imports.%N [concrete = imports.%N]
  615. // CHECK:STDOUT: %S.ref.loc10: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT: %x: ref %S = bind_name x, %x.var
  618. // CHECK:STDOUT: %facet_value.loc10: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  619. // CHECK:STDOUT: %.loc10_3: %type_where = converted constants.%S, %facet_value.loc10 [concrete = constants.%facet_value]
  620. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc10: <bound method> = bound_method %x.var, constants.%AggregateT.as_type.as.Destroy.impl.Op.dc3
  621. // CHECK:STDOUT: <elided>
  622. // CHECK:STDOUT: %bound_method.loc10: <bound method> = bound_method %x.var, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1
  623. // CHECK:STDOUT: %addr.loc10: %ptr.edf = addr_of %x.var
  624. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc10: init %empty_tuple.type = call %bound_method.loc10(%addr.loc10)
  625. // CHECK:STDOUT: %facet_value.loc8: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  626. // CHECK:STDOUT: %.loc8_12.5: %type_where = converted constants.%S, %facet_value.loc8 [concrete = constants.%facet_value]
  627. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.dc3
  628. // CHECK:STDOUT: <elided>
  629. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2
  630. // CHECK:STDOUT: %addr.loc8_12: %ptr.edf = addr_of %.loc8_12.4
  631. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%addr.loc8_12)
  632. // CHECK:STDOUT: <elided>
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: --- import_definition_in_relative_namespace_value_param_type.carbon
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: constants {
  638. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  639. // CHECK:STDOUT: %.92e: type = cpp_overload_set_type @foo [concrete]
  640. // CHECK:STDOUT: %empty_struct: %.92e = struct_value () [concrete]
  641. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  642. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  643. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  644. // CHECK:STDOUT: %ptr.887: type = ptr_type %S [concrete]
  645. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  646. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  647. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  648. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  649. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.fb3: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  650. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.c17: %AggregateT.as_type.as.Destroy.impl.Op.type.fb3 = struct_value () [concrete]
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT:
  653. // CHECK:STDOUT: imports {
  654. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  655. // CHECK:STDOUT: .N1 = %N1
  656. // CHECK:STDOUT: import Cpp//...
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT: %N1: <namespace> = namespace [concrete] {
  659. // CHECK:STDOUT: .foo = %.218
  660. // CHECK:STDOUT: .N2 = %N2
  661. // CHECK:STDOUT: import Cpp//...
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT: %.218: %.92e = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  664. // CHECK:STDOUT: %N2: <namespace> = namespace [concrete] {
  665. // CHECK:STDOUT: .S = %S.decl
  666. // CHECK:STDOUT: import Cpp//...
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  669. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  670. // CHECK:STDOUT: <elided>
  671. // CHECK:STDOUT: } {
  672. // CHECK:STDOUT: <elided>
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: fn @F() {
  677. // CHECK:STDOUT: !entry:
  678. // CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  679. // CHECK:STDOUT: %N1.ref.loc8_6: <namespace> = name_ref N1, imports.%N1 [concrete = imports.%N1]
  680. // CHECK:STDOUT: %foo.ref: %.92e = name_ref foo, imports.%.218 [concrete = constants.%empty_struct]
  681. // CHECK:STDOUT: %.loc8_15.1: %empty_struct_type = struct_literal ()
  682. // CHECK:STDOUT: %Cpp.ref.loc8_20: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  683. // CHECK:STDOUT: %N1.ref.loc8_23: <namespace> = name_ref N1, imports.%N1 [concrete = imports.%N1]
  684. // CHECK:STDOUT: %N2.ref: <namespace> = name_ref N2, imports.%N2 [concrete = imports.%N2]
  685. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  686. // CHECK:STDOUT: %.loc8_15.2: ref %S = temporary_storage
  687. // CHECK:STDOUT: %.loc8_15.3: init %S = class_init (), %.loc8_15.2 [concrete = constants.%S.val]
  688. // CHECK:STDOUT: %.loc8_15.4: ref %S = temporary %.loc8_15.2, %.loc8_15.3
  689. // CHECK:STDOUT: %.loc8_17.1: ref %S = converted %.loc8_15.1, %.loc8_15.4
  690. // CHECK:STDOUT: %.loc8_17.2: %S = bind_value %.loc8_17.1
  691. // CHECK:STDOUT: %.loc8_17.3: ref %S = value_as_ref %.loc8_17.2
  692. // CHECK:STDOUT: %addr.loc8_31: %ptr.887 = addr_of %.loc8_17.3
  693. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_31)
  694. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  695. // CHECK:STDOUT: %.loc8_15.5: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  696. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc8_15.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.c17
  697. // CHECK:STDOUT: <elided>
  698. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8_15.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  699. // CHECK:STDOUT: %addr.loc8_15: %ptr.887 = addr_of %.loc8_15.4
  700. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc8_15)
  701. // CHECK:STDOUT: <elided>
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT:
  704. // CHECK:STDOUT: --- import_definition_in_outer_definition.carbon
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: constants {
  707. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  708. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  709. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  710. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  711. // CHECK:STDOUT: %O: type = class_type @O [concrete]
  712. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  713. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  714. // CHECK:STDOUT: %ptr.149: type = ptr_type %S [concrete]
  715. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  716. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  717. // CHECK:STDOUT: %pattern_type.cff: type = pattern_type %O [concrete]
  718. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  719. // CHECK:STDOUT: %facet_value.568: %type_where = facet_value %O, () [concrete]
  720. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.a17: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value.568) [concrete]
  721. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.c17: %AggregateT.as_type.as.Destroy.impl.Op.type.a17 = struct_value () [concrete]
  722. // CHECK:STDOUT: %ptr.820: type = ptr_type %O [concrete]
  723. // CHECK:STDOUT: %facet_value.769: %type_where = facet_value %S, () [concrete]
  724. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.e87: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value.769) [concrete]
  725. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.487: %AggregateT.as_type.as.Destroy.impl.Op.type.e87 = struct_value () [concrete]
  726. // CHECK:STDOUT: }
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: imports {
  729. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  730. // CHECK:STDOUT: .foo = %.a21
  731. // CHECK:STDOUT: .O = %O.decl
  732. // CHECK:STDOUT: import Cpp//...
  733. // CHECK:STDOUT: }
  734. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  735. // CHECK:STDOUT: %O.decl: type = class_decl @O [concrete = constants.%O] {} {}
  736. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  737. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  738. // CHECK:STDOUT: <elided>
  739. // CHECK:STDOUT: } {
  740. // CHECK:STDOUT: <elided>
  741. // CHECK:STDOUT: }
  742. // CHECK:STDOUT: }
  743. // CHECK:STDOUT:
  744. // CHECK:STDOUT: fn @F() {
  745. // CHECK:STDOUT: !entry:
  746. // CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  747. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  748. // CHECK:STDOUT: %.loc8_12.1: %empty_struct_type = struct_literal ()
  749. // CHECK:STDOUT: %Cpp.ref.loc8_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  750. // CHECK:STDOUT: %O.ref.loc8: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  751. // CHECK:STDOUT: %S.ref: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  752. // CHECK:STDOUT: %.loc8_12.2: ref %S = temporary_storage
  753. // CHECK:STDOUT: %.loc8_12.3: init %S = class_init (), %.loc8_12.2 [concrete = constants.%S.val]
  754. // CHECK:STDOUT: %.loc8_12.4: ref %S = temporary %.loc8_12.2, %.loc8_12.3
  755. // CHECK:STDOUT: %.loc8_14.1: ref %S = converted %.loc8_12.1, %.loc8_12.4
  756. // CHECK:STDOUT: %.loc8_14.2: %S = bind_value %.loc8_14.1
  757. // CHECK:STDOUT: %.loc8_14.3: ref %S = value_as_ref %.loc8_14.2
  758. // CHECK:STDOUT: %addr.loc8_24: %ptr.149 = addr_of %.loc8_14.3
  759. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_24)
  760. // CHECK:STDOUT: name_binding_decl {
  761. // CHECK:STDOUT: %x.patt: %pattern_type.cff = binding_pattern x [concrete]
  762. // CHECK:STDOUT: %x.var_patt: %pattern_type.cff = var_pattern %x.patt [concrete]
  763. // CHECK:STDOUT: }
  764. // CHECK:STDOUT: %x.var: ref %O = var %x.var_patt
  765. // CHECK:STDOUT: %.loc9_13: type = splice_block %O.ref.loc9 [concrete = constants.%O] {
  766. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  767. // CHECK:STDOUT: %O.ref.loc9: type = name_ref O, imports.%O.decl [concrete = constants.%O]
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT: %x: ref %O = bind_name x, %x.var
  770. // CHECK:STDOUT: %facet_value.loc9: %type_where = facet_value constants.%O, () [concrete = constants.%facet_value.568]
  771. // CHECK:STDOUT: %.loc9_3: %type_where = converted constants.%O, %facet_value.loc9 [concrete = constants.%facet_value.568]
  772. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc9: <bound method> = bound_method %x.var, constants.%AggregateT.as_type.as.Destroy.impl.Op.c17
  773. // CHECK:STDOUT: <elided>
  774. // CHECK:STDOUT: %bound_method.loc9: <bound method> = bound_method %x.var, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.1
  775. // CHECK:STDOUT: %addr.loc9: %ptr.820 = addr_of %x.var
  776. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc9: init %empty_tuple.type = call %bound_method.loc9(%addr.loc9)
  777. // CHECK:STDOUT: %facet_value.loc8: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value.769]
  778. // CHECK:STDOUT: %.loc8_12.5: %type_where = converted constants.%S, %facet_value.loc8 [concrete = constants.%facet_value.769]
  779. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound.loc8: <bound method> = bound_method %.loc8_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.487
  780. // CHECK:STDOUT: <elided>
  781. // CHECK:STDOUT: %bound_method.loc8: <bound method> = bound_method %.loc8_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn.2
  782. // CHECK:STDOUT: %addr.loc8_12: %ptr.149 = addr_of %.loc8_12.4
  783. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call.loc8: init %empty_tuple.type = call %bound_method.loc8(%addr.loc8_12)
  784. // CHECK:STDOUT: <elided>
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: --- import_definition_and_static_method_call_before.carbon
  788. // CHECK:STDOUT:
  789. // CHECK:STDOUT: constants {
  790. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  791. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  792. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  793. // CHECK:STDOUT: %.bce: type = cpp_overload_set_type @foo [concrete]
  794. // CHECK:STDOUT: %empty_struct.21b: %.bce = struct_value () [concrete]
  795. // CHECK:STDOUT: %S.bar.type: type = fn_type @S.bar [concrete]
  796. // CHECK:STDOUT: %S.bar: %S.bar.type = struct_value () [concrete]
  797. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo__carbon_thunk [concrete]
  798. // CHECK:STDOUT: %empty_struct.109: %.c5d = struct_value () [concrete]
  799. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  800. // CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
  801. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  802. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  803. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  804. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  805. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.df1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  806. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.cc2: %AggregateT.as_type.as.Destroy.impl.Op.type.df1 = struct_value () [concrete]
  807. // CHECK:STDOUT: }
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: imports {
  810. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  811. // CHECK:STDOUT: .S = %S.decl
  812. // CHECK:STDOUT: .foo = %.a21
  813. // CHECK:STDOUT: import Cpp//...
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  816. // CHECK:STDOUT: %.8f2: %.bce = cpp_overload_set_value @foo [concrete = constants.%empty_struct.21b]
  817. // CHECK:STDOUT: %S.bar.decl: %S.bar.type = fn_decl @S.bar [concrete = constants.%S.bar] {} {}
  818. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo__carbon_thunk [concrete = constants.%empty_struct.109]
  819. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  820. // CHECK:STDOUT: <elided>
  821. // CHECK:STDOUT: } {
  822. // CHECK:STDOUT: <elided>
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT: }
  825. // CHECK:STDOUT:
  826. // CHECK:STDOUT: fn @F() {
  827. // CHECK:STDOUT: !entry:
  828. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  829. // CHECK:STDOUT: %S.ref.loc8: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  830. // CHECK:STDOUT: %bar.ref: %.bce = name_ref bar, imports.%.8f2 [concrete = constants.%empty_struct.21b]
  831. // CHECK:STDOUT: %S.bar.call: init %empty_tuple.type = call imports.%S.bar.decl()
  832. // CHECK:STDOUT: %Cpp.ref.loc9_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  833. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct.109]
  834. // CHECK:STDOUT: %.loc9_12.1: %empty_struct_type = struct_literal ()
  835. // CHECK:STDOUT: %Cpp.ref.loc9_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  836. // CHECK:STDOUT: %S.ref.loc9: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  837. // CHECK:STDOUT: %.loc9_12.2: ref %S = temporary_storage
  838. // CHECK:STDOUT: %.loc9_12.3: init %S = class_init (), %.loc9_12.2 [concrete = constants.%S.val]
  839. // CHECK:STDOUT: %.loc9_12.4: ref %S = temporary %.loc9_12.2, %.loc9_12.3
  840. // CHECK:STDOUT: %.loc9_14.1: ref %S = converted %.loc9_12.1, %.loc9_12.4
  841. // CHECK:STDOUT: %.loc9_14.2: %S = bind_value %.loc9_14.1
  842. // CHECK:STDOUT: %.loc9_14.3: ref %S = value_as_ref %.loc9_14.2
  843. // CHECK:STDOUT: %addr.loc9_22: %ptr.5c7 = addr_of %.loc9_14.3
  844. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc9_22)
  845. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  846. // CHECK:STDOUT: %.loc9_12.5: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  847. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc9_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.cc2
  848. // CHECK:STDOUT: <elided>
  849. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc9_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  850. // CHECK:STDOUT: %addr.loc9_12: %ptr.5c7 = addr_of %.loc9_12.4
  851. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc9_12)
  852. // CHECK:STDOUT: <elided>
  853. // CHECK:STDOUT: }
  854. // CHECK:STDOUT:
  855. // CHECK:STDOUT: --- import_definition_and_static_method_call_after.carbon
  856. // CHECK:STDOUT:
  857. // CHECK:STDOUT: constants {
  858. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  859. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo__carbon_thunk [concrete]
  860. // CHECK:STDOUT: %empty_struct.109: %.c5d = struct_value () [concrete]
  861. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  862. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  863. // CHECK:STDOUT: %S.val: %S = struct_value () [concrete]
  864. // CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
  865. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  866. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  867. // CHECK:STDOUT: %.bce: type = cpp_overload_set_type @S.bar [concrete]
  868. // CHECK:STDOUT: %empty_struct.21b: %.bce = struct_value () [concrete]
  869. // CHECK:STDOUT: %S.bar.type: type = fn_type @S.bar [concrete]
  870. // CHECK:STDOUT: %S.bar: %S.bar.type = struct_value () [concrete]
  871. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  872. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  873. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.df1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  874. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.cc2: %AggregateT.as_type.as.Destroy.impl.Op.type.df1 = struct_value () [concrete]
  875. // CHECK:STDOUT: }
  876. // CHECK:STDOUT:
  877. // CHECK:STDOUT: imports {
  878. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  879. // CHECK:STDOUT: .foo = %.a21
  880. // CHECK:STDOUT: .S = %S.decl
  881. // CHECK:STDOUT: import Cpp//...
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo__carbon_thunk [concrete = constants.%empty_struct.109]
  884. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  885. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  886. // CHECK:STDOUT: <elided>
  887. // CHECK:STDOUT: } {
  888. // CHECK:STDOUT: <elided>
  889. // CHECK:STDOUT: }
  890. // CHECK:STDOUT: %.8f2: %.bce = cpp_overload_set_value @S.bar [concrete = constants.%empty_struct.21b]
  891. // CHECK:STDOUT: %S.bar.decl: %S.bar.type = fn_decl @S.bar [concrete = constants.%S.bar] {} {}
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: fn @F() {
  895. // CHECK:STDOUT: !entry:
  896. // CHECK:STDOUT: %Cpp.ref.loc8_3: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  897. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct.109]
  898. // CHECK:STDOUT: %.loc8_12.1: %empty_struct_type = struct_literal ()
  899. // CHECK:STDOUT: %Cpp.ref.loc8_17: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  900. // CHECK:STDOUT: %S.ref.loc8: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  901. // CHECK:STDOUT: %.loc8_12.2: ref %S = temporary_storage
  902. // CHECK:STDOUT: %.loc8_12.3: init %S = class_init (), %.loc8_12.2 [concrete = constants.%S.val]
  903. // CHECK:STDOUT: %.loc8_12.4: ref %S = temporary %.loc8_12.2, %.loc8_12.3
  904. // CHECK:STDOUT: %.loc8_14.1: ref %S = converted %.loc8_12.1, %.loc8_12.4
  905. // CHECK:STDOUT: %.loc8_14.2: %S = bind_value %.loc8_14.1
  906. // CHECK:STDOUT: %.loc8_14.3: ref %S = value_as_ref %.loc8_14.2
  907. // CHECK:STDOUT: %addr.loc8_22: %ptr.5c7 = addr_of %.loc8_14.3
  908. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_22)
  909. // CHECK:STDOUT: %Cpp.ref.loc9: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  910. // CHECK:STDOUT: %S.ref.loc9: type = name_ref S, imports.%S.decl [concrete = constants.%S]
  911. // CHECK:STDOUT: %bar.ref: %.bce = name_ref bar, imports.%.8f2 [concrete = constants.%empty_struct.21b]
  912. // CHECK:STDOUT: %S.bar.call: init %empty_tuple.type = call imports.%S.bar.decl()
  913. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  914. // CHECK:STDOUT: %.loc8_12.5: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  915. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc8_12.4, constants.%AggregateT.as_type.as.Destroy.impl.Op.cc2
  916. // CHECK:STDOUT: <elided>
  917. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8_12.4, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  918. // CHECK:STDOUT: %addr.loc8_12: %ptr.5c7 = addr_of %.loc8_12.4
  919. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc8_12)
  920. // CHECK:STDOUT: <elided>
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: --- import_decl_pointer_param_type.carbon
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: constants {
  926. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  927. // CHECK:STDOUT: %ptr: type = ptr_type %S [concrete]
  928. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  929. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  930. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  931. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  932. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  933. // CHECK:STDOUT: }
  934. // CHECK:STDOUT:
  935. // CHECK:STDOUT: imports {
  936. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  937. // CHECK:STDOUT: .S = %S.decl
  938. // CHECK:STDOUT: .foo = %.a21
  939. // CHECK:STDOUT: import Cpp//...
  940. // CHECK:STDOUT: }
  941. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  942. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  943. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  944. // CHECK:STDOUT: <elided>
  945. // CHECK:STDOUT: } {
  946. // CHECK:STDOUT: <elided>
  947. // CHECK:STDOUT: }
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT:
  950. // CHECK:STDOUT: fn @F(%s.param: %ptr) {
  951. // CHECK:STDOUT: !entry:
  952. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  953. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  954. // CHECK:STDOUT: %s.ref: %ptr = name_ref s, %s
  955. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%s.ref)
  956. // CHECK:STDOUT: <elided>
  957. // CHECK:STDOUT: }
  958. // CHECK:STDOUT:
  959. // CHECK:STDOUT: --- import_definition_pointer_param_type.carbon
  960. // CHECK:STDOUT:
  961. // CHECK:STDOUT: constants {
  962. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  963. // CHECK:STDOUT: %ptr: type = ptr_type %S [concrete]
  964. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  965. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  966. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  967. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  968. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  969. // CHECK:STDOUT: }
  970. // CHECK:STDOUT:
  971. // CHECK:STDOUT: imports {
  972. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  973. // CHECK:STDOUT: .S = %S.decl
  974. // CHECK:STDOUT: .foo = %.a21
  975. // CHECK:STDOUT: import Cpp//...
  976. // CHECK:STDOUT: }
  977. // CHECK:STDOUT: %S.decl: type = class_decl @S [concrete = constants.%S] {} {}
  978. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  979. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  980. // CHECK:STDOUT: <elided>
  981. // CHECK:STDOUT: } {
  982. // CHECK:STDOUT: <elided>
  983. // CHECK:STDOUT: }
  984. // CHECK:STDOUT: }
  985. // CHECK:STDOUT:
  986. // CHECK:STDOUT: fn @F(%s.param: %ptr) {
  987. // CHECK:STDOUT: !entry:
  988. // CHECK:STDOUT: %Cpp.ref.loc8: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  989. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  990. // CHECK:STDOUT: %s.ref: %ptr = name_ref s, %s
  991. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call imports.%foo.decl(%s.ref)
  992. // CHECK:STDOUT: <elided>
  993. // CHECK:STDOUT: }
  994. // CHECK:STDOUT:
  995. // CHECK:STDOUT: --- import_definition_value_return_type.carbon
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: constants {
  998. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  999. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  1000. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  1001. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  1002. // CHECK:STDOUT: %ptr.5c7: type = ptr_type %S [concrete]
  1003. // CHECK:STDOUT: %foo__carbon_thunk.type: type = fn_type @foo__carbon_thunk [concrete]
  1004. // CHECK:STDOUT: %foo__carbon_thunk: %foo__carbon_thunk.type = struct_value () [concrete]
  1005. // CHECK:STDOUT: %type_where: type = facet_type <type where .Self impls <CanAggregateDestroy>> [concrete]
  1006. // CHECK:STDOUT: %facet_value: %type_where = facet_value %S, () [concrete]
  1007. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.type.df1: type = fn_type @AggregateT.as_type.as.Destroy.impl.Op, @AggregateT.as_type.as.Destroy.impl(%facet_value) [concrete]
  1008. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.cc2: %AggregateT.as_type.as.Destroy.impl.Op.type.df1 = struct_value () [concrete]
  1009. // CHECK:STDOUT: }
  1010. // CHECK:STDOUT:
  1011. // CHECK:STDOUT: imports {
  1012. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1013. // CHECK:STDOUT: .foo = %.a21
  1014. // CHECK:STDOUT: import Cpp//...
  1015. // CHECK:STDOUT: }
  1016. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  1017. // CHECK:STDOUT: %foo__carbon_thunk.decl: %foo__carbon_thunk.type = fn_decl @foo__carbon_thunk [concrete = constants.%foo__carbon_thunk] {
  1018. // CHECK:STDOUT: <elided>
  1019. // CHECK:STDOUT: } {
  1020. // CHECK:STDOUT: <elided>
  1021. // CHECK:STDOUT: }
  1022. // CHECK:STDOUT: }
  1023. // CHECK:STDOUT:
  1024. // CHECK:STDOUT: fn @F() {
  1025. // CHECK:STDOUT: !entry:
  1026. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1027. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  1028. // CHECK:STDOUT: %.loc8_11.1: ref %S = temporary_storage
  1029. // CHECK:STDOUT: %addr.loc8_11.1: %ptr.5c7 = addr_of %.loc8_11.1
  1030. // CHECK:STDOUT: %foo__carbon_thunk.call: init %empty_tuple.type = call imports.%foo__carbon_thunk.decl(%addr.loc8_11.1)
  1031. // CHECK:STDOUT: %.loc8_11.2: init %S = in_place_init %foo__carbon_thunk.call, %.loc8_11.1
  1032. // CHECK:STDOUT: %.loc8_11.3: ref %S = temporary %.loc8_11.1, %.loc8_11.2
  1033. // CHECK:STDOUT: %facet_value: %type_where = facet_value constants.%S, () [concrete = constants.%facet_value]
  1034. // CHECK:STDOUT: %.loc8_11.4: %type_where = converted constants.%S, %facet_value [concrete = constants.%facet_value]
  1035. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.bound: <bound method> = bound_method %.loc8_11.3, constants.%AggregateT.as_type.as.Destroy.impl.Op.cc2
  1036. // CHECK:STDOUT: <elided>
  1037. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %.loc8_11.3, %AggregateT.as_type.as.Destroy.impl.Op.specific_fn
  1038. // CHECK:STDOUT: %addr.loc8_11.2: %ptr.5c7 = addr_of %.loc8_11.3
  1039. // CHECK:STDOUT: %AggregateT.as_type.as.Destroy.impl.Op.call: init %empty_tuple.type = call %bound_method(%addr.loc8_11.2)
  1040. // CHECK:STDOUT: <elided>
  1041. // CHECK:STDOUT: }
  1042. // CHECK:STDOUT:
  1043. // CHECK:STDOUT: --- import_decl_pointer_return_type.carbon
  1044. // CHECK:STDOUT:
  1045. // CHECK:STDOUT: constants {
  1046. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  1047. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  1048. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  1049. // CHECK:STDOUT: %ptr: type = ptr_type %S [concrete]
  1050. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1051. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT:
  1054. // CHECK:STDOUT: imports {
  1055. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1056. // CHECK:STDOUT: .foo = %.a21
  1057. // CHECK:STDOUT: import Cpp//...
  1058. // CHECK:STDOUT: }
  1059. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  1060. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1061. // CHECK:STDOUT: <elided>
  1062. // CHECK:STDOUT: } {
  1063. // CHECK:STDOUT: <elided>
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT: }
  1066. // CHECK:STDOUT:
  1067. // CHECK:STDOUT: fn @F() {
  1068. // CHECK:STDOUT: !entry:
  1069. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1070. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  1071. // CHECK:STDOUT: %foo.call: init %ptr = call imports.%foo.decl()
  1072. // CHECK:STDOUT: <elided>
  1073. // CHECK:STDOUT: }
  1074. // CHECK:STDOUT:
  1075. // CHECK:STDOUT: --- import_definition_pointer_return_type.carbon
  1076. // CHECK:STDOUT:
  1077. // CHECK:STDOUT: constants {
  1078. // CHECK:STDOUT: %.c5d: type = cpp_overload_set_type @foo [concrete]
  1079. // CHECK:STDOUT: %empty_struct: %.c5d = struct_value () [concrete]
  1080. // CHECK:STDOUT: %S: type = class_type @S [concrete]
  1081. // CHECK:STDOUT: %ptr: type = ptr_type %S [concrete]
  1082. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  1083. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  1084. // CHECK:STDOUT: }
  1085. // CHECK:STDOUT:
  1086. // CHECK:STDOUT: imports {
  1087. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  1088. // CHECK:STDOUT: .foo = %.a21
  1089. // CHECK:STDOUT: import Cpp//...
  1090. // CHECK:STDOUT: }
  1091. // CHECK:STDOUT: %.a21: %.c5d = cpp_overload_set_value @foo [concrete = constants.%empty_struct]
  1092. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {
  1093. // CHECK:STDOUT: <elided>
  1094. // CHECK:STDOUT: } {
  1095. // CHECK:STDOUT: <elided>
  1096. // CHECK:STDOUT: }
  1097. // CHECK:STDOUT: }
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: fn @F() {
  1100. // CHECK:STDOUT: !entry:
  1101. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  1102. // CHECK:STDOUT: %foo.ref: %.c5d = name_ref foo, imports.%.a21 [concrete = constants.%empty_struct]
  1103. // CHECK:STDOUT: %foo.call: init %ptr = call imports.%foo.decl()
  1104. // CHECK:STDOUT: <elided>
  1105. // CHECK:STDOUT: }
  1106. // CHECK:STDOUT: