redeclare.carbon 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/convert.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/class/generic/redeclare.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/redeclare.carbon
  14. // --- valid.carbon
  15. library "[[@TEST_NAME]]";
  16. class Generic(T:! type);
  17. class Generic(T:! type) {
  18. }
  19. // --- fail_mismatch_param_list.carbon
  20. library "[[@TEST_NAME]]";
  21. class A;
  22. // CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter list [RedeclParamListDiffers]
  23. // CHECK:STDERR: class A(T:! type) {}
  24. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  25. // CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-4]]:1: note: previously declared without parameter list [RedeclParamListPrevious]
  26. // CHECK:STDERR: class A;
  27. // CHECK:STDERR: ^~~~~~~~
  28. // CHECK:STDERR:
  29. class A(T:! type) {}
  30. // --- fail_mismatch_implicit_param_list.carbon
  31. library "[[@TEST_NAME]]";
  32. class A {}
  33. class B(N:! A);
  34. // CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE+7]]:1: error: redeclaration differs because of implicit parameter list [RedeclParamListDiffers]
  35. // CHECK:STDERR: class B[T:! type](N:! T) {}
  36. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  37. // CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-4]]:1: note: previously declared without implicit parameter list [RedeclParamListPrevious]
  38. // CHECK:STDERR: class B(N:! A);
  39. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  40. // CHECK:STDERR:
  41. class B[T:! type](N:! T) {}
  42. // --- fail_mismatch_param_count.carbon
  43. library "[[@TEST_NAME]]";
  44. class A {}
  45. class C(T:! type);
  46. // CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE+7]]:1: error: redeclaration differs because of parameter count of 2 [RedeclParamCountDiffers]
  47. // CHECK:STDERR: class C(T:! type, U:! A) {}
  48. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  49. // CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-4]]:1: note: previously declared with parameter count of 1 [RedeclParamCountPrevious]
  50. // CHECK:STDERR: class C(T:! type);
  51. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  52. // CHECK:STDERR:
  53. class C(T:! type, U:! A) {}
  54. // --- fail_mismatch_param_type.carbon
  55. library "[[@TEST_NAME]]";
  56. class A {}
  57. class D(T:! type);
  58. // CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE+7]]:9: error: type `<pattern for A>` of parameter 1 in redeclaration differs from previous parameter type `<pattern for type>` [RedeclParamDiffersType]
  59. // CHECK:STDERR: class D(T:! A) {}
  60. // CHECK:STDERR: ^
  61. // CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
  62. // CHECK:STDERR: class D(T:! type);
  63. // CHECK:STDERR: ^
  64. // CHECK:STDERR:
  65. class D(T:! A) {}
  66. // --- fail_mismatch_param_name.carbon
  67. library "[[@TEST_NAME]]";
  68. class E(T:! type);
  69. // CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE+7]]:9: error: redeclaration differs at parameter 1 [RedeclParamDiffers]
  70. // CHECK:STDERR: class E(U:! type) {}
  71. // CHECK:STDERR: ^
  72. // CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-4]]:9: note: previous declaration's corresponding parameter here [RedeclParamPrevious]
  73. // CHECK:STDERR: class E(T:! type);
  74. // CHECK:STDERR: ^
  75. // CHECK:STDERR:
  76. class E(U:! type) {}
  77. // CHECK:STDOUT: --- valid.carbon
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: constants {
  80. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  81. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  82. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [concrete]
  83. // CHECK:STDOUT: %Generic.generic: %Generic.type = struct_value () [concrete]
  84. // CHECK:STDOUT: %Generic: type = class_type @Generic, @Generic(%T) [symbolic]
  85. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  86. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  87. // CHECK:STDOUT: }
  88. // CHECK:STDOUT:
  89. // CHECK:STDOUT: imports {
  90. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  91. // CHECK:STDOUT: import Core//prelude
  92. // CHECK:STDOUT: import Core//prelude/...
  93. // CHECK:STDOUT: }
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: file {
  97. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  98. // CHECK:STDOUT: .Core = imports.%Core
  99. // CHECK:STDOUT: .Generic = %Generic.decl.loc4
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: %Core.import = import Core
  102. // CHECK:STDOUT: %Generic.decl.loc4: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
  103. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  104. // CHECK:STDOUT: } {
  105. // CHECK:STDOUT: %T.loc4_15.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_15.2 (constants.%T)]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: %Generic.decl.loc6: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
  108. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  109. // CHECK:STDOUT: } {
  110. // CHECK:STDOUT: %T.loc6: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_15.2 (constants.%T)]
  111. // CHECK:STDOUT: }
  112. // CHECK:STDOUT: }
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: generic class @Generic(%T.loc4_15.1: type) {
  115. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_15.2 (constants.%T)]
  116. // CHECK:STDOUT:
  117. // CHECK:STDOUT: !definition:
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: class {
  120. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  121. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  122. // CHECK:STDOUT: complete_type_witness = %complete_type
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: !members:
  125. // CHECK:STDOUT: .Self = constants.%Generic
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT: }
  128. // CHECK:STDOUT:
  129. // CHECK:STDOUT: specific @Generic(constants.%T) {
  130. // CHECK:STDOUT: %T.loc4_15.2 => constants.%T
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: --- fail_mismatch_param_list.carbon
  134. // CHECK:STDOUT:
  135. // CHECK:STDOUT: constants {
  136. // CHECK:STDOUT: %A.466: type = class_type @A.loc4 [concrete]
  137. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  138. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  139. // CHECK:STDOUT: %A.type: type = generic_class_type @A.loc12 [concrete]
  140. // CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete]
  141. // CHECK:STDOUT: %A.130: type = class_type @A.loc12, @A.loc12(%T) [symbolic]
  142. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  143. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  144. // CHECK:STDOUT: }
  145. // CHECK:STDOUT:
  146. // CHECK:STDOUT: imports {
  147. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  148. // CHECK:STDOUT: import Core//prelude
  149. // CHECK:STDOUT: import Core//prelude/...
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT: }
  152. // CHECK:STDOUT:
  153. // CHECK:STDOUT: file {
  154. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  155. // CHECK:STDOUT: .Core = imports.%Core
  156. // CHECK:STDOUT: .A = %A.decl.loc4
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %Core.import = import Core
  159. // CHECK:STDOUT: %A.decl.loc4: type = class_decl @A.loc4 [concrete = constants.%A.466] {} {}
  160. // CHECK:STDOUT: %A.decl.loc12: %A.type = class_decl @A.loc12 [concrete = constants.%A.generic] {
  161. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  162. // CHECK:STDOUT: } {
  163. // CHECK:STDOUT: %T.loc12_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
  164. // CHECK:STDOUT: }
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: class @A.loc4;
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: generic class @A.loc12(%T.loc12_9.1: type) {
  170. // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc12_9.2 (constants.%T)]
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: !definition:
  173. // CHECK:STDOUT:
  174. // CHECK:STDOUT: class {
  175. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  176. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  177. // CHECK:STDOUT: complete_type_witness = %complete_type
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: !members:
  180. // CHECK:STDOUT: .Self = constants.%A.130
  181. // CHECK:STDOUT: }
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: specific @A.loc12(constants.%T) {
  185. // CHECK:STDOUT: %T.loc12_9.2 => constants.%T
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT:
  188. // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: constants {
  191. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  192. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  193. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  194. // CHECK:STDOUT: %N.9e6: %A = bind_symbolic_name N, 0 [symbolic]
  195. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  196. // CHECK:STDOUT: %B.type.844c0f.1: type = generic_class_type @B.loc6 [concrete]
  197. // CHECK:STDOUT: %B.generic.ba299b.1: %B.type.844c0f.1 = struct_value () [concrete]
  198. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  199. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  200. // CHECK:STDOUT: %N.f22: %T = bind_symbolic_name N, 1 [symbolic]
  201. // CHECK:STDOUT: %pattern_type.7dc: type = pattern_type %T [symbolic]
  202. // CHECK:STDOUT: %B.type.844c0f.2: type = generic_class_type @B.loc14 [concrete]
  203. // CHECK:STDOUT: %B.generic.ba299b.2: %B.type.844c0f.2 = struct_value () [concrete]
  204. // CHECK:STDOUT: %B.828: type = class_type @B.loc14, @B.loc14(%T, %N.f22) [symbolic]
  205. // CHECK:STDOUT: }
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: imports {
  208. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  209. // CHECK:STDOUT: import Core//prelude
  210. // CHECK:STDOUT: import Core//prelude/...
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: file {
  215. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  216. // CHECK:STDOUT: .Core = imports.%Core
  217. // CHECK:STDOUT: .A = %A.decl
  218. // CHECK:STDOUT: .B = %B.decl.loc6
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %Core.import = import Core
  221. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  222. // CHECK:STDOUT: %B.decl.loc6: %B.type.844c0f.1 = class_decl @B.loc6 [concrete = constants.%B.generic.ba299b.1] {
  223. // CHECK:STDOUT: %N.patt: %pattern_type.c10 = symbolic_binding_pattern N, 0 [concrete]
  224. // CHECK:STDOUT: } {
  225. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  226. // CHECK:STDOUT: %N.loc6_9.1: %A = bind_symbolic_name N, 0 [symbolic = %N.loc6_9.2 (constants.%N.9e6)]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: %B.decl.loc14: %B.type.844c0f.2 = class_decl @B.loc14 [concrete = constants.%B.generic.ba299b.2] {
  229. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  230. // CHECK:STDOUT: %N.patt: @B.loc14.%pattern_type (%pattern_type.7dc) = symbolic_binding_pattern N, 1 [concrete]
  231. // CHECK:STDOUT: } {
  232. // CHECK:STDOUT: %T.loc14_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
  233. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_9.1 [symbolic = %T.loc14_9.2 (constants.%T)]
  234. // CHECK:STDOUT: %N.loc14_19.1: @B.loc14.%T.loc14_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc14_19.2 (constants.%N.f22)]
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: class @A {
  239. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  240. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  241. // CHECK:STDOUT: complete_type_witness = %complete_type
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: !members:
  244. // CHECK:STDOUT: .Self = constants.%A
  245. // CHECK:STDOUT: }
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: generic class @B.loc6(%N.loc6_9.1: %A) {
  248. // CHECK:STDOUT: %N.loc6_9.2: %A = bind_symbolic_name N, 0 [symbolic = %N.loc6_9.2 (constants.%N.9e6)]
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: class;
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: generic class @B.loc14(%T.loc14_9.1: type, %N.loc14_19.1: @B.loc14.%T.loc14_9.2 (%T)) {
  254. // CHECK:STDOUT: %T.loc14_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
  255. // CHECK:STDOUT: %N.loc14_19.2: @B.loc14.%T.loc14_9.2 (%T) = bind_symbolic_name N, 1 [symbolic = %N.loc14_19.2 (constants.%N.f22)]
  256. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc14_9.2 [symbolic = %pattern_type (constants.%pattern_type.7dc)]
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: !definition:
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: class {
  261. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  262. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  263. // CHECK:STDOUT: complete_type_witness = %complete_type
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: !members:
  266. // CHECK:STDOUT: .Self = constants.%B.828
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: specific @B.loc6(constants.%N.9e6) {
  271. // CHECK:STDOUT: %N.loc6_9.2 => constants.%N.9e6
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: specific @B.loc14(constants.%T, constants.%N.f22) {
  275. // CHECK:STDOUT: %T.loc14_9.2 => constants.%T
  276. // CHECK:STDOUT: %N.loc14_19.2 => constants.%N.f22
  277. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.7dc
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: --- fail_mismatch_param_count.carbon
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: constants {
  283. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  284. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  285. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  286. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  287. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  288. // CHECK:STDOUT: %C.type.e6e560.1: type = generic_class_type @C.loc6 [concrete]
  289. // CHECK:STDOUT: %C.generic.965b12.1: %C.type.e6e560.1 = struct_value () [concrete]
  290. // CHECK:STDOUT: %U: %A = bind_symbolic_name U, 1 [symbolic]
  291. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  292. // CHECK:STDOUT: %C.type.e6e560.2: type = generic_class_type @C.loc14 [concrete]
  293. // CHECK:STDOUT: %C.generic.965b12.2: %C.type.e6e560.2 = struct_value () [concrete]
  294. // CHECK:STDOUT: %C.3d8: type = class_type @C.loc14, @C.loc14(%T, %U) [symbolic]
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: imports {
  298. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  299. // CHECK:STDOUT: import Core//prelude
  300. // CHECK:STDOUT: import Core//prelude/...
  301. // CHECK:STDOUT: }
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: file {
  305. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  306. // CHECK:STDOUT: .Core = imports.%Core
  307. // CHECK:STDOUT: .A = %A.decl
  308. // CHECK:STDOUT: .C = %C.decl.loc6
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: %Core.import = import Core
  311. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  312. // CHECK:STDOUT: %C.decl.loc6: %C.type.e6e560.1 = class_decl @C.loc6 [concrete = constants.%C.generic.965b12.1] {
  313. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  314. // CHECK:STDOUT: } {
  315. // CHECK:STDOUT: %T.loc6_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T)]
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT: %C.decl.loc14: %C.type.e6e560.2 = class_decl @C.loc14 [concrete = constants.%C.generic.965b12.2] {
  318. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  319. // CHECK:STDOUT: %U.patt: %pattern_type.c10 = symbolic_binding_pattern U, 1 [concrete]
  320. // CHECK:STDOUT: } {
  321. // CHECK:STDOUT: %T.loc14_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
  322. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  323. // CHECK:STDOUT: %U.loc14_19.1: %A = bind_symbolic_name U, 1 [symbolic = %U.loc14_19.2 (constants.%U)]
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT: }
  326. // CHECK:STDOUT:
  327. // CHECK:STDOUT: class @A {
  328. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  329. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  330. // CHECK:STDOUT: complete_type_witness = %complete_type
  331. // CHECK:STDOUT:
  332. // CHECK:STDOUT: !members:
  333. // CHECK:STDOUT: .Self = constants.%A
  334. // CHECK:STDOUT: }
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: generic class @C.loc6(%T.loc6_9.1: type) {
  337. // CHECK:STDOUT: %T.loc6_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T)]
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: class;
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: generic class @C.loc14(%T.loc14_9.1: type, %U.loc14_19.1: %A) {
  343. // CHECK:STDOUT: %T.loc14_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T)]
  344. // CHECK:STDOUT: %U.loc14_19.2: %A = bind_symbolic_name U, 1 [symbolic = %U.loc14_19.2 (constants.%U)]
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: !definition:
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: class {
  349. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  350. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  351. // CHECK:STDOUT: complete_type_witness = %complete_type
  352. // CHECK:STDOUT:
  353. // CHECK:STDOUT: !members:
  354. // CHECK:STDOUT: .Self = constants.%C.3d8
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT:
  358. // CHECK:STDOUT: specific @C.loc6(constants.%T) {
  359. // CHECK:STDOUT: %T.loc6_9.2 => constants.%T
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: specific @C.loc14(constants.%T, constants.%U) {
  363. // CHECK:STDOUT: %T.loc14_9.2 => constants.%T
  364. // CHECK:STDOUT: %U.loc14_19.2 => constants.%U
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: --- fail_mismatch_param_type.carbon
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: constants {
  370. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  371. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  372. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  373. // CHECK:STDOUT: %T.8b3: type = bind_symbolic_name T, 0 [symbolic]
  374. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  375. // CHECK:STDOUT: %D.type.bbd080.1: type = generic_class_type @D.loc6 [concrete]
  376. // CHECK:STDOUT: %D.generic.4e2319.1: %D.type.bbd080.1 = struct_value () [concrete]
  377. // CHECK:STDOUT: %T.9e6: %A = bind_symbolic_name T, 0 [symbolic]
  378. // CHECK:STDOUT: %pattern_type.c10: type = pattern_type %A [concrete]
  379. // CHECK:STDOUT: %D.type.bbd080.2: type = generic_class_type @D.loc14 [concrete]
  380. // CHECK:STDOUT: %D.generic.4e2319.2: %D.type.bbd080.2 = struct_value () [concrete]
  381. // CHECK:STDOUT: %D.384: type = class_type @D.loc14, @D.loc14(%T.9e6) [symbolic]
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: imports {
  385. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  386. // CHECK:STDOUT: import Core//prelude
  387. // CHECK:STDOUT: import Core//prelude/...
  388. // CHECK:STDOUT: }
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: file {
  392. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  393. // CHECK:STDOUT: .Core = imports.%Core
  394. // CHECK:STDOUT: .A = %A.decl
  395. // CHECK:STDOUT: .D = %D.decl.loc6
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT: %Core.import = import Core
  398. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  399. // CHECK:STDOUT: %D.decl.loc6: %D.type.bbd080.1 = class_decl @D.loc6 [concrete = constants.%D.generic.4e2319.1] {
  400. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  401. // CHECK:STDOUT: } {
  402. // CHECK:STDOUT: %T.loc6_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T.8b3)]
  403. // CHECK:STDOUT: }
  404. // CHECK:STDOUT: %D.decl.loc14: %D.type.bbd080.2 = class_decl @D.loc14 [concrete = constants.%D.generic.4e2319.2] {
  405. // CHECK:STDOUT: %T.patt: %pattern_type.c10 = symbolic_binding_pattern T, 0 [concrete]
  406. // CHECK:STDOUT: } {
  407. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  408. // CHECK:STDOUT: %T.loc14_9.1: %A = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T.9e6)]
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT:
  412. // CHECK:STDOUT: class @A {
  413. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  414. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  415. // CHECK:STDOUT: complete_type_witness = %complete_type
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: !members:
  418. // CHECK:STDOUT: .Self = constants.%A
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: generic class @D.loc6(%T.loc6_9.1: type) {
  422. // CHECK:STDOUT: %T.loc6_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_9.2 (constants.%T.8b3)]
  423. // CHECK:STDOUT:
  424. // CHECK:STDOUT: class;
  425. // CHECK:STDOUT: }
  426. // CHECK:STDOUT:
  427. // CHECK:STDOUT: generic class @D.loc14(%T.loc14_9.1: %A) {
  428. // CHECK:STDOUT: %T.loc14_9.2: %A = bind_symbolic_name T, 0 [symbolic = %T.loc14_9.2 (constants.%T.9e6)]
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: !definition:
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: class {
  433. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  434. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  435. // CHECK:STDOUT: complete_type_witness = %complete_type
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: !members:
  438. // CHECK:STDOUT: .Self = constants.%D.384
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT: }
  441. // CHECK:STDOUT:
  442. // CHECK:STDOUT: specific @D.loc6(constants.%T.8b3) {
  443. // CHECK:STDOUT: %T.loc6_9.2 => constants.%T.8b3
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: specific @D.loc14(constants.%T.9e6) {
  447. // CHECK:STDOUT: %T.loc14_9.2 => constants.%T.9e6
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: --- fail_mismatch_param_name.carbon
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: constants {
  453. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  454. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  455. // CHECK:STDOUT: %E.type.b0f8dc.1: type = generic_class_type @E.loc4 [concrete]
  456. // CHECK:STDOUT: %E.generic.f281ba.1: %E.type.b0f8dc.1 = struct_value () [concrete]
  457. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 0 [symbolic]
  458. // CHECK:STDOUT: %E.type.b0f8dc.2: type = generic_class_type @E.loc12 [concrete]
  459. // CHECK:STDOUT: %E.generic.f281ba.2: %E.type.b0f8dc.2 = struct_value () [concrete]
  460. // CHECK:STDOUT: %E.ec9c10.2: type = class_type @E.loc12, @E.loc12(%U) [symbolic]
  461. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  462. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: imports {
  466. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  467. // CHECK:STDOUT: import Core//prelude
  468. // CHECK:STDOUT: import Core//prelude/...
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT:
  472. // CHECK:STDOUT: file {
  473. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  474. // CHECK:STDOUT: .Core = imports.%Core
  475. // CHECK:STDOUT: .E = %E.decl.loc4
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT: %Core.import = import Core
  478. // CHECK:STDOUT: %E.decl.loc4: %E.type.b0f8dc.1 = class_decl @E.loc4 [concrete = constants.%E.generic.f281ba.1] {
  479. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  480. // CHECK:STDOUT: } {
  481. // CHECK:STDOUT: %T.loc4_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT: %E.decl.loc12: %E.type.b0f8dc.2 = class_decl @E.loc12 [concrete = constants.%E.generic.f281ba.2] {
  484. // CHECK:STDOUT: %U.patt: %pattern_type = symbolic_binding_pattern U, 0 [concrete]
  485. // CHECK:STDOUT: } {
  486. // CHECK:STDOUT: %U.loc12_9.1: type = bind_symbolic_name U, 0 [symbolic = %U.loc12_9.2 (constants.%U)]
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: generic class @E.loc4(%T.loc4_9.1: type) {
  491. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_9.2 (constants.%T)]
  492. // CHECK:STDOUT:
  493. // CHECK:STDOUT: class;
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT:
  496. // CHECK:STDOUT: generic class @E.loc12(%U.loc12_9.1: type) {
  497. // CHECK:STDOUT: %U.loc12_9.2: type = bind_symbolic_name U, 0 [symbolic = %U.loc12_9.2 (constants.%U)]
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: !definition:
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: class {
  502. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete = constants.%empty_struct_type]
  503. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  504. // CHECK:STDOUT: complete_type_witness = %complete_type
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: !members:
  507. // CHECK:STDOUT: .Self = constants.%E.ec9c10.2
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: specific @E.loc4(constants.%T) {
  512. // CHECK:STDOUT: %T.loc4_9.2 => constants.%T
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: specific @E.loc12(constants.%U) {
  516. // CHECK:STDOUT: %U.loc12_9.2 => constants.%U
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT: