union.carbon 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/interop/cpp/no_prelude/union.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/interop/cpp/no_prelude/union.carbon
  10. // --- union_declaration.h
  11. union Bar;
  12. // --- fail_import_union_declaration.carbon
  13. library "[[@TEST_NAME]]";
  14. import Cpp library "union_declaration.h";
  15. // CHECK:STDERR: fail_import_union_declaration.carbon:[[@LINE+7]]:13: error: semantics TODO: `Unsupported: Record declarations without a definition` [SemanticsTodo]
  16. // CHECK:STDERR: fn MyF(bar: Cpp.Bar*);
  17. // CHECK:STDERR: ^~~~~~~
  18. // CHECK:STDERR: fail_import_union_declaration.carbon:[[@LINE+4]]:13: note: in `Cpp` name lookup for `Bar` [InCppNameLookup]
  19. // CHECK:STDERR: fn MyF(bar: Cpp.Bar*);
  20. // CHECK:STDERR: ^~~~~~~
  21. // CHECK:STDERR:
  22. fn MyF(bar: Cpp.Bar*);
  23. // --- union_definition.h
  24. union Bar {};
  25. // --- import_union_definition.carbon
  26. library "[[@TEST_NAME]]";
  27. import Cpp library "union_definition.h";
  28. fn MyF(bar: Cpp.Bar*);
  29. // --- union_declaration_and_definition.h
  30. union Bar;
  31. union Bar {};
  32. // --- import_union_declaration_and_definition.carbon
  33. library "[[@TEST_NAME]]";
  34. import Cpp library "union_declaration_and_definition.h";
  35. fn MyF(bar: Cpp.Bar*);
  36. // --- union_public_static_member_function.h
  37. union Bar {
  38. public:
  39. static auto foo() -> void;
  40. };
  41. // --- import_union_public_static_member_function.carbon
  42. library "[[@TEST_NAME]]";
  43. import Cpp library "union_public_static_member_function.h";
  44. fn MyF() {
  45. Cpp.Bar.foo();
  46. }
  47. // --- union_private_static_member_function.h
  48. union Bar {
  49. private:
  50. static auto foo() -> void;
  51. };
  52. // --- todo_fail_import_union_private_static_member_function.carbon
  53. library "[[@TEST_NAME]]";
  54. import Cpp library "union_private_static_member_function.h";
  55. fn MyF() {
  56. Cpp.Bar.foo();
  57. }
  58. // --- union_public_member_function.h
  59. union Bar {
  60. public:
  61. auto foo() -> void;
  62. };
  63. // --- fail_import_union_public_member_function.carbon
  64. library "[[@TEST_NAME]]";
  65. import Cpp library "union_public_member_function.h";
  66. fn MyF(bar : Cpp.Bar*) {
  67. // CHECK:STDERR: fail_import_union_public_member_function.carbon:[[@LINE+7]]:3: error: semantics TODO: `Unsupported: Non-global function` [SemanticsTodo]
  68. // CHECK:STDERR: bar->foo();
  69. // CHECK:STDERR: ^~~~~~~~
  70. // CHECK:STDERR: fail_import_union_public_member_function.carbon:[[@LINE+4]]:3: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  71. // CHECK:STDERR: bar->foo();
  72. // CHECK:STDERR: ^~~~~~~~
  73. // CHECK:STDERR:
  74. bar->foo();
  75. }
  76. // --- union_public_static_data_member.h
  77. union Bar {
  78. public:
  79. static Bar* foo;
  80. };
  81. // --- fail_import_union_public_static_data_member.carbon
  82. library "[[@TEST_NAME]]";
  83. import Cpp library "union_public_static_data_member.h";
  84. fn MyF() {
  85. // CHECK:STDERR: fail_import_union_public_static_data_member.carbon:[[@LINE+11]]:23: error: semantics TODO: `Unsupported: Declaration type Var` [SemanticsTodo]
  86. // CHECK:STDERR: let bar: Cpp.Bar* = Cpp.Bar.foo();
  87. // CHECK:STDERR: ^~~~~~~~~~~
  88. // CHECK:STDERR: fail_import_union_public_static_data_member.carbon:[[@LINE+8]]:23: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  89. // CHECK:STDERR: let bar: Cpp.Bar* = Cpp.Bar.foo();
  90. // CHECK:STDERR: ^~~~~~~~~~~
  91. // CHECK:STDERR:
  92. // CHECK:STDERR: fail_import_union_public_static_data_member.carbon:[[@LINE+4]]:23: error: member name `foo` not found in `Cpp.Bar` [MemberNameNotFoundInInstScope]
  93. // CHECK:STDERR: let bar: Cpp.Bar* = Cpp.Bar.foo();
  94. // CHECK:STDERR: ^~~~~~~~~~~
  95. // CHECK:STDERR:
  96. let bar: Cpp.Bar* = Cpp.Bar.foo();
  97. }
  98. // --- union_public_data_member.h
  99. union Bar {
  100. public:
  101. Bar* foo;
  102. };
  103. // --- fail_import_union_public_data_member.carbon
  104. library "[[@TEST_NAME]]";
  105. import Cpp library "union_public_static_data_member.h";
  106. fn MyF(bar : Cpp.Bar*) {
  107. // CHECK:STDERR: fail_import_union_public_data_member.carbon:[[@LINE+11]]:27: error: semantics TODO: `Unsupported: Declaration type Var` [SemanticsTodo]
  108. // CHECK:STDERR: let foo_bar: Cpp.Bar* = bar->foo;
  109. // CHECK:STDERR: ^~~~~~~~
  110. // CHECK:STDERR: fail_import_union_public_data_member.carbon:[[@LINE+8]]:27: note: in `Cpp` name lookup for `foo` [InCppNameLookup]
  111. // CHECK:STDERR: let foo_bar: Cpp.Bar* = bar->foo;
  112. // CHECK:STDERR: ^~~~~~~~
  113. // CHECK:STDERR:
  114. // CHECK:STDERR: fail_import_union_public_data_member.carbon:[[@LINE+4]]:27: error: member name `foo` not found in `Cpp.Bar` [MemberNameNotFoundInInstScope]
  115. // CHECK:STDERR: let foo_bar: Cpp.Bar* = bar->foo;
  116. // CHECK:STDERR: ^~~~~~~~
  117. // CHECK:STDERR:
  118. let foo_bar: Cpp.Bar* = bar->foo;
  119. }
  120. // --- union_to_inherit_public.h
  121. union Bar {
  122. public:
  123. static auto foo() -> void;
  124. };
  125. // --- todo_fail_import_union_to_inherit_public.carbon
  126. library "[[@TEST_NAME]]";
  127. import Cpp library "union_to_inherit_public.h";
  128. class Derived {
  129. extend base: Cpp.Bar;
  130. }
  131. fn MyF() {
  132. Derived.foo();
  133. }
  134. // --- union_template.h
  135. template<typename T>
  136. union Bar {};
  137. // --- fail_import_union_template.carbon
  138. library "[[@TEST_NAME]]";
  139. import Cpp library "union_template.h";
  140. // CHECK:STDERR: fail_import_union_template.carbon:[[@LINE+11]]:13: error: semantics TODO: `Unsupported: Declaration type ClassTemplate` [SemanticsTodo]
  141. // CHECK:STDERR: fn MyF(bar: Cpp.Bar*);
  142. // CHECK:STDERR: ^~~~~~~
  143. // CHECK:STDERR: fail_import_union_template.carbon:[[@LINE+8]]:13: note: in `Cpp` name lookup for `Bar` [InCppNameLookup]
  144. // CHECK:STDERR: fn MyF(bar: Cpp.Bar*);
  145. // CHECK:STDERR: ^~~~~~~
  146. // CHECK:STDERR:
  147. // CHECK:STDERR: fail_import_union_template.carbon:[[@LINE+4]]:13: error: member name `Bar` not found in `Cpp` [MemberNameNotFoundInInstScope]
  148. // CHECK:STDERR: fn MyF(bar: Cpp.Bar*);
  149. // CHECK:STDERR: ^~~~~~~
  150. // CHECK:STDERR:
  151. fn MyF(bar: Cpp.Bar*);
  152. // CHECK:STDOUT: --- fail_import_union_declaration.carbon
  153. // CHECK:STDOUT:
  154. // CHECK:STDOUT: constants {
  155. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  156. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: imports {
  160. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  161. // CHECK:STDOUT: .Bar = <error>
  162. // CHECK:STDOUT: import Cpp//...
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT:
  166. // CHECK:STDOUT: file {
  167. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  168. // CHECK:STDOUT: .Cpp = imports.%Cpp
  169. // CHECK:STDOUT: .MyF = %MyF.decl
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  172. // CHECK:STDOUT: import Cpp "union_declaration.h"
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  175. // CHECK:STDOUT: %bar.patt: <error> = binding_pattern bar
  176. // CHECK:STDOUT: %bar.param_patt: <error> = value_param_pattern %bar.patt, call_param0 [concrete = <error>]
  177. // CHECK:STDOUT: } {
  178. // CHECK:STDOUT: %bar.param: <error> = value_param call_param0
  179. // CHECK:STDOUT: %.loc13: type = splice_block %ptr [concrete = <error>] {
  180. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  181. // CHECK:STDOUT: %Bar.ref: <error> = name_ref Bar, <error> [concrete = <error>]
  182. // CHECK:STDOUT: %ptr: type = ptr_type <error> [concrete = <error>]
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT: %bar: <error> = bind_name bar, %bar.param
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: fn @MyF(%bar.param: <error>);
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: --- import_union_definition.carbon
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: constants {
  193. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  194. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  195. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  196. // CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
  197. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  198. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: imports {
  202. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  203. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  204. // CHECK:STDOUT: import Cpp//...
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: file {
  209. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  210. // CHECK:STDOUT: .Cpp = imports.%Cpp
  211. // CHECK:STDOUT: .MyF = %MyF.decl
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  214. // CHECK:STDOUT: import Cpp "union_definition.h"
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  217. // CHECK:STDOUT: %bar.patt: %ptr = binding_pattern bar
  218. // CHECK:STDOUT: %bar.param_patt: %ptr = value_param_pattern %bar.patt, call_param0
  219. // CHECK:STDOUT: } {
  220. // CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
  221. // CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = constants.%ptr] {
  222. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  223. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  224. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  225. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  226. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  227. // CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT: %bar: %ptr = bind_name bar, %bar.param
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT:
  233. // CHECK:STDOUT: class @Bar {
  234. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: !members:
  237. // CHECK:STDOUT: .Self = constants.%Bar
  238. // CHECK:STDOUT: import Cpp//...
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: fn @MyF(%bar.param: %ptr);
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: --- import_union_declaration_and_definition.carbon
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: constants {
  246. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  247. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  248. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  249. // CHECK:STDOUT: %ptr: type = ptr_type %Bar [concrete]
  250. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  251. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: imports {
  255. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  256. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  257. // CHECK:STDOUT: import Cpp//...
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: file {
  262. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  263. // CHECK:STDOUT: .Cpp = imports.%Cpp
  264. // CHECK:STDOUT: .MyF = %MyF.decl
  265. // CHECK:STDOUT: }
  266. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  267. // CHECK:STDOUT: import Cpp "union_declaration_and_definition.h"
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  270. // CHECK:STDOUT: %bar.patt: %ptr = binding_pattern bar
  271. // CHECK:STDOUT: %bar.param_patt: %ptr = value_param_pattern %bar.patt, call_param0
  272. // CHECK:STDOUT: } {
  273. // CHECK:STDOUT: %bar.param: %ptr = value_param call_param0
  274. // CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = constants.%ptr] {
  275. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  276. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  277. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  278. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  279. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  280. // CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr]
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT: %bar: %ptr = bind_name bar, %bar.param
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: class @Bar {
  287. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: !members:
  290. // CHECK:STDOUT: .Self = constants.%Bar
  291. // CHECK:STDOUT: import Cpp//...
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: fn @MyF(%bar.param: %ptr);
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: --- import_union_public_static_member_function.carbon
  297. // CHECK:STDOUT:
  298. // CHECK:STDOUT: constants {
  299. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  300. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  301. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  302. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  303. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  304. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  305. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  306. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  307. // CHECK:STDOUT: }
  308. // CHECK:STDOUT:
  309. // CHECK:STDOUT: imports {
  310. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  311. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  312. // CHECK:STDOUT: import Cpp//...
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: file {
  317. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  318. // CHECK:STDOUT: .Cpp = imports.%Cpp
  319. // CHECK:STDOUT: .MyF = %MyF.decl
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  322. // CHECK:STDOUT: import Cpp "union_public_static_member_function.h"
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {} {}
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: class @Bar {
  328. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: !members:
  331. // CHECK:STDOUT: .Self = constants.%Bar
  332. // CHECK:STDOUT: .foo = @MyF.%foo.decl
  333. // CHECK:STDOUT: import Cpp//...
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: fn @MyF() {
  337. // CHECK:STDOUT: !entry:
  338. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  339. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  340. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  341. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  342. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  343. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  344. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  345. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref()
  346. // CHECK:STDOUT: return
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: fn @foo();
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: --- todo_fail_import_union_private_static_member_function.carbon
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: constants {
  354. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  355. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  356. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  357. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  358. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  359. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  360. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  361. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: imports {
  365. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  366. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  367. // CHECK:STDOUT: import Cpp//...
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: file {
  372. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  373. // CHECK:STDOUT: .Cpp = imports.%Cpp
  374. // CHECK:STDOUT: .MyF = %MyF.decl
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  377. // CHECK:STDOUT: import Cpp "union_private_static_member_function.h"
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {} {}
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: class @Bar {
  383. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: !members:
  386. // CHECK:STDOUT: .Self = constants.%Bar
  387. // CHECK:STDOUT: .foo = @MyF.%foo.decl
  388. // CHECK:STDOUT: import Cpp//...
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: fn @MyF() {
  392. // CHECK:STDOUT: !entry:
  393. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  394. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  395. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  396. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  397. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  398. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  399. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  400. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref()
  401. // CHECK:STDOUT: return
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: fn @foo();
  405. // CHECK:STDOUT:
  406. // CHECK:STDOUT: --- fail_import_union_public_member_function.carbon
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: constants {
  409. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  410. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  411. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  412. // CHECK:STDOUT: %ptr.f68: type = ptr_type %Bar [concrete]
  413. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  414. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: imports {
  418. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  419. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  420. // CHECK:STDOUT: import Cpp//...
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: file {
  425. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  426. // CHECK:STDOUT: .Cpp = imports.%Cpp
  427. // CHECK:STDOUT: .MyF = %MyF.decl
  428. // CHECK:STDOUT: }
  429. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  430. // CHECK:STDOUT: import Cpp "union_public_member_function.h"
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  433. // CHECK:STDOUT: %bar.patt: %ptr.f68 = binding_pattern bar
  434. // CHECK:STDOUT: %bar.param_patt: %ptr.f68 = value_param_pattern %bar.patt, call_param0
  435. // CHECK:STDOUT: } {
  436. // CHECK:STDOUT: %bar.param: %ptr.f68 = value_param call_param0
  437. // CHECK:STDOUT: %.loc6: type = splice_block %ptr [concrete = constants.%ptr.f68] {
  438. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  439. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  440. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  441. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  442. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  443. // CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref [concrete = constants.%ptr.f68]
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT: %bar: %ptr.f68 = bind_name bar, %bar.param
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: class @Bar {
  450. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: !members:
  453. // CHECK:STDOUT: .Self = constants.%Bar
  454. // CHECK:STDOUT: .foo = <error>
  455. // CHECK:STDOUT: import Cpp//...
  456. // CHECK:STDOUT: }
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: fn @MyF(%bar.param: %ptr.f68) {
  459. // CHECK:STDOUT: !entry:
  460. // CHECK:STDOUT: %bar.ref: %ptr.f68 = name_ref bar, %bar
  461. // CHECK:STDOUT: %.loc14: ref %Bar = deref %bar.ref
  462. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  463. // CHECK:STDOUT: return
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: --- fail_import_union_public_static_data_member.carbon
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: constants {
  469. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  470. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  471. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  472. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  473. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  474. // CHECK:STDOUT: %ptr.f68: type = ptr_type %Bar [concrete]
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT:
  477. // CHECK:STDOUT: imports {
  478. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  479. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  480. // CHECK:STDOUT: import Cpp//...
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: file {
  485. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  486. // CHECK:STDOUT: .Cpp = imports.%Cpp
  487. // CHECK:STDOUT: .MyF = %MyF.decl
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  490. // CHECK:STDOUT: import Cpp "union_public_static_data_member.h"
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {} {}
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: class @Bar {
  496. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: !members:
  499. // CHECK:STDOUT: .Self = constants.%Bar
  500. // CHECK:STDOUT: .foo = <poisoned>
  501. // CHECK:STDOUT: import Cpp//...
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: fn @MyF() {
  505. // CHECK:STDOUT: !entry:
  506. // CHECK:STDOUT: name_binding_decl {
  507. // CHECK:STDOUT: %bar.patt: %ptr.f68 = binding_pattern bar
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT: %Cpp.ref.loc18_23: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  510. // CHECK:STDOUT: %Bar.ref.loc18_26: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  511. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  512. // CHECK:STDOUT: %.loc18: type = splice_block %ptr [concrete = constants.%ptr.f68] {
  513. // CHECK:STDOUT: %Cpp.ref.loc18_12: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  514. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  515. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  516. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  517. // CHECK:STDOUT: %Bar.ref.loc18_15: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  518. // CHECK:STDOUT: %ptr: type = ptr_type %Bar.ref.loc18_15 [concrete = constants.%ptr.f68]
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT: %bar: %ptr.f68 = bind_name bar, <error>
  521. // CHECK:STDOUT: return
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: --- fail_import_union_public_data_member.carbon
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: constants {
  527. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  528. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  529. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  530. // CHECK:STDOUT: %ptr.f68: type = ptr_type %Bar [concrete]
  531. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  532. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: imports {
  536. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  537. // CHECK:STDOUT: .Bar = @MyF.%Bar.decl
  538. // CHECK:STDOUT: import Cpp//...
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: file {
  543. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  544. // CHECK:STDOUT: .Cpp = imports.%Cpp
  545. // CHECK:STDOUT: .MyF = %MyF.decl
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  548. // CHECK:STDOUT: import Cpp "union_public_static_data_member.h"
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  551. // CHECK:STDOUT: %bar.patt: %ptr.f68 = binding_pattern bar
  552. // CHECK:STDOUT: %bar.param_patt: %ptr.f68 = value_param_pattern %bar.patt, call_param0
  553. // CHECK:STDOUT: } {
  554. // CHECK:STDOUT: %bar.param: %ptr.f68 = value_param call_param0
  555. // CHECK:STDOUT: %.loc6: type = splice_block %ptr.loc6 [concrete = constants.%ptr.f68] {
  556. // CHECK:STDOUT: %Cpp.ref.loc6: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  557. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  558. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  559. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  560. // CHECK:STDOUT: %Bar.ref.loc6: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  561. // CHECK:STDOUT: %ptr.loc6: type = ptr_type %Bar.ref.loc6 [concrete = constants.%ptr.f68]
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT: %bar: %ptr.f68 = bind_name bar, %bar.param
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: class @Bar {
  568. // CHECK:STDOUT: complete_type_witness = @MyF.%complete_type
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: !members:
  571. // CHECK:STDOUT: .Self = constants.%Bar
  572. // CHECK:STDOUT: .foo = <poisoned>
  573. // CHECK:STDOUT: import Cpp//...
  574. // CHECK:STDOUT: }
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: fn @MyF(%bar.param: %ptr.f68) {
  577. // CHECK:STDOUT: !entry:
  578. // CHECK:STDOUT: name_binding_decl {
  579. // CHECK:STDOUT: %foo_bar.patt: %ptr.f68 = binding_pattern foo_bar
  580. // CHECK:STDOUT: }
  581. // CHECK:STDOUT: %bar.ref: %ptr.f68 = name_ref bar, %bar
  582. // CHECK:STDOUT: %.loc18_30: ref %Bar = deref %bar.ref
  583. // CHECK:STDOUT: %foo.ref: <error> = name_ref foo, <error> [concrete = <error>]
  584. // CHECK:STDOUT: %.loc18_23: type = splice_block %ptr.loc18 [concrete = constants.%ptr.f68] {
  585. // CHECK:STDOUT: %Cpp.ref.loc18: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  586. // CHECK:STDOUT: %Bar.ref.loc18: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  587. // CHECK:STDOUT: %ptr.loc18: type = ptr_type %Bar.ref.loc18 [concrete = constants.%ptr.f68]
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT: %foo_bar: %ptr.f68 = bind_name foo_bar, <error>
  590. // CHECK:STDOUT: return
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: --- todo_fail_import_union_to_inherit_public.carbon
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: constants {
  596. // CHECK:STDOUT: %Derived: type = class_type @Derived [concrete]
  597. // CHECK:STDOUT: %Bar: type = class_type @Bar [concrete]
  598. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  599. // CHECK:STDOUT: %complete_type.357: <witness> = complete_type_witness %empty_struct_type [concrete]
  600. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  601. // CHECK:STDOUT: %Derived.elem: type = unbound_element_type %Derived, %Bar [concrete]
  602. // CHECK:STDOUT: %struct_type.base.36d: type = struct_type {.base: %Bar} [concrete]
  603. // CHECK:STDOUT: %complete_type.fff: <witness> = complete_type_witness %struct_type.base.36d [concrete]
  604. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  605. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  606. // CHECK:STDOUT: %foo.type: type = fn_type @foo [concrete]
  607. // CHECK:STDOUT: %foo: %foo.type = struct_value () [concrete]
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: imports {
  611. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  612. // CHECK:STDOUT: .Bar = @Derived.%Bar.decl
  613. // CHECK:STDOUT: import Cpp//...
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: file {
  618. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  619. // CHECK:STDOUT: .Cpp = imports.%Cpp
  620. // CHECK:STDOUT: .Derived = %Derived.decl
  621. // CHECK:STDOUT: .MyF = %MyF.decl
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  624. // CHECK:STDOUT: import Cpp "union_to_inherit_public.h"
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT: %Derived.decl: type = class_decl @Derived [concrete = constants.%Derived] {} {}
  627. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {} {}
  628. // CHECK:STDOUT: }
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: class @Derived {
  631. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  632. // CHECK:STDOUT: %Bar.decl: type = class_decl @Bar [concrete = constants.%Bar] {} {}
  633. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  634. // CHECK:STDOUT: %complete_type.1: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type.357]
  635. // CHECK:STDOUT: %Bar.ref: type = name_ref Bar, %Bar.decl [concrete = constants.%Bar]
  636. // CHECK:STDOUT: %.loc7: %Derived.elem = base_decl %Bar.ref, element0 [concrete]
  637. // CHECK:STDOUT: %struct_type.base: type = struct_type {.base: %Bar} [concrete = constants.%struct_type.base.36d]
  638. // CHECK:STDOUT: %complete_type.loc8: <witness> = complete_type_witness %struct_type.base [concrete = constants.%complete_type.fff]
  639. // CHECK:STDOUT: complete_type_witness = %complete_type.loc8
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: !members:
  642. // CHECK:STDOUT: .Self = constants.%Derived
  643. // CHECK:STDOUT: .Cpp = <poisoned>
  644. // CHECK:STDOUT: .base = %.loc7
  645. // CHECK:STDOUT: .foo = <poisoned>
  646. // CHECK:STDOUT: extend %Bar.ref
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: class @Bar {
  650. // CHECK:STDOUT: complete_type_witness = @Derived.%complete_type.1
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: !members:
  653. // CHECK:STDOUT: .Self = constants.%Bar
  654. // CHECK:STDOUT: .foo = @MyF.%foo.decl
  655. // CHECK:STDOUT: import Cpp//...
  656. // CHECK:STDOUT: }
  657. // CHECK:STDOUT:
  658. // CHECK:STDOUT: fn @MyF() {
  659. // CHECK:STDOUT: !entry:
  660. // CHECK:STDOUT: %Derived.ref: type = name_ref Derived, file.%Derived.decl [concrete = constants.%Derived]
  661. // CHECK:STDOUT: %foo.decl: %foo.type = fn_decl @foo [concrete = constants.%foo] {} {}
  662. // CHECK:STDOUT: %foo.ref: %foo.type = name_ref foo, %foo.decl [concrete = constants.%foo]
  663. // CHECK:STDOUT: %foo.call: init %empty_tuple.type = call %foo.ref()
  664. // CHECK:STDOUT: return
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: fn @foo();
  668. // CHECK:STDOUT:
  669. // CHECK:STDOUT: --- fail_import_union_template.carbon
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: constants {
  672. // CHECK:STDOUT: %MyF.type: type = fn_type @MyF [concrete]
  673. // CHECK:STDOUT: %MyF: %MyF.type = struct_value () [concrete]
  674. // CHECK:STDOUT: }
  675. // CHECK:STDOUT:
  676. // CHECK:STDOUT: imports {
  677. // CHECK:STDOUT: %Cpp: <namespace> = namespace file.%Cpp.import_cpp, [concrete] {
  678. // CHECK:STDOUT: .Bar = <poisoned>
  679. // CHECK:STDOUT: import Cpp//...
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: file {
  684. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  685. // CHECK:STDOUT: .Cpp = imports.%Cpp
  686. // CHECK:STDOUT: .MyF = %MyF.decl
  687. // CHECK:STDOUT: }
  688. // CHECK:STDOUT: %Cpp.import_cpp = import_cpp {
  689. // CHECK:STDOUT: import Cpp "union_template.h"
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT: %MyF.decl: %MyF.type = fn_decl @MyF [concrete = constants.%MyF] {
  692. // CHECK:STDOUT: %bar.patt: <error> = binding_pattern bar
  693. // CHECK:STDOUT: %bar.param_patt: <error> = value_param_pattern %bar.patt, call_param0 [concrete = <error>]
  694. // CHECK:STDOUT: } {
  695. // CHECK:STDOUT: %bar.param: <error> = value_param call_param0
  696. // CHECK:STDOUT: %.loc17: type = splice_block %ptr [concrete = <error>] {
  697. // CHECK:STDOUT: %Cpp.ref: <namespace> = name_ref Cpp, imports.%Cpp [concrete = imports.%Cpp]
  698. // CHECK:STDOUT: %Bar.ref: <error> = name_ref Bar, <error> [concrete = <error>]
  699. // CHECK:STDOUT: %ptr: type = ptr_type <error> [concrete = <error>]
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT: %bar: <error> = bind_name bar, %bar.param
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: fn @MyF(%bar.param: <error>);
  706. // CHECK:STDOUT: