syntactic_merge.carbon 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  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/function/definition/no_prelude/syntactic_merge.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/definition/no_prelude/syntactic_merge.carbon
  10. // --- basic.carbon
  11. library "[[@TEST_NAME]]";
  12. class C {}
  13. alias D = C;
  14. fn Foo(a: C);
  15. fn Foo(a: C) {}
  16. fn Bar(a: D);
  17. fn Bar(a: D) {}
  18. // --- spacing.carbon
  19. library "[[@TEST_NAME]]";
  20. class C {}
  21. fn Foo [ ] ( a : C );
  22. fn Foo[](a: C) {}
  23. // --- fail_parens.carbon
  24. library "[[@TEST_NAME]]";
  25. class C {}
  26. fn Foo(a: C);
  27. // CHECK:STDERR: fail_parens.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
  28. // CHECK:STDERR: fn Foo(a: (C)) {}
  29. // CHECK:STDERR: ^
  30. // CHECK:STDERR: fail_parens.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
  31. // CHECK:STDERR: fn Foo(a: C);
  32. // CHECK:STDERR: ^
  33. // CHECK:STDERR:
  34. fn Foo(a: (C)) {}
  35. // --- todo_fail_raw_identifier.carbon
  36. library "[[@TEST_NAME]]";
  37. class C {}
  38. fn Foo(a: C);
  39. fn Foo(a: r#C) {}
  40. // --- two_file.carbon
  41. library "[[@TEST_NAME]]";
  42. class C {}
  43. alias D = C;
  44. fn Foo(a: C);
  45. fn Bar(a: D);
  46. // --- two_file.impl.carbon
  47. impl library "[[@TEST_NAME]]";
  48. fn Foo(a: C) {}
  49. fn Bar(a: D) {}
  50. // --- fail_name_mismatch.carbon
  51. library "[[@TEST_NAME]]";
  52. class C {}
  53. alias D = C;
  54. fn Foo(a: C);
  55. // CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE+7]]:8: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
  56. // CHECK:STDERR: fn Foo(b: D) {}
  57. // CHECK:STDERR: ^~~~
  58. // CHECK:STDERR: fail_name_mismatch.carbon:[[@LINE-4]]:8: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
  59. // CHECK:STDERR: fn Foo(a: C);
  60. // CHECK:STDERR: ^~~~
  61. // CHECK:STDERR:
  62. fn Foo(b: D) {}
  63. // --- fail_alias.carbon
  64. library "[[@TEST_NAME]]";
  65. class C {}
  66. alias D = C;
  67. fn Foo(a: C);
  68. // CHECK:STDERR: fail_alias.carbon:[[@LINE+7]]:11: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
  69. // CHECK:STDERR: fn Foo(a: D) {}
  70. // CHECK:STDERR: ^
  71. // CHECK:STDERR: fail_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
  72. // CHECK:STDERR: fn Foo(a: C);
  73. // CHECK:STDERR: ^
  74. // CHECK:STDERR:
  75. fn Foo(a: D) {}
  76. // --- fail_deduced_alias.carbon
  77. library "[[@TEST_NAME]]";
  78. class C {}
  79. alias D = C;
  80. fn Foo[a:! C]();
  81. // CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE+7]]:12: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
  82. // CHECK:STDERR: fn Foo[a:! D]() {}
  83. // CHECK:STDERR: ^
  84. // CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:12: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
  85. // CHECK:STDERR: fn Foo[a:! C]();
  86. // CHECK:STDERR: ^
  87. // CHECK:STDERR:
  88. fn Foo[a:! D]() {}
  89. // --- todo_fail_alias_in_return.carbon
  90. library "[[@TEST_NAME]]";
  91. class C {}
  92. alias D = C;
  93. fn Foo() -> C;
  94. fn Foo() -> D { return {}; }
  95. // --- alias_two_file.carbon
  96. library "[[@TEST_NAME]]";
  97. class C {}
  98. fn Foo(a: C);
  99. // --- todo_fail_alias_two_file.impl.carbon
  100. impl library "[[@TEST_NAME]]";
  101. alias D = C;
  102. fn Foo(a: D) {}
  103. // --- fail_repeat_const.carbon
  104. library "[[@TEST_NAME]]";
  105. class C {}
  106. fn Foo(a: const C);
  107. // CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+10]]:11: warning: `const` applied repeatedly to the same type has no additional effect [RepeatedConst]
  108. // CHECK:STDERR: fn Foo(a: const (const C)) {}
  109. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  110. // CHECK:STDERR:
  111. // CHECK:STDERR: fail_repeat_const.carbon:[[@LINE+6]]:17: error: redeclaration syntax differs here [RedeclParamSyntaxDiffers]
  112. // CHECK:STDERR: fn Foo(a: const (const C)) {}
  113. // CHECK:STDERR: ^
  114. // CHECK:STDERR: fail_repeat_const.carbon:[[@LINE-8]]:17: note: comparing with previous declaration here [RedeclParamSyntaxPrevious]
  115. // CHECK:STDERR: fn Foo(a: const C);
  116. // CHECK:STDERR: ^
  117. fn Foo(a: const (const C)) {}
  118. // CHECK:STDOUT: --- basic.carbon
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: constants {
  121. // CHECK:STDOUT: %C: type = class_type @C [template]
  122. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  123. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  124. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  125. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  126. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  127. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  128. // CHECK:STDOUT: }
  129. // CHECK:STDOUT:
  130. // CHECK:STDOUT: file {
  131. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  132. // CHECK:STDOUT: .C = %C.decl
  133. // CHECK:STDOUT: .D = %D
  134. // CHECK:STDOUT: .Foo = %Foo.decl.loc7
  135. // CHECK:STDOUT: .Bar = %Bar.decl.loc10
  136. // CHECK:STDOUT: }
  137. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  138. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  139. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  140. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  141. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  142. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  143. // CHECK:STDOUT: } {
  144. // CHECK:STDOUT: %a.param.loc7: %C = value_param runtime_param0
  145. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  146. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT: %Foo.decl.loc8: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  149. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  150. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  151. // CHECK:STDOUT: } {
  152. // CHECK:STDOUT: %a.param.loc8: %C = value_param runtime_param0
  153. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
  154. // CHECK:STDOUT: %a.loc8: %C = bind_name a, %a.param.loc8
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: %Bar.decl.loc10: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  157. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  158. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  159. // CHECK:STDOUT: } {
  160. // CHECK:STDOUT: %a.param.loc10: %C = value_param runtime_param0
  161. // CHECK:STDOUT: %D.ref.loc10: type = name_ref D, file.%D [template = constants.%C]
  162. // CHECK:STDOUT: %a.loc10: %C = bind_name a, %a.param.loc10
  163. // CHECK:STDOUT: }
  164. // CHECK:STDOUT: %Bar.decl.loc11: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  165. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  166. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  167. // CHECK:STDOUT: } {
  168. // CHECK:STDOUT: %a.param.loc11: %C = value_param runtime_param0
  169. // CHECK:STDOUT: %D.ref.loc11: type = name_ref D, file.%D [template = constants.%C]
  170. // CHECK:STDOUT: %a.loc11: %C = bind_name a, %a.param.loc11
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: class @C {
  175. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  176. // CHECK:STDOUT:
  177. // CHECK:STDOUT: !members:
  178. // CHECK:STDOUT: .Self = constants.%C
  179. // CHECK:STDOUT: complete_type_witness = %complete_type
  180. // CHECK:STDOUT: }
  181. // CHECK:STDOUT:
  182. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C) {
  183. // CHECK:STDOUT: !entry:
  184. // CHECK:STDOUT: return
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: fn @Bar(%a.param_patt: %C) {
  188. // CHECK:STDOUT: !entry:
  189. // CHECK:STDOUT: return
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: --- spacing.carbon
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: constants {
  195. // CHECK:STDOUT: %C: type = class_type @C [template]
  196. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  197. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  198. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  199. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: file {
  203. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  204. // CHECK:STDOUT: .C = %C.decl
  205. // CHECK:STDOUT: .Foo = %Foo.decl.loc6
  206. // CHECK:STDOUT: }
  207. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  208. // CHECK:STDOUT: %Foo.decl.loc6: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  209. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  210. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  211. // CHECK:STDOUT: } {
  212. // CHECK:STDOUT: %a.param.loc6: %C = value_param runtime_param0
  213. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
  214. // CHECK:STDOUT: %a.loc6: %C = bind_name a, %a.param.loc6
  215. // CHECK:STDOUT: }
  216. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  217. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  218. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  219. // CHECK:STDOUT: } {
  220. // CHECK:STDOUT: %a.param.loc7: %C = value_param runtime_param0
  221. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  222. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  223. // CHECK:STDOUT: }
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: class @C {
  227. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  228. // CHECK:STDOUT:
  229. // CHECK:STDOUT: !members:
  230. // CHECK:STDOUT: .Self = constants.%C
  231. // CHECK:STDOUT: complete_type_witness = %complete_type
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: fn @Foo[](%a.param_patt: %C) {
  235. // CHECK:STDOUT: !entry:
  236. // CHECK:STDOUT: return
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: --- fail_parens.carbon
  240. // CHECK:STDOUT:
  241. // CHECK:STDOUT: constants {
  242. // CHECK:STDOUT: %C: type = class_type @C [template]
  243. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  244. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  245. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  246. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  247. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  248. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: file {
  252. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  253. // CHECK:STDOUT: .C = %C.decl
  254. // CHECK:STDOUT: .Foo = %Foo.decl
  255. // CHECK:STDOUT: }
  256. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  257. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  258. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  259. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  260. // CHECK:STDOUT: } {
  261. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  262. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  263. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {
  266. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  267. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  268. // CHECK:STDOUT: } {
  269. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  270. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  271. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT: }
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: class @C {
  276. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: !members:
  279. // CHECK:STDOUT: .Self = constants.%C
  280. // CHECK:STDOUT: complete_type_witness = %complete_type
  281. // CHECK:STDOUT: }
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C);
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: fn @.1(%a.param_patt: %C) {
  286. // CHECK:STDOUT: !entry:
  287. // CHECK:STDOUT: return
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: --- todo_fail_raw_identifier.carbon
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: constants {
  293. // CHECK:STDOUT: %C: type = class_type @C [template]
  294. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  295. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  296. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  297. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: file {
  301. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  302. // CHECK:STDOUT: .C = %C.decl
  303. // CHECK:STDOUT: .Foo = %Foo.decl.loc6
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  306. // CHECK:STDOUT: %Foo.decl.loc6: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  307. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  308. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  309. // CHECK:STDOUT: } {
  310. // CHECK:STDOUT: %a.param.loc6: %C = value_param runtime_param0
  311. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
  312. // CHECK:STDOUT: %a.loc6: %C = bind_name a, %a.param.loc6
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  315. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  316. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  317. // CHECK:STDOUT: } {
  318. // CHECK:STDOUT: %a.param.loc7: %C = value_param runtime_param0
  319. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  320. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT: }
  323. // CHECK:STDOUT:
  324. // CHECK:STDOUT: class @C {
  325. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: !members:
  328. // CHECK:STDOUT: .Self = constants.%C
  329. // CHECK:STDOUT: complete_type_witness = %complete_type
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C) {
  333. // CHECK:STDOUT: !entry:
  334. // CHECK:STDOUT: return
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: --- two_file.carbon
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: constants {
  340. // CHECK:STDOUT: %C: type = class_type @C [template]
  341. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  342. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  343. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  344. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  345. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  346. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: file {
  350. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  351. // CHECK:STDOUT: .C = %C.decl
  352. // CHECK:STDOUT: .D = %D
  353. // CHECK:STDOUT: .Foo = %Foo.decl
  354. // CHECK:STDOUT: .Bar = %Bar.decl
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  357. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  358. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  359. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  360. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  361. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  362. // CHECK:STDOUT: } {
  363. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  364. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  365. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT: %Bar.decl: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  368. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  369. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  370. // CHECK:STDOUT: } {
  371. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  372. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  373. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: class @C {
  378. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: !members:
  381. // CHECK:STDOUT: .Self = constants.%C
  382. // CHECK:STDOUT: complete_type_witness = %complete_type
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT:
  385. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C);
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: fn @Bar(%a.param_patt: %C);
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: --- two_file.impl.carbon
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: constants {
  392. // CHECK:STDOUT: %C: type = class_type @C [template]
  393. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  394. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  395. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  396. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  397. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  398. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: imports {
  402. // CHECK:STDOUT: %import_ref.0ac: type = import_ref Main//two_file, C, loaded [template = constants.%C]
  403. // CHECK:STDOUT: %import_ref.930: type = import_ref Main//two_file, D, loaded [template = constants.%C]
  404. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//two_file, loc4_10, loaded [template = constants.%complete_type]
  405. // CHECK:STDOUT: %import_ref.2c4 = import_ref Main//two_file, inst14 [no loc], unloaded
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: file {
  409. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  410. // CHECK:STDOUT: .C = imports.%import_ref.0ac
  411. // CHECK:STDOUT: .D = imports.%import_ref.930
  412. // CHECK:STDOUT: .Foo = %Foo.decl
  413. // CHECK:STDOUT: .Bar = %Bar.decl
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  416. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  417. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  418. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  419. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  420. // CHECK:STDOUT: } {
  421. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  422. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.0ac [template = constants.%C]
  423. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT: %Bar.decl: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  426. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  427. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  428. // CHECK:STDOUT: } {
  429. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  430. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.930 [template = constants.%C]
  431. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: class @C [from "two_file.carbon"] {
  436. // CHECK:STDOUT: !members:
  437. // CHECK:STDOUT: .Self = imports.%import_ref.2c4
  438. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C) [from "two_file.carbon"] {
  442. // CHECK:STDOUT: !entry:
  443. // CHECK:STDOUT: return
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: fn @Bar(%a.param_patt: %C) [from "two_file.carbon"] {
  447. // CHECK:STDOUT: !entry:
  448. // CHECK:STDOUT: return
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: --- fail_name_mismatch.carbon
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: constants {
  454. // CHECK:STDOUT: %C: type = class_type @C [template]
  455. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  456. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  457. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  458. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  459. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  460. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: file {
  464. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  465. // CHECK:STDOUT: .C = %C.decl
  466. // CHECK:STDOUT: .D = %D
  467. // CHECK:STDOUT: .Foo = %Foo.decl
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  470. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  471. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  472. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  473. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  474. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  475. // CHECK:STDOUT: } {
  476. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  477. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  478. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {
  481. // CHECK:STDOUT: %b.patt: %C = binding_pattern b
  482. // CHECK:STDOUT: %b.param_patt: %C = value_param_pattern %b.patt, runtime_param0
  483. // CHECK:STDOUT: } {
  484. // CHECK:STDOUT: %b.param: %C = value_param runtime_param0
  485. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  486. // CHECK:STDOUT: %b: %C = bind_name b, %b.param
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: class @C {
  491. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: !members:
  494. // CHECK:STDOUT: .Self = constants.%C
  495. // CHECK:STDOUT: complete_type_witness = %complete_type
  496. // CHECK:STDOUT: }
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C);
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: fn @.1(%b.param_patt: %C) {
  501. // CHECK:STDOUT: !entry:
  502. // CHECK:STDOUT: return
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: --- fail_alias.carbon
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: constants {
  508. // CHECK:STDOUT: %C: type = class_type @C [template]
  509. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  510. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  511. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  512. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  513. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  514. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT:
  517. // CHECK:STDOUT: file {
  518. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  519. // CHECK:STDOUT: .C = %C.decl
  520. // CHECK:STDOUT: .D = %D
  521. // CHECK:STDOUT: .Foo = %Foo.decl
  522. // CHECK:STDOUT: }
  523. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  524. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  525. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  526. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  527. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  528. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  529. // CHECK:STDOUT: } {
  530. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  531. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  532. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {
  535. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  536. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  537. // CHECK:STDOUT: } {
  538. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  539. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  540. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT: }
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: class @C {
  545. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: !members:
  548. // CHECK:STDOUT: .Self = constants.%C
  549. // CHECK:STDOUT: complete_type_witness = %complete_type
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C);
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: fn @.1(%a.param_patt: %C) {
  555. // CHECK:STDOUT: !entry:
  556. // CHECK:STDOUT: return
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: --- fail_deduced_alias.carbon
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: constants {
  562. // CHECK:STDOUT: %C: type = class_type @C [template]
  563. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  564. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  565. // CHECK:STDOUT: %a: %C = bind_symbolic_name a, 0 [symbolic]
  566. // CHECK:STDOUT: %a.patt: %C = symbolic_binding_pattern a, 0 [symbolic]
  567. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  568. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  569. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  570. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: file {
  574. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  575. // CHECK:STDOUT: .C = %C.decl
  576. // CHECK:STDOUT: .D = %D
  577. // CHECK:STDOUT: .Foo = %Foo.decl
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  580. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  581. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  582. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  583. // CHECK:STDOUT: %a.patt.loc7_8.1: %C = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc7_8.2 (constants.%a.patt)]
  584. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt.loc7_8.1, runtime_param<invalid> [symbolic = %a.patt.loc7_8.2 (constants.%a.patt)]
  585. // CHECK:STDOUT: } {
  586. // CHECK:STDOUT: %a.param: %C = value_param runtime_param<invalid>
  587. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  588. // CHECK:STDOUT: %a.loc7_8.1: %C = bind_symbolic_name a, 0, %a.param [symbolic = %a.loc7_8.2 (constants.%a)]
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {
  591. // CHECK:STDOUT: %a.patt.loc15_8.1: %C = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_8.2 (constants.%a.patt)]
  592. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt.loc15_8.1, runtime_param<invalid> [symbolic = %a.patt.loc15_8.2 (constants.%a.patt)]
  593. // CHECK:STDOUT: } {
  594. // CHECK:STDOUT: %a.param: %C = value_param runtime_param<invalid>
  595. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  596. // CHECK:STDOUT: %a.loc15_8.1: %C = bind_symbolic_name a, 0, %a.param [symbolic = %a.loc15_8.2 (constants.%a)]
  597. // CHECK:STDOUT: }
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: class @C {
  601. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: !members:
  604. // CHECK:STDOUT: .Self = constants.%C
  605. // CHECK:STDOUT: complete_type_witness = %complete_type
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: generic fn @Foo(%a.loc7_8.1: %C) {
  609. // CHECK:STDOUT: %a.loc7_8.2: %C = bind_symbolic_name a, 0 [symbolic = %a.loc7_8.2 (constants.%a)]
  610. // CHECK:STDOUT: %a.patt.loc7_8.2: %C = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc7_8.2 (constants.%a.patt)]
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: fn[%a.param_patt: %C]();
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: generic fn @.1(%a.loc15_8.1: %C) {
  616. // CHECK:STDOUT: %a.loc15_8.2: %C = bind_symbolic_name a, 0 [symbolic = %a.loc15_8.2 (constants.%a)]
  617. // CHECK:STDOUT: %a.patt.loc15_8.2: %C = symbolic_binding_pattern a, 0 [symbolic = %a.patt.loc15_8.2 (constants.%a.patt)]
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: !definition:
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: fn[%a.param_patt: %C]() {
  622. // CHECK:STDOUT: !entry:
  623. // CHECK:STDOUT: return
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: }
  626. // CHECK:STDOUT:
  627. // CHECK:STDOUT: specific @Foo(constants.%a) {
  628. // CHECK:STDOUT: %a.loc7_8.2 => constants.%a
  629. // CHECK:STDOUT: %a.patt.loc7_8.2 => constants.%a
  630. // CHECK:STDOUT: }
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: specific @.1(constants.%a) {
  633. // CHECK:STDOUT: %a.loc15_8.2 => constants.%a
  634. // CHECK:STDOUT: %a.patt.loc15_8.2 => constants.%a
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: --- todo_fail_alias_in_return.carbon
  638. // CHECK:STDOUT:
  639. // CHECK:STDOUT: constants {
  640. // CHECK:STDOUT: %C: type = class_type @C [template]
  641. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  642. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  643. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  644. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  645. // CHECK:STDOUT: %C.val: %C = struct_value () [template]
  646. // CHECK:STDOUT: }
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: file {
  649. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  650. // CHECK:STDOUT: .C = %C.decl
  651. // CHECK:STDOUT: .D = %D
  652. // CHECK:STDOUT: .Foo = %Foo.decl.loc7
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  655. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  656. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  657. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  658. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  659. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  660. // CHECK:STDOUT: } {
  661. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  662. // CHECK:STDOUT: %return.param.loc7: ref %C = out_param runtime_param0
  663. // CHECK:STDOUT: %return.loc7: ref %C = return_slot %return.param.loc7
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: %Foo.decl.loc8: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  666. // CHECK:STDOUT: %return.patt: %C = return_slot_pattern
  667. // CHECK:STDOUT: %return.param_patt: %C = out_param_pattern %return.patt, runtime_param0
  668. // CHECK:STDOUT: } {
  669. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  670. // CHECK:STDOUT: %return.param.loc8: ref %C = out_param runtime_param0
  671. // CHECK:STDOUT: %return.loc8: ref %C = return_slot %return.param.loc8
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: class @C {
  676. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: !members:
  679. // CHECK:STDOUT: .Self = constants.%C
  680. // CHECK:STDOUT: complete_type_witness = %complete_type
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: fn @Foo() -> %return.param_patt: %C {
  684. // CHECK:STDOUT: !entry:
  685. // CHECK:STDOUT: %.loc8_25.1: %empty_struct_type = struct_literal ()
  686. // CHECK:STDOUT: %.loc8_25.2: init %C = class_init (), %return.loc8 [template = constants.%C.val]
  687. // CHECK:STDOUT: %.loc8_26: init %C = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%C.val]
  688. // CHECK:STDOUT: return %.loc8_26 to %return.loc8
  689. // CHECK:STDOUT: }
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: --- alias_two_file.carbon
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: constants {
  694. // CHECK:STDOUT: %C: type = class_type @C [template]
  695. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  696. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  697. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  698. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: file {
  702. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  703. // CHECK:STDOUT: .C = %C.decl
  704. // CHECK:STDOUT: .Foo = %Foo.decl
  705. // CHECK:STDOUT: }
  706. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  707. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  708. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  709. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  710. // CHECK:STDOUT: } {
  711. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  712. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  713. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  714. // CHECK:STDOUT: }
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: class @C {
  718. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: !members:
  721. // CHECK:STDOUT: .Self = constants.%C
  722. // CHECK:STDOUT: complete_type_witness = %complete_type
  723. // CHECK:STDOUT: }
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C);
  726. // CHECK:STDOUT:
  727. // CHECK:STDOUT: --- todo_fail_alias_two_file.impl.carbon
  728. // CHECK:STDOUT:
  729. // CHECK:STDOUT: constants {
  730. // CHECK:STDOUT: %C: type = class_type @C [template]
  731. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  732. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  733. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  734. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  735. // CHECK:STDOUT: }
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: imports {
  738. // CHECK:STDOUT: %import_ref.0ac: type = import_ref Main//alias_two_file, C, loaded [template = constants.%C]
  739. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//alias_two_file, loc4_10, loaded [template = constants.%complete_type]
  740. // CHECK:STDOUT: %import_ref.2c4 = import_ref Main//alias_two_file, inst14 [no loc], unloaded
  741. // CHECK:STDOUT: }
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: file {
  744. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  745. // CHECK:STDOUT: .C = imports.%import_ref.0ac
  746. // CHECK:STDOUT: .Foo = %Foo.decl
  747. // CHECK:STDOUT: .D = %D
  748. // CHECK:STDOUT: }
  749. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  750. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  751. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.0ac [template = constants.%C]
  752. // CHECK:STDOUT: %D: type = bind_alias D, imports.%import_ref.0ac [template = constants.%C]
  753. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  754. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  755. // CHECK:STDOUT: %a.param_patt: %C = value_param_pattern %a.patt, runtime_param0
  756. // CHECK:STDOUT: } {
  757. // CHECK:STDOUT: %a.param: %C = value_param runtime_param0
  758. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  759. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT: }
  762. // CHECK:STDOUT:
  763. // CHECK:STDOUT: class @C [from "alias_two_file.carbon"] {
  764. // CHECK:STDOUT: !members:
  765. // CHECK:STDOUT: .Self = imports.%import_ref.2c4
  766. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  767. // CHECK:STDOUT: }
  768. // CHECK:STDOUT:
  769. // CHECK:STDOUT: fn @Foo(%a.param_patt: %C) [from "alias_two_file.carbon"] {
  770. // CHECK:STDOUT: !entry:
  771. // CHECK:STDOUT: return
  772. // CHECK:STDOUT: }
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: --- fail_repeat_const.carbon
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: constants {
  777. // CHECK:STDOUT: %C: type = class_type @C [template]
  778. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  779. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  780. // CHECK:STDOUT: %const: type = const_type %C [template]
  781. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  782. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  783. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  784. // CHECK:STDOUT: %.d85: %.type = struct_value () [template]
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: file {
  788. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  789. // CHECK:STDOUT: .C = %C.decl
  790. // CHECK:STDOUT: .Foo = %Foo.decl
  791. // CHECK:STDOUT: }
  792. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  793. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  794. // CHECK:STDOUT: %a.patt: %const = binding_pattern a
  795. // CHECK:STDOUT: %a.param_patt: %const = value_param_pattern %a.patt, runtime_param0
  796. // CHECK:STDOUT: } {
  797. // CHECK:STDOUT: %a.param: %const = value_param runtime_param0
  798. // CHECK:STDOUT: %.loc6: type = splice_block %const [template = constants.%const] {
  799. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  800. // CHECK:STDOUT: %const: type = const_type %C [template = constants.%const]
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT: %a: %const = bind_name a, %a.param
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.d85] {
  805. // CHECK:STDOUT: %a.patt: %const = binding_pattern a
  806. // CHECK:STDOUT: %a.param_patt: %const = value_param_pattern %a.patt, runtime_param0
  807. // CHECK:STDOUT: } {
  808. // CHECK:STDOUT: %a.param: %const = value_param runtime_param0
  809. // CHECK:STDOUT: %.loc17: type = splice_block %const.loc17_11 [template = constants.%const] {
  810. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  811. // CHECK:STDOUT: %const.loc17_18: type = const_type %C [template = constants.%const]
  812. // CHECK:STDOUT: %const.loc17_11: type = const_type %const [template = constants.%const]
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: %a: %const = bind_name a, %a.param
  815. // CHECK:STDOUT: }
  816. // CHECK:STDOUT: }
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: class @C {
  819. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  820. // CHECK:STDOUT:
  821. // CHECK:STDOUT: !members:
  822. // CHECK:STDOUT: .Self = constants.%C
  823. // CHECK:STDOUT: complete_type_witness = %complete_type
  824. // CHECK:STDOUT: }
  825. // CHECK:STDOUT:
  826. // CHECK:STDOUT: fn @Foo(%a.param_patt: %const);
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: fn @.1(%a.param_patt: %const) {
  829. // CHECK:STDOUT: !entry:
  830. // CHECK:STDOUT: return
  831. // CHECK:STDOUT: }
  832. // CHECK:STDOUT: