redeclare.carbon 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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: %type: type = facet_type <type> [concrete]
  81. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  82. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  83. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  84. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [concrete]
  85. // CHECK:STDOUT: %Generic.generic: %Generic.type = struct_value () [concrete]
  86. // CHECK:STDOUT: %Generic: type = class_type @Generic, @Generic(%T) [symbolic]
  87. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  88. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  89. // CHECK:STDOUT: }
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: imports {
  92. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  93. // CHECK:STDOUT: import Core//prelude
  94. // CHECK:STDOUT: import Core//prelude/...
  95. // CHECK:STDOUT: }
  96. // CHECK:STDOUT: }
  97. // CHECK:STDOUT:
  98. // CHECK:STDOUT: file {
  99. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  100. // CHECK:STDOUT: .Core = imports.%Core
  101. // CHECK:STDOUT: .Generic = %Generic.decl.loc4
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %Core.import = import Core
  104. // CHECK:STDOUT: %Generic.decl.loc4: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
  105. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  106. // CHECK:STDOUT: } {
  107. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  108. // CHECK:STDOUT: %T.loc4_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_15.1 (constants.%T)]
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: %Generic.decl.loc6: %Generic.type = class_decl @Generic [concrete = constants.%Generic.generic] {
  111. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  112. // CHECK:STDOUT: } {
  113. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  114. // CHECK:STDOUT: %T.loc6: type = symbolic_binding T, 0 [symbolic = %T.loc4_15.1 (constants.%T)]
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: generic class @Generic(%T.loc4_15.2: type) {
  119. // CHECK:STDOUT: %T.loc4_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_15.1 (constants.%T)]
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: !definition:
  122. // CHECK:STDOUT:
  123. // CHECK:STDOUT: class {
  124. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  125. // CHECK:STDOUT: complete_type_witness = %complete_type
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: !members:
  128. // CHECK:STDOUT: .Self = constants.%Generic
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: specific @Generic(constants.%T) {
  133. // CHECK:STDOUT: %T.loc4_15.1 => constants.%T
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: --- fail_mismatch_param_list.carbon
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: constants {
  139. // CHECK:STDOUT: %A.f82: type = class_type @A.loc4 [concrete]
  140. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  141. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  142. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  143. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  144. // CHECK:STDOUT: %A.type: type = generic_class_type @A.loc12 [concrete]
  145. // CHECK:STDOUT: %A.generic: %A.type = struct_value () [concrete]
  146. // CHECK:STDOUT: %A.95c: type = class_type @A.loc12, @A.loc12(%T) [symbolic]
  147. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  148. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: imports {
  152. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  153. // CHECK:STDOUT: import Core//prelude
  154. // CHECK:STDOUT: import Core//prelude/...
  155. // CHECK:STDOUT: }
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT:
  158. // CHECK:STDOUT: file {
  159. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  160. // CHECK:STDOUT: .Core = imports.%Core
  161. // CHECK:STDOUT: .A = %A.decl.loc4
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %Core.import = import Core
  164. // CHECK:STDOUT: %A.decl.loc4: type = class_decl @A.loc4 [concrete = constants.%A.f82] {} {}
  165. // CHECK:STDOUT: %A.decl.loc12: %A.type = class_decl @A.loc12 [concrete = constants.%A.generic] {
  166. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  167. // CHECK:STDOUT: } {
  168. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  169. // CHECK:STDOUT: %T.loc12_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc12_9.1 (constants.%T)]
  170. // CHECK:STDOUT: }
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: class @A.loc4;
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: generic class @A.loc12(%T.loc12_9.2: type) {
  176. // CHECK:STDOUT: %T.loc12_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc12_9.1 (constants.%T)]
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: !definition:
  179. // CHECK:STDOUT:
  180. // CHECK:STDOUT: class {
  181. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  182. // CHECK:STDOUT: complete_type_witness = %complete_type
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !members:
  185. // CHECK:STDOUT: .Self = constants.%A.95c
  186. // CHECK:STDOUT: }
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT:
  189. // CHECK:STDOUT: specific @A.loc12(constants.%T) {
  190. // CHECK:STDOUT: %T.loc12_9.1 => constants.%T
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT:
  193. // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon
  194. // CHECK:STDOUT:
  195. // CHECK:STDOUT: constants {
  196. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  197. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  198. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  199. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  200. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  201. // CHECK:STDOUT: %N.bad: %A = symbolic_binding N, 0 [symbolic]
  202. // CHECK:STDOUT: %pattern_type.1ab: type = pattern_type %A [concrete]
  203. // CHECK:STDOUT: %B.type.f7e62c.1: type = generic_class_type @B.loc6 [concrete]
  204. // CHECK:STDOUT: %B.generic.8bc1c8.1: %B.type.f7e62c.1 = struct_value () [concrete]
  205. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  206. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  207. // CHECK:STDOUT: %N.bd9: %T = symbolic_binding N, 1 [symbolic]
  208. // CHECK:STDOUT: %pattern_type.51d: type = pattern_type %T [symbolic]
  209. // CHECK:STDOUT: %B.type.f7e62c.2: type = generic_class_type @B.loc14 [concrete]
  210. // CHECK:STDOUT: %B.generic.8bc1c8.2: %B.type.f7e62c.2 = struct_value () [concrete]
  211. // CHECK:STDOUT: %B.87e: type = class_type @B.loc14, @B.loc14(%T, %N.bd9) [symbolic]
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: imports {
  215. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  216. // CHECK:STDOUT: import Core//prelude
  217. // CHECK:STDOUT: import Core//prelude/...
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT:
  221. // CHECK:STDOUT: file {
  222. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  223. // CHECK:STDOUT: .Core = imports.%Core
  224. // CHECK:STDOUT: .A = %A.decl
  225. // CHECK:STDOUT: .B = %B.decl.loc6
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT: %Core.import = import Core
  228. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  229. // CHECK:STDOUT: %B.decl.loc6: %B.type.f7e62c.1 = class_decl @B.loc6 [concrete = constants.%B.generic.8bc1c8.1] {
  230. // CHECK:STDOUT: %N.patt: %pattern_type.1ab = symbolic_binding_pattern N, 0 [concrete]
  231. // CHECK:STDOUT: } {
  232. // CHECK:STDOUT: %.loc6: type = splice_block %A.ref [concrete = constants.%A] {
  233. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  234. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  235. // CHECK:STDOUT: }
  236. // CHECK:STDOUT: %N.loc6_9.2: %A = symbolic_binding N, 0 [symbolic = %N.loc6_9.1 (constants.%N.bad)]
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT: %B.decl.loc14: %B.type.f7e62c.2 = class_decl @B.loc14 [concrete = constants.%B.generic.8bc1c8.2] {
  239. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  240. // CHECK:STDOUT: %N.patt: @B.loc14.%pattern_type (%pattern_type.51d) = symbolic_binding_pattern N, 1 [concrete]
  241. // CHECK:STDOUT: } {
  242. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  243. // CHECK:STDOUT: %T.loc14_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T)]
  244. // CHECK:STDOUT: %.loc14: type = splice_block %T.ref [symbolic = %T.loc14_9.1 (constants.%T)] {
  245. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  246. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc14_9.2 [symbolic = %T.loc14_9.1 (constants.%T)]
  247. // CHECK:STDOUT: }
  248. // CHECK:STDOUT: %N.loc14_19.2: @B.loc14.%T.loc14_9.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)]
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: class @A {
  253. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  254. // CHECK:STDOUT: complete_type_witness = %complete_type
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: !members:
  257. // CHECK:STDOUT: .Self = constants.%A
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: generic class @B.loc6(%N.loc6_9.2: %A) {
  261. // CHECK:STDOUT: %N.loc6_9.1: %A = symbolic_binding N, 0 [symbolic = %N.loc6_9.1 (constants.%N.bad)]
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: class;
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: generic class @B.loc14(%T.loc14_9.2: type, %N.loc14_19.2: @B.loc14.%T.loc14_9.1 (%T)) {
  267. // CHECK:STDOUT: %T.loc14_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T)]
  268. // CHECK:STDOUT: %N.loc14_19.1: @B.loc14.%T.loc14_9.1 (%T) = symbolic_binding N, 1 [symbolic = %N.loc14_19.1 (constants.%N.bd9)]
  269. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.loc14_9.1 [symbolic = %pattern_type (constants.%pattern_type.51d)]
  270. // CHECK:STDOUT:
  271. // CHECK:STDOUT: !definition:
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: class {
  274. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  275. // CHECK:STDOUT: complete_type_witness = %complete_type
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !members:
  278. // CHECK:STDOUT: .Self = constants.%B.87e
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT: }
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: specific @B.loc6(constants.%N.bad) {
  283. // CHECK:STDOUT: %N.loc6_9.1 => constants.%N.bad
  284. // CHECK:STDOUT: }
  285. // CHECK:STDOUT:
  286. // CHECK:STDOUT: specific @B.loc14(constants.%T, constants.%N.bd9) {
  287. // CHECK:STDOUT: %T.loc14_9.1 => constants.%T
  288. // CHECK:STDOUT: %N.loc14_19.1 => constants.%N.bd9
  289. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.51d
  290. // CHECK:STDOUT: }
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: --- fail_mismatch_param_count.carbon
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: constants {
  295. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  296. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  297. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  298. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  299. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  300. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  301. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  302. // CHECK:STDOUT: %C.type.e297ae.1: type = generic_class_type @C.loc6 [concrete]
  303. // CHECK:STDOUT: %C.generic.65f314.1: %C.type.e297ae.1 = struct_value () [concrete]
  304. // CHECK:STDOUT: %U: %A = symbolic_binding U, 1 [symbolic]
  305. // CHECK:STDOUT: %pattern_type.1ab: type = pattern_type %A [concrete]
  306. // CHECK:STDOUT: %C.type.e297ae.2: type = generic_class_type @C.loc14 [concrete]
  307. // CHECK:STDOUT: %C.generic.65f314.2: %C.type.e297ae.2 = struct_value () [concrete]
  308. // CHECK:STDOUT: %C.74f: type = class_type @C.loc14, @C.loc14(%T, %U) [symbolic]
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: imports {
  312. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  313. // CHECK:STDOUT: import Core//prelude
  314. // CHECK:STDOUT: import Core//prelude/...
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT: }
  317. // CHECK:STDOUT:
  318. // CHECK:STDOUT: file {
  319. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  320. // CHECK:STDOUT: .Core = imports.%Core
  321. // CHECK:STDOUT: .A = %A.decl
  322. // CHECK:STDOUT: .C = %C.decl.loc6
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT: %Core.import = import Core
  325. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  326. // CHECK:STDOUT: %C.decl.loc6: %C.type.e297ae.1 = class_decl @C.loc6 [concrete = constants.%C.generic.65f314.1] {
  327. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  328. // CHECK:STDOUT: } {
  329. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  330. // CHECK:STDOUT: %T.loc6_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_9.1 (constants.%T)]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: %C.decl.loc14: %C.type.e297ae.2 = class_decl @C.loc14 [concrete = constants.%C.generic.65f314.2] {
  333. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  334. // CHECK:STDOUT: %U.patt: %pattern_type.1ab = symbolic_binding_pattern U, 1 [concrete]
  335. // CHECK:STDOUT: } {
  336. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  337. // CHECK:STDOUT: %T.loc14_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T)]
  338. // CHECK:STDOUT: %.loc14: type = splice_block %A.ref [concrete = constants.%A] {
  339. // CHECK:STDOUT: %.Self.2: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  340. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: %U.loc14_19.2: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)]
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: class @A {
  347. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  348. // CHECK:STDOUT: complete_type_witness = %complete_type
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: !members:
  351. // CHECK:STDOUT: .Self = constants.%A
  352. // CHECK:STDOUT: }
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: generic class @C.loc6(%T.loc6_9.2: type) {
  355. // CHECK:STDOUT: %T.loc6_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_9.1 (constants.%T)]
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: class;
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: generic class @C.loc14(%T.loc14_9.2: type, %U.loc14_19.2: %A) {
  361. // CHECK:STDOUT: %T.loc14_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T)]
  362. // CHECK:STDOUT: %U.loc14_19.1: %A = symbolic_binding U, 1 [symbolic = %U.loc14_19.1 (constants.%U)]
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: !definition:
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: class {
  367. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  368. // CHECK:STDOUT: complete_type_witness = %complete_type
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: !members:
  371. // CHECK:STDOUT: .Self = constants.%C.74f
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: specific @C.loc6(constants.%T) {
  376. // CHECK:STDOUT: %T.loc6_9.1 => constants.%T
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: specific @C.loc14(constants.%T, constants.%U) {
  380. // CHECK:STDOUT: %T.loc14_9.1 => constants.%T
  381. // CHECK:STDOUT: %U.loc14_19.1 => constants.%U
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: --- fail_mismatch_param_type.carbon
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: constants {
  387. // CHECK:STDOUT: %A: type = class_type @A [concrete]
  388. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  389. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  390. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  391. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  392. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  393. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  394. // CHECK:STDOUT: %D.type.6dc267.1: type = generic_class_type @D.loc6 [concrete]
  395. // CHECK:STDOUT: %D.generic.3c4a9e.1: %D.type.6dc267.1 = struct_value () [concrete]
  396. // CHECK:STDOUT: %T.bad: %A = symbolic_binding T, 0 [symbolic]
  397. // CHECK:STDOUT: %pattern_type.1ab: type = pattern_type %A [concrete]
  398. // CHECK:STDOUT: %D.type.6dc267.2: type = generic_class_type @D.loc14 [concrete]
  399. // CHECK:STDOUT: %D.generic.3c4a9e.2: %D.type.6dc267.2 = struct_value () [concrete]
  400. // CHECK:STDOUT: %D.d48: type = class_type @D.loc14, @D.loc14(%T.bad) [symbolic]
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: imports {
  404. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  405. // CHECK:STDOUT: import Core//prelude
  406. // CHECK:STDOUT: import Core//prelude/...
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: file {
  411. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  412. // CHECK:STDOUT: .Core = imports.%Core
  413. // CHECK:STDOUT: .A = %A.decl
  414. // CHECK:STDOUT: .D = %D.decl.loc6
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT: %Core.import = import Core
  417. // CHECK:STDOUT: %A.decl: type = class_decl @A [concrete = constants.%A] {} {}
  418. // CHECK:STDOUT: %D.decl.loc6: %D.type.6dc267.1 = class_decl @D.loc6 [concrete = constants.%D.generic.3c4a9e.1] {
  419. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  420. // CHECK:STDOUT: } {
  421. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  422. // CHECK:STDOUT: %T.loc6_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc6_9.1 (constants.%T.67d)]
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: %D.decl.loc14: %D.type.6dc267.2 = class_decl @D.loc14 [concrete = constants.%D.generic.3c4a9e.2] {
  425. // CHECK:STDOUT: %T.patt: %pattern_type.1ab = symbolic_binding_pattern T, 0 [concrete]
  426. // CHECK:STDOUT: } {
  427. // CHECK:STDOUT: %.loc14: type = splice_block %A.ref [concrete = constants.%A] {
  428. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  429. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A]
  430. // CHECK:STDOUT: }
  431. // CHECK:STDOUT: %T.loc14_9.2: %A = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T.bad)]
  432. // CHECK:STDOUT: }
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT:
  435. // CHECK:STDOUT: class @A {
  436. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  437. // CHECK:STDOUT: complete_type_witness = %complete_type
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: !members:
  440. // CHECK:STDOUT: .Self = constants.%A
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: generic class @D.loc6(%T.loc6_9.2: type) {
  444. // CHECK:STDOUT: %T.loc6_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc6_9.1 (constants.%T.67d)]
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: class;
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: generic class @D.loc14(%T.loc14_9.2: %A) {
  450. // CHECK:STDOUT: %T.loc14_9.1: %A = symbolic_binding T, 0 [symbolic = %T.loc14_9.1 (constants.%T.bad)]
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: !definition:
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: class {
  455. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  456. // CHECK:STDOUT: complete_type_witness = %complete_type
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: .Self = constants.%D.d48
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: specific @D.loc6(constants.%T.67d) {
  464. // CHECK:STDOUT: %T.loc6_9.1 => constants.%T.67d
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: specific @D.loc14(constants.%T.bad) {
  468. // CHECK:STDOUT: %T.loc14_9.1 => constants.%T.bad
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: --- fail_mismatch_param_name.carbon
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: constants {
  474. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  475. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self]
  476. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  477. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  478. // CHECK:STDOUT: %E.type.97c458.1: type = generic_class_type @E.loc4 [concrete]
  479. // CHECK:STDOUT: %E.generic.e80795.1: %E.type.97c458.1 = struct_value () [concrete]
  480. // CHECK:STDOUT: %U: type = symbolic_binding U, 0 [symbolic]
  481. // CHECK:STDOUT: %E.type.97c458.2: type = generic_class_type @E.loc12 [concrete]
  482. // CHECK:STDOUT: %E.generic.e80795.2: %E.type.97c458.2 = struct_value () [concrete]
  483. // CHECK:STDOUT: %E.421e93.2: type = class_type @E.loc12, @E.loc12(%U) [symbolic]
  484. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  485. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  486. // CHECK:STDOUT: }
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: imports {
  489. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  490. // CHECK:STDOUT: import Core//prelude
  491. // CHECK:STDOUT: import Core//prelude/...
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: file {
  496. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  497. // CHECK:STDOUT: .Core = imports.%Core
  498. // CHECK:STDOUT: .E = %E.decl.loc4
  499. // CHECK:STDOUT: }
  500. // CHECK:STDOUT: %Core.import = import Core
  501. // CHECK:STDOUT: %E.decl.loc4: %E.type.97c458.1 = class_decl @E.loc4 [concrete = constants.%E.generic.e80795.1] {
  502. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  503. // CHECK:STDOUT: } {
  504. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  505. // CHECK:STDOUT: %T.loc4_9.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_9.1 (constants.%T)]
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: %E.decl.loc12: %E.type.97c458.2 = class_decl @E.loc12 [concrete = constants.%E.generic.e80795.2] {
  508. // CHECK:STDOUT: %U.patt: %pattern_type = symbolic_binding_pattern U, 0 [concrete]
  509. // CHECK:STDOUT: } {
  510. // CHECK:STDOUT: %.Self: %type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  511. // CHECK:STDOUT: %U.loc12_9.2: type = symbolic_binding U, 0 [symbolic = %U.loc12_9.1 (constants.%U)]
  512. // CHECK:STDOUT: }
  513. // CHECK:STDOUT: }
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: generic class @E.loc4(%T.loc4_9.2: type) {
  516. // CHECK:STDOUT: %T.loc4_9.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_9.1 (constants.%T)]
  517. // CHECK:STDOUT:
  518. // CHECK:STDOUT: class;
  519. // CHECK:STDOUT: }
  520. // CHECK:STDOUT:
  521. // CHECK:STDOUT: generic class @E.loc12(%U.loc12_9.2: type) {
  522. // CHECK:STDOUT: %U.loc12_9.1: type = symbolic_binding U, 0 [symbolic = %U.loc12_9.1 (constants.%U)]
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: !definition:
  525. // CHECK:STDOUT:
  526. // CHECK:STDOUT: class {
  527. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  528. // CHECK:STDOUT: complete_type_witness = %complete_type
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: !members:
  531. // CHECK:STDOUT: .Self = constants.%E.421e93.2
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: }
  534. // CHECK:STDOUT:
  535. // CHECK:STDOUT: specific @E.loc4(constants.%T) {
  536. // CHECK:STDOUT: %T.loc4_9.1 => constants.%T
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: specific @E.loc12(constants.%U) {
  540. // CHECK:STDOUT: %U.loc12_9.1 => constants.%U
  541. // CHECK:STDOUT: }
  542. // CHECK:STDOUT: