redeclare.carbon 25 KB

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