syntactic_merge.carbon 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  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
  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
  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
  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
  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
  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
  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]]:11: error: redeclaration syntax differs here
  82. // CHECK:STDERR: fn Foo[a: D]() {}
  83. // CHECK:STDERR: ^
  84. // CHECK:STDERR: fail_deduced_alias.carbon:[[@LINE-4]]:11: note: comparing with previous declaration here
  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
  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
  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
  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: %.1: type = struct_type {} [template]
  123. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  124. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  125. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  126. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  127. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  128. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  129. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: file {
  133. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  134. // CHECK:STDOUT: .C = %C.decl
  135. // CHECK:STDOUT: .D = %D
  136. // CHECK:STDOUT: .Foo = %Foo.decl.loc7
  137. // CHECK:STDOUT: .Bar = %Bar.decl.loc10
  138. // CHECK:STDOUT: }
  139. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  140. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  141. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  142. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  143. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  144. // CHECK:STDOUT: } {
  145. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  146. // CHECK:STDOUT: %a.param.loc7: %C = param a, runtime_param0
  147. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: %Foo.decl.loc8: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  150. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  151. // CHECK:STDOUT: } {
  152. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [template = constants.%C]
  153. // CHECK:STDOUT: %a.param.loc8: %C = param a, runtime_param0
  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: } {
  159. // CHECK:STDOUT: %D.ref.loc10: type = name_ref D, file.%D [template = constants.%C]
  160. // CHECK:STDOUT: %a.param.loc10: %C = param a, runtime_param0
  161. // CHECK:STDOUT: %a.loc10: %C = bind_name a, %a.param.loc10
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %Bar.decl.loc11: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  164. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  165. // CHECK:STDOUT: } {
  166. // CHECK:STDOUT: %D.ref.loc11: type = name_ref D, file.%D [template = constants.%C]
  167. // CHECK:STDOUT: %a.param.loc11: %C = param a, runtime_param0
  168. // CHECK:STDOUT: %a.loc11: %C = bind_name a, %a.param.loc11
  169. // CHECK:STDOUT: }
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: class @C {
  173. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: !members:
  176. // CHECK:STDOUT: .Self = constants.%C
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: fn @Foo(%a.loc8: %C) {
  180. // CHECK:STDOUT: !entry:
  181. // CHECK:STDOUT: return
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: fn @Bar(%a.loc11: %C) {
  185. // CHECK:STDOUT: !entry:
  186. // CHECK:STDOUT: return
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: --- spacing.carbon
  190. // CHECK:STDOUT:
  191. // CHECK:STDOUT: constants {
  192. // CHECK:STDOUT: %C: type = class_type @C [template]
  193. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  194. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  195. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  196. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  197. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  198. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT:
  201. // CHECK:STDOUT: file {
  202. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  203. // CHECK:STDOUT: .C = %C.decl
  204. // CHECK:STDOUT: .Foo = %Foo.decl.loc6
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  207. // CHECK:STDOUT: %Foo.decl.loc6: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  208. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  209. // CHECK:STDOUT: } {
  210. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
  211. // CHECK:STDOUT: %a.param.loc6: %C = param a, runtime_param0
  212. // CHECK:STDOUT: %a.loc6: %C = bind_name a, %a.param.loc6
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  215. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  216. // CHECK:STDOUT: } {
  217. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  218. // CHECK:STDOUT: %a.param.loc7: %C = param a, runtime_param0
  219. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: class @C {
  224. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: !members:
  227. // CHECK:STDOUT: .Self = constants.%C
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: fn @Foo[](%a.loc7: %C) {
  231. // CHECK:STDOUT: !entry:
  232. // CHECK:STDOUT: return
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: --- fail_parens.carbon
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: constants {
  238. // CHECK:STDOUT: %C: type = class_type @C [template]
  239. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  240. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  241. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  242. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  243. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  244. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  245. // CHECK:STDOUT: %.4: %.type = struct_value () [template]
  246. // CHECK:STDOUT: %.5: type = ptr_type %.1 [template]
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: file {
  250. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  251. // CHECK:STDOUT: .C = %C.decl
  252. // CHECK:STDOUT: .Foo = %Foo.decl
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  255. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  256. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  257. // CHECK:STDOUT: } {
  258. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  259. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  260. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.4] {
  263. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  264. // CHECK:STDOUT: } {
  265. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  266. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  267. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: }
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: class @C {
  272. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: !members:
  275. // CHECK:STDOUT: .Self = constants.%C
  276. // CHECK:STDOUT: }
  277. // CHECK:STDOUT:
  278. // CHECK:STDOUT: fn @Foo(%a: %C);
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: fn @.1(%a: %C) {
  281. // CHECK:STDOUT: !entry:
  282. // CHECK:STDOUT: return
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT:
  285. // CHECK:STDOUT: --- todo_fail_raw_identifier.carbon
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: constants {
  288. // CHECK:STDOUT: %C: type = class_type @C [template]
  289. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  290. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  291. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  292. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  293. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  294. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: file {
  298. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  299. // CHECK:STDOUT: .C = %C.decl
  300. // CHECK:STDOUT: .Foo = %Foo.decl.loc6
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  303. // CHECK:STDOUT: %Foo.decl.loc6: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  304. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  305. // CHECK:STDOUT: } {
  306. // CHECK:STDOUT: %C.ref.loc6: type = name_ref C, file.%C.decl [template = constants.%C]
  307. // CHECK:STDOUT: %a.param.loc6: %C = param a, runtime_param0
  308. // CHECK:STDOUT: %a.loc6: %C = bind_name a, %a.param.loc6
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  311. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  312. // CHECK:STDOUT: } {
  313. // CHECK:STDOUT: %C.ref.loc7: type = name_ref C, file.%C.decl [template = constants.%C]
  314. // CHECK:STDOUT: %a.param.loc7: %C = param a, runtime_param0
  315. // CHECK:STDOUT: %a.loc7: %C = bind_name a, %a.param.loc7
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: class @C {
  320. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: !members:
  323. // CHECK:STDOUT: .Self = constants.%C
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: fn @Foo(%a.loc7: %C) {
  327. // CHECK:STDOUT: !entry:
  328. // CHECK:STDOUT: return
  329. // CHECK:STDOUT: }
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: --- two_file.carbon
  332. // CHECK:STDOUT:
  333. // CHECK:STDOUT: constants {
  334. // CHECK:STDOUT: %C: type = class_type @C [template]
  335. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  336. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  337. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  338. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  339. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  340. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  341. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT:
  344. // CHECK:STDOUT: file {
  345. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  346. // CHECK:STDOUT: .C = %C.decl
  347. // CHECK:STDOUT: .D = %D
  348. // CHECK:STDOUT: .Foo = %Foo.decl
  349. // CHECK:STDOUT: .Bar = %Bar.decl
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  352. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  353. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  354. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  355. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  356. // CHECK:STDOUT: } {
  357. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  358. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  359. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: %Bar.decl: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  362. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  363. // CHECK:STDOUT: } {
  364. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  365. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  366. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: class @C {
  371. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: !members:
  374. // CHECK:STDOUT: .Self = constants.%C
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: fn @Foo(%a: %C);
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: fn @Bar(%a: %C);
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: --- two_file.impl.carbon
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: constants {
  384. // CHECK:STDOUT: %C: type = class_type @C [template]
  385. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  386. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  387. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  388. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  389. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  390. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  391. // CHECK:STDOUT: %Bar.type: type = fn_type @Bar [template]
  392. // CHECK:STDOUT: %Bar: %Bar.type = struct_value () [template]
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: imports {
  396. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//two_file, inst+1, loaded [template = constants.%C]
  397. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//two_file, inst+7, loaded [template = constants.%C]
  398. // CHECK:STDOUT: %import_ref.3: %Foo.type = import_ref Main//two_file, inst+12, loaded [template = constants.%Foo]
  399. // CHECK:STDOUT: %import_ref.4: %Bar.type = import_ref Main//two_file, inst+20, loaded [template = constants.%Bar]
  400. // CHECK:STDOUT: %import_ref.5 = import_ref Main//two_file, inst+2, unloaded
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: file {
  404. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  405. // CHECK:STDOUT: .C = imports.%import_ref.1
  406. // CHECK:STDOUT: .D = imports.%import_ref.2
  407. // CHECK:STDOUT: .Foo = %Foo.decl
  408. // CHECK:STDOUT: .Bar = %Bar.decl
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  411. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  412. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  413. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  414. // CHECK:STDOUT: } {
  415. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  416. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  417. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: %Bar.decl: %Bar.type = fn_decl @Bar [template = constants.%Bar] {
  420. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  421. // CHECK:STDOUT: } {
  422. // CHECK:STDOUT: %D.ref: type = name_ref D, imports.%import_ref.2 [template = constants.%C]
  423. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  424. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: class @C {
  429. // CHECK:STDOUT: !members:
  430. // CHECK:STDOUT: .Self = imports.%import_ref.5
  431. // CHECK:STDOUT: }
  432. // CHECK:STDOUT:
  433. // CHECK:STDOUT: fn @Foo(%a: %C) {
  434. // CHECK:STDOUT: !entry:
  435. // CHECK:STDOUT: return
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: fn @Bar(%a: %C) {
  439. // CHECK:STDOUT: !entry:
  440. // CHECK:STDOUT: return
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: --- fail_name_mismatch.carbon
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: constants {
  446. // CHECK:STDOUT: %C: type = class_type @C [template]
  447. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  448. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  449. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  450. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  451. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  452. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  453. // CHECK:STDOUT: %.4: %.type = struct_value () [template]
  454. // CHECK:STDOUT: %.5: type = ptr_type %.1 [template]
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: file {
  458. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  459. // CHECK:STDOUT: .C = %C.decl
  460. // CHECK:STDOUT: .D = %D
  461. // CHECK:STDOUT: .Foo = %Foo.decl
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  464. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  465. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  466. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  467. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  468. // CHECK:STDOUT: } {
  469. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  470. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  471. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.4] {
  474. // CHECK:STDOUT: %b.patt: %C = binding_pattern b
  475. // CHECK:STDOUT: } {
  476. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  477. // CHECK:STDOUT: %b.param: %C = param b, runtime_param0
  478. // CHECK:STDOUT: %b: %C = bind_name b, %b.param
  479. // CHECK:STDOUT: }
  480. // CHECK:STDOUT: }
  481. // CHECK:STDOUT:
  482. // CHECK:STDOUT: class @C {
  483. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  484. // CHECK:STDOUT:
  485. // CHECK:STDOUT: !members:
  486. // CHECK:STDOUT: .Self = constants.%C
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT:
  489. // CHECK:STDOUT: fn @Foo(%a: %C);
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: fn @.1(%b: %C) {
  492. // CHECK:STDOUT: !entry:
  493. // CHECK:STDOUT: return
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT:
  496. // CHECK:STDOUT: --- fail_alias.carbon
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: constants {
  499. // CHECK:STDOUT: %C: type = class_type @C [template]
  500. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  501. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  502. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  503. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  504. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  505. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  506. // CHECK:STDOUT: %.4: %.type = struct_value () [template]
  507. // CHECK:STDOUT: %.5: type = ptr_type %.1 [template]
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT:
  510. // CHECK:STDOUT: file {
  511. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  512. // CHECK:STDOUT: .C = %C.decl
  513. // CHECK:STDOUT: .D = %D
  514. // CHECK:STDOUT: .Foo = %Foo.decl
  515. // CHECK:STDOUT: }
  516. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  517. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  518. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  519. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  520. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  521. // CHECK:STDOUT: } {
  522. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  523. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  524. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.4] {
  527. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  528. // CHECK:STDOUT: } {
  529. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  530. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  531. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: class @C {
  536. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: !members:
  539. // CHECK:STDOUT: .Self = constants.%C
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: fn @Foo(%a: %C);
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: fn @.1(%a: %C) {
  545. // CHECK:STDOUT: !entry:
  546. // CHECK:STDOUT: return
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT:
  549. // CHECK:STDOUT: --- fail_deduced_alias.carbon
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: constants {
  552. // CHECK:STDOUT: %C: type = class_type @C [template]
  553. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  554. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  555. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  556. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  557. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  558. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  559. // CHECK:STDOUT: %.4: %.type = struct_value () [template]
  560. // CHECK:STDOUT: %.5: type = ptr_type %.1 [template]
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: file {
  564. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  565. // CHECK:STDOUT: .C = %C.decl
  566. // CHECK:STDOUT: .D = %D
  567. // CHECK:STDOUT: .Foo = %Foo.decl
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  570. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  571. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  572. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  573. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  574. // CHECK:STDOUT: } {
  575. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  576. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  577. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  578. // CHECK:STDOUT: }
  579. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.4] {
  580. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  581. // CHECK:STDOUT: } {
  582. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  583. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  584. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: class @C {
  589. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: !members:
  592. // CHECK:STDOUT: .Self = constants.%C
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: fn @Foo[%a: %C]();
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: fn @.1[%a: %C]() {
  598. // CHECK:STDOUT: !entry:
  599. // CHECK:STDOUT: return
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: --- todo_fail_alias_in_return.carbon
  603. // CHECK:STDOUT:
  604. // CHECK:STDOUT: constants {
  605. // CHECK:STDOUT: %C: type = class_type @C [template]
  606. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  607. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  608. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  609. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  610. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  611. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  612. // CHECK:STDOUT: %struct: %C = struct_value () [template]
  613. // CHECK:STDOUT: }
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: file {
  616. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  617. // CHECK:STDOUT: .C = %C.decl
  618. // CHECK:STDOUT: .D = %D
  619. // CHECK:STDOUT: .Foo = %Foo.decl.loc7
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  622. // CHECK:STDOUT: %C.ref: type = name_ref C, %C.decl [template = constants.%C]
  623. // CHECK:STDOUT: %D: type = bind_alias D, %C.decl [template = constants.%C]
  624. // CHECK:STDOUT: %Foo.decl.loc7: %Foo.type = fn_decl @Foo [template = constants.%Foo] {} {
  625. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  626. // CHECK:STDOUT: %return.var.loc7: ref %C = var <return slot>
  627. // CHECK:STDOUT: }
  628. // CHECK:STDOUT: %Foo.decl.loc8: %Foo.type = fn_decl @Foo [template = constants.%Foo] {} {
  629. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  630. // CHECK:STDOUT: %return: ref %C = var <return slot>
  631. // CHECK:STDOUT: }
  632. // CHECK:STDOUT: }
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: class @C {
  635. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: !members:
  638. // CHECK:STDOUT: .Self = constants.%C
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: fn @Foo() -> %return: %C {
  642. // CHECK:STDOUT: !entry:
  643. // CHECK:STDOUT: %.loc8_25.1: %.1 = struct_literal ()
  644. // CHECK:STDOUT: %.loc8_25.2: init %C = class_init (), %return [template = constants.%struct]
  645. // CHECK:STDOUT: %.loc8_26: init %C = converted %.loc8_25.1, %.loc8_25.2 [template = constants.%struct]
  646. // CHECK:STDOUT: return %.loc8_26 to %return
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: --- alias_two_file.carbon
  650. // CHECK:STDOUT:
  651. // CHECK:STDOUT: constants {
  652. // CHECK:STDOUT: %C: type = class_type @C [template]
  653. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  654. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  655. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  656. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  657. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  658. // CHECK:STDOUT: }
  659. // CHECK:STDOUT:
  660. // CHECK:STDOUT: file {
  661. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  662. // CHECK:STDOUT: .C = %C.decl
  663. // CHECK:STDOUT: .Foo = %Foo.decl
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  666. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  667. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  668. // CHECK:STDOUT: } {
  669. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  670. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  671. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT: }
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: class @C {
  676. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: !members:
  679. // CHECK:STDOUT: .Self = constants.%C
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: fn @Foo(%a: %C);
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: --- todo_fail_alias_two_file.impl.carbon
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: constants {
  687. // CHECK:STDOUT: %C: type = class_type @C [template]
  688. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  689. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  690. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  691. // CHECK:STDOUT: %.3: type = tuple_type () [template]
  692. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  693. // CHECK:STDOUT: %.4: type = ptr_type %.1 [template]
  694. // CHECK:STDOUT: }
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: imports {
  697. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//alias_two_file, inst+1, loaded [template = constants.%C]
  698. // CHECK:STDOUT: %import_ref.2: %Foo.type = import_ref Main//alias_two_file, inst+10, loaded [template = constants.%Foo]
  699. // CHECK:STDOUT: %import_ref.3 = import_ref Main//alias_two_file, inst+2, unloaded
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: file {
  703. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  704. // CHECK:STDOUT: .C = imports.%import_ref.1
  705. // CHECK:STDOUT: .Foo = %Foo.decl
  706. // CHECK:STDOUT: .D = %D
  707. // CHECK:STDOUT: }
  708. // CHECK:STDOUT: %default.import.loc2_6.1 = import <invalid>
  709. // CHECK:STDOUT: %default.import.loc2_6.2 = import <invalid>
  710. // CHECK:STDOUT: %C.ref: type = name_ref C, imports.%import_ref.1 [template = constants.%C]
  711. // CHECK:STDOUT: %D: type = bind_alias D, imports.%import_ref.1 [template = constants.%C]
  712. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  713. // CHECK:STDOUT: %a.patt: %C = binding_pattern a
  714. // CHECK:STDOUT: } {
  715. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D [template = constants.%C]
  716. // CHECK:STDOUT: %a.param: %C = param a, runtime_param0
  717. // CHECK:STDOUT: %a: %C = bind_name a, %a.param
  718. // CHECK:STDOUT: }
  719. // CHECK:STDOUT: }
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: class @C {
  722. // CHECK:STDOUT: !members:
  723. // CHECK:STDOUT: .Self = imports.%import_ref.3
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: fn @Foo(%a: %C) {
  727. // CHECK:STDOUT: !entry:
  728. // CHECK:STDOUT: return
  729. // CHECK:STDOUT: }
  730. // CHECK:STDOUT:
  731. // CHECK:STDOUT: --- fail_repeat_const.carbon
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: constants {
  734. // CHECK:STDOUT: %C: type = class_type @C [template]
  735. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  736. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  737. // CHECK:STDOUT: %.3: type = const_type %C [template]
  738. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  739. // CHECK:STDOUT: %.4: type = tuple_type () [template]
  740. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  741. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  742. // CHECK:STDOUT: %.5: %.type = struct_value () [template]
  743. // CHECK:STDOUT: %.6: type = ptr_type %.1 [template]
  744. // CHECK:STDOUT: }
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: file {
  747. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  748. // CHECK:STDOUT: .C = %C.decl
  749. // CHECK:STDOUT: .Foo = %Foo.decl
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  752. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  753. // CHECK:STDOUT: %a.patt: %.3 = binding_pattern a
  754. // CHECK:STDOUT: } {
  755. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  756. // CHECK:STDOUT: %.loc6: type = const_type %C [template = constants.%.3]
  757. // CHECK:STDOUT: %a.param: %.3 = param a, runtime_param0
  758. // CHECK:STDOUT: %a: %.3 = bind_name a, %a.param
  759. // CHECK:STDOUT: }
  760. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.5] {
  761. // CHECK:STDOUT: %a.patt: %.3 = binding_pattern a
  762. // CHECK:STDOUT: } {
  763. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  764. // CHECK:STDOUT: %.loc17_18: type = const_type %C [template = constants.%.3]
  765. // CHECK:STDOUT: %.loc17_11: type = const_type %.3 [template = constants.%.3]
  766. // CHECK:STDOUT: %a.param: %.3 = param a, runtime_param0
  767. // CHECK:STDOUT: %a: %.3 = bind_name a, %a.param
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT: }
  770. // CHECK:STDOUT:
  771. // CHECK:STDOUT: class @C {
  772. // CHECK:STDOUT: %.loc4: <witness> = complete_type_witness %.1 [template = constants.%.2]
  773. // CHECK:STDOUT:
  774. // CHECK:STDOUT: !members:
  775. // CHECK:STDOUT: .Self = constants.%C
  776. // CHECK:STDOUT: }
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: fn @Foo(%a: %.3);
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: fn @.1(%a: %.3) {
  781. // CHECK:STDOUT: !entry:
  782. // CHECK:STDOUT: return
  783. // CHECK:STDOUT: }
  784. // CHECK:STDOUT: