redeclare.carbon 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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.
  19. // CHECK:STDERR: class A(T:! type) {}
  20. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~
  21. // CHECK:STDERR: fail_mismatch_param_list.carbon:[[@LINE-4]]:1: Previously declared without parameter list.
  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.
  30. // CHECK:STDERR: class B[T:! type](N:! T) {}
  31. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~
  32. // CHECK:STDERR: fail_mismatch_implicit_param_list.carbon:[[@LINE-4]]:1: Previously declared without implicit parameter list.
  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.
  41. // CHECK:STDERR: class C(T:! type, U:! i32) {}
  42. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  43. // CHECK:STDERR: fail_mismatch_param_count.carbon:[[@LINE-4]]:1: Previously declared with parameter count of 1.
  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: Redeclaration differs at parameter 1.
  52. // CHECK:STDERR: class D(T:! i32) {}
  53. // CHECK:STDERR: ^
  54. // CHECK:STDERR: fail_mismatch_param_type.carbon:[[@LINE-4]]:9: Previous declaration's corresponding parameter here.
  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+6]]:9: ERROR: Redeclaration differs at parameter 1.
  63. // CHECK:STDERR: class E(U:! type) {}
  64. // CHECK:STDERR: ^
  65. // CHECK:STDERR: fail_mismatch_param_name.carbon:[[@LINE-4]]:9: Previous declaration's corresponding parameter here.
  66. // CHECK:STDERR: class E(T:! type);
  67. // CHECK:STDERR: ^
  68. class E(U:! type) {}
  69. // CHECK:STDOUT: --- valid.carbon
  70. // CHECK:STDOUT:
  71. // CHECK:STDOUT: constants {
  72. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  73. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [template]
  74. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  75. // CHECK:STDOUT: %Generic.1: %Generic.type = struct_value () [template]
  76. // CHECK:STDOUT: %Generic.2: type = class_type @Generic, @Generic(%T) [symbolic]
  77. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  78. // CHECK:STDOUT: }
  79. // CHECK:STDOUT:
  80. // CHECK:STDOUT: imports {
  81. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  82. // CHECK:STDOUT: import Core//prelude
  83. // CHECK:STDOUT: import Core//prelude/operators
  84. // CHECK:STDOUT: import Core//prelude/types
  85. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  86. // CHECK:STDOUT: import Core//prelude/operators/as
  87. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  88. // CHECK:STDOUT: import Core//prelude/operators/comparison
  89. // CHECK:STDOUT: import Core//prelude/types/bool
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: }
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: file {
  94. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  95. // CHECK:STDOUT: .Core = imports.%Core
  96. // CHECK:STDOUT: .Generic = %Generic.decl.loc4
  97. // CHECK:STDOUT: }
  98. // CHECK:STDOUT: %Core.import = import Core
  99. // CHECK:STDOUT: %Generic.decl.loc4: %Generic.type = class_decl @Generic [template = constants.%Generic.1] {
  100. // CHECK:STDOUT: %T.loc4_15.1: type = param T
  101. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T 0, %T.loc4_15.1 [symbolic = @Generic.%T (constants.%T)]
  102. // CHECK:STDOUT: }
  103. // CHECK:STDOUT: %Generic.decl.loc6: %Generic.type = class_decl @Generic [template = constants.%Generic.1] {
  104. // CHECK:STDOUT: %T.loc6_15.1: type = param T
  105. // CHECK:STDOUT: %T.loc6_15.2: type = bind_symbolic_name T 0, %T.loc6_15.1 [symbolic = constants.%T]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: generic class @Generic(file.%T.loc4_15.2: type) {
  110. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: !definition:
  113. // CHECK:STDOUT:
  114. // CHECK:STDOUT: class {
  115. // CHECK:STDOUT: !members:
  116. // CHECK:STDOUT: .Self = constants.%Generic.2
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: specific @Generic(constants.%T) {
  121. // CHECK:STDOUT: %T => constants.%T
  122. // CHECK:STDOUT: }
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: --- fail_mismatch_param_list.carbon
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: constants {
  127. // CHECK:STDOUT: %A: type = class_type @A [template]
  128. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  129. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  130. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  131. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  132. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%T) [symbolic]
  133. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: imports {
  137. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  138. // CHECK:STDOUT: import Core//prelude
  139. // CHECK:STDOUT: import Core//prelude/operators
  140. // CHECK:STDOUT: import Core//prelude/types
  141. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  142. // CHECK:STDOUT: import Core//prelude/operators/as
  143. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  144. // CHECK:STDOUT: import Core//prelude/operators/comparison
  145. // CHECK:STDOUT: import Core//prelude/types/bool
  146. // CHECK:STDOUT: }
  147. // CHECK:STDOUT: }
  148. // CHECK:STDOUT:
  149. // CHECK:STDOUT: file {
  150. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  151. // CHECK:STDOUT: .Core = imports.%Core
  152. // CHECK:STDOUT: .A = %A.decl
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT: %Core.import = import Core
  155. // CHECK:STDOUT: %A.decl: type = class_decl @A [template = constants.%A] {}
  156. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  157. // CHECK:STDOUT: %T.loc12_9.1: type = param T
  158. // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = @.1.%T (constants.%T)]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: }
  161. // CHECK:STDOUT:
  162. // CHECK:STDOUT: class @A;
  163. // CHECK:STDOUT:
  164. // CHECK:STDOUT: generic class @.1(file.%T.loc12_9.2: type) {
  165. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: !definition:
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: class {
  170. // CHECK:STDOUT: !members:
  171. // CHECK:STDOUT: .Self = constants.%.3
  172. // CHECK:STDOUT: }
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT:
  175. // CHECK:STDOUT: specific @.1(constants.%T) {
  176. // CHECK:STDOUT: %T => constants.%T
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: --- fail_mismatch_implicit_param_list.carbon
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: constants {
  182. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  183. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  184. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  185. // CHECK:STDOUT: %N.1: i32 = bind_symbolic_name N 0 [symbolic]
  186. // CHECK:STDOUT: %B.type: type = generic_class_type @B [template]
  187. // CHECK:STDOUT: %B.1: %B.type = struct_value () [template]
  188. // CHECK:STDOUT: %B.2: type = class_type @B, @B(%N.1) [symbolic]
  189. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  190. // CHECK:STDOUT: %N.2: %T = bind_symbolic_name N 1 [symbolic]
  191. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  192. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  193. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%T, %N.2) [symbolic]
  194. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  195. // CHECK:STDOUT: }
  196. // CHECK:STDOUT:
  197. // CHECK:STDOUT: imports {
  198. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  199. // CHECK:STDOUT: .Int32 = %import_ref
  200. // CHECK:STDOUT: import Core//prelude
  201. // CHECK:STDOUT: import Core//prelude/operators
  202. // CHECK:STDOUT: import Core//prelude/types
  203. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  204. // CHECK:STDOUT: import Core//prelude/operators/as
  205. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  206. // CHECK:STDOUT: import Core//prelude/operators/comparison
  207. // CHECK:STDOUT: import Core//prelude/types/bool
  208. // CHECK:STDOUT: }
  209. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  210. // CHECK:STDOUT: }
  211. // CHECK:STDOUT:
  212. // CHECK:STDOUT: file {
  213. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  214. // CHECK:STDOUT: .Core = imports.%Core
  215. // CHECK:STDOUT: .B = %B.decl
  216. // CHECK:STDOUT: }
  217. // CHECK:STDOUT: %Core.import = import Core
  218. // CHECK:STDOUT: %B.decl: %B.type = class_decl @B [template = constants.%B.1] {
  219. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  220. // CHECK:STDOUT: %.loc4_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
  221. // CHECK:STDOUT: %.loc4_13.2: type = converted %int.make_type_32, %.loc4_13.1 [template = i32]
  222. // CHECK:STDOUT: %N.loc4_9.1: i32 = param N
  223. // CHECK:STDOUT: %N.loc4_9.2: i32 = bind_symbolic_name N 0, %N.loc4_9.1 [symbolic = @B.%N (constants.%N.1)]
  224. // CHECK:STDOUT: }
  225. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  226. // CHECK:STDOUT: %T.loc12_9.1: type = param T
  227. // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = @.1.%T (constants.%T)]
  228. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc12_9.2 [symbolic = @.1.%T (constants.%T)]
  229. // CHECK:STDOUT: %N.loc12_19.1: @.1.%T (%T) = param N
  230. // CHECK:STDOUT: %N.loc12_19.2: @.1.%T (%T) = bind_symbolic_name N 1, %N.loc12_19.1 [symbolic = @.1.%N (constants.%N.2)]
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: generic class @B(file.%N.loc4_9.2: i32) {
  235. // CHECK:STDOUT: %N: i32 = bind_symbolic_name N 0 [symbolic = %N (constants.%N.1)]
  236. // CHECK:STDOUT:
  237. // CHECK:STDOUT: class;
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: generic class @.1(file.%T.loc12_9.2: type, file.%N.loc12_19.2: @.1.%T (%T)) {
  241. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  242. // CHECK:STDOUT: %N: %T = bind_symbolic_name N 1 [symbolic = %N (constants.%N.2)]
  243. // CHECK:STDOUT:
  244. // CHECK:STDOUT: !definition:
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: class {
  247. // CHECK:STDOUT: !members:
  248. // CHECK:STDOUT: .Self = constants.%.3
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: specific @B(constants.%N.1) {
  255. // CHECK:STDOUT: %N => constants.%N.1
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: specific @.1(constants.%T, constants.%N.2) {
  259. // CHECK:STDOUT: %T => constants.%T
  260. // CHECK:STDOUT: %N => constants.%N.2
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: --- fail_mismatch_param_count.carbon
  264. // CHECK:STDOUT:
  265. // CHECK:STDOUT: constants {
  266. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  267. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  268. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  269. // CHECK:STDOUT: %C.1: %C.type = struct_value () [template]
  270. // CHECK:STDOUT: %C.2: type = class_type @C, @C(%T) [symbolic]
  271. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  272. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  273. // CHECK:STDOUT: %U: i32 = bind_symbolic_name U 1 [symbolic]
  274. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  275. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  276. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%T, %U) [symbolic]
  277. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: imports {
  281. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  282. // CHECK:STDOUT: .Int32 = %import_ref
  283. // CHECK:STDOUT: import Core//prelude
  284. // CHECK:STDOUT: import Core//prelude/operators
  285. // CHECK:STDOUT: import Core//prelude/types
  286. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  287. // CHECK:STDOUT: import Core//prelude/operators/as
  288. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  289. // CHECK:STDOUT: import Core//prelude/operators/comparison
  290. // CHECK:STDOUT: import Core//prelude/types/bool
  291. // CHECK:STDOUT: }
  292. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: file {
  296. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  297. // CHECK:STDOUT: .Core = imports.%Core
  298. // CHECK:STDOUT: .C = %C.decl
  299. // CHECK:STDOUT: }
  300. // CHECK:STDOUT: %Core.import = import Core
  301. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.1] {
  302. // CHECK:STDOUT: %T.loc4_9.1: type = param T
  303. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = @C.%T (constants.%T)]
  304. // CHECK:STDOUT: }
  305. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  306. // CHECK:STDOUT: %T.loc12_9.1: type = param T
  307. // CHECK:STDOUT: %T.loc12_9.2: type = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = @.1.%T (constants.%T)]
  308. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  309. // CHECK:STDOUT: %.loc12_23.1: type = value_of_initializer %int.make_type_32 [template = i32]
  310. // CHECK:STDOUT: %.loc12_23.2: type = converted %int.make_type_32, %.loc12_23.1 [template = i32]
  311. // CHECK:STDOUT: %U.loc12_19.1: i32 = param U
  312. // CHECK:STDOUT: %U.loc12_19.2: i32 = bind_symbolic_name U 1, %U.loc12_19.1 [symbolic = @.1.%U (constants.%U)]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT: }
  315. // CHECK:STDOUT:
  316. // CHECK:STDOUT: generic class @C(file.%T.loc4_9.2: type) {
  317. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: class;
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT:
  322. // CHECK:STDOUT: generic class @.1(file.%T.loc12_9.2: type, file.%U.loc12_19.2: i32) {
  323. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  324. // CHECK:STDOUT: %U: i32 = bind_symbolic_name U 1 [symbolic = %U (constants.%U)]
  325. // CHECK:STDOUT:
  326. // CHECK:STDOUT: !definition:
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: class {
  329. // CHECK:STDOUT: !members:
  330. // CHECK:STDOUT: .Self = constants.%.3
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  335. // CHECK:STDOUT:
  336. // CHECK:STDOUT: specific @C(constants.%T) {
  337. // CHECK:STDOUT: %T => constants.%T
  338. // CHECK:STDOUT: }
  339. // CHECK:STDOUT:
  340. // CHECK:STDOUT: specific @.1(constants.%T, constants.%U) {
  341. // CHECK:STDOUT: %T => constants.%T
  342. // CHECK:STDOUT: %U => constants.%U
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: --- fail_mismatch_param_type.carbon
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: constants {
  348. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic]
  349. // CHECK:STDOUT: %D.type: type = generic_class_type @D [template]
  350. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  351. // CHECK:STDOUT: %D.1: %D.type = struct_value () [template]
  352. // CHECK:STDOUT: %D.2: type = class_type @D, @D(%T.1) [symbolic]
  353. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  354. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  355. // CHECK:STDOUT: %T.2: i32 = bind_symbolic_name T 0 [symbolic]
  356. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  357. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  358. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%T.2) [symbolic]
  359. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: imports {
  363. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  364. // CHECK:STDOUT: .Int32 = %import_ref
  365. // CHECK:STDOUT: import Core//prelude
  366. // CHECK:STDOUT: import Core//prelude/operators
  367. // CHECK:STDOUT: import Core//prelude/types
  368. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  369. // CHECK:STDOUT: import Core//prelude/operators/as
  370. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  371. // CHECK:STDOUT: import Core//prelude/operators/comparison
  372. // CHECK:STDOUT: import Core//prelude/types/bool
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  375. // CHECK:STDOUT: }
  376. // CHECK:STDOUT:
  377. // CHECK:STDOUT: file {
  378. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  379. // CHECK:STDOUT: .Core = imports.%Core
  380. // CHECK:STDOUT: .D = %D.decl
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT: %Core.import = import Core
  383. // CHECK:STDOUT: %D.decl: %D.type = class_decl @D [template = constants.%D.1] {
  384. // CHECK:STDOUT: %T.loc4_9.1: type = param T
  385. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = @D.%T (constants.%T.1)]
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  388. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  389. // CHECK:STDOUT: %.loc12_13.1: type = value_of_initializer %int.make_type_32 [template = i32]
  390. // CHECK:STDOUT: %.loc12_13.2: type = converted %int.make_type_32, %.loc12_13.1 [template = i32]
  391. // CHECK:STDOUT: %T.loc12_9.1: i32 = param T
  392. // CHECK:STDOUT: %T.loc12_9.2: i32 = bind_symbolic_name T 0, %T.loc12_9.1 [symbolic = @.1.%T (constants.%T.2)]
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: generic class @D(file.%T.loc4_9.2: type) {
  397. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T.1)]
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: class;
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: generic class @.1(file.%T.loc12_9.2: i32) {
  403. // CHECK:STDOUT: %T: i32 = bind_symbolic_name T 0 [symbolic = %T (constants.%T.2)]
  404. // CHECK:STDOUT:
  405. // CHECK:STDOUT: !definition:
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: class {
  408. // CHECK:STDOUT: !members:
  409. // CHECK:STDOUT: .Self = constants.%.3
  410. // CHECK:STDOUT: }
  411. // CHECK:STDOUT: }
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: specific @D(constants.%T.1) {
  416. // CHECK:STDOUT: %T => constants.%T.1
  417. // CHECK:STDOUT: }
  418. // CHECK:STDOUT:
  419. // CHECK:STDOUT: specific @.1(constants.%T.2) {
  420. // CHECK:STDOUT: %T => constants.%T.2
  421. // CHECK:STDOUT: }
  422. // CHECK:STDOUT:
  423. // CHECK:STDOUT: --- fail_mismatch_param_name.carbon
  424. // CHECK:STDOUT:
  425. // CHECK:STDOUT: constants {
  426. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  427. // CHECK:STDOUT: %E.type: type = generic_class_type @E [template]
  428. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  429. // CHECK:STDOUT: %E.1: %E.type = struct_value () [template]
  430. // CHECK:STDOUT: %E.2: type = class_type @E, @E(%T) [symbolic]
  431. // CHECK:STDOUT: %U: type = bind_symbolic_name U 0 [symbolic]
  432. // CHECK:STDOUT: %.type: type = generic_class_type @.1 [template]
  433. // CHECK:STDOUT: %.2: %.type = struct_value () [template]
  434. // CHECK:STDOUT: %.3: type = class_type @.1, @.1(%U) [symbolic]
  435. // CHECK:STDOUT: %.4: type = struct_type {} [template]
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: imports {
  439. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  440. // CHECK:STDOUT: import Core//prelude
  441. // CHECK:STDOUT: import Core//prelude/operators
  442. // CHECK:STDOUT: import Core//prelude/types
  443. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  444. // CHECK:STDOUT: import Core//prelude/operators/as
  445. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  446. // CHECK:STDOUT: import Core//prelude/operators/comparison
  447. // CHECK:STDOUT: import Core//prelude/types/bool
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: file {
  452. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  453. // CHECK:STDOUT: .Core = imports.%Core
  454. // CHECK:STDOUT: .E = %E.decl
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT: %Core.import = import Core
  457. // CHECK:STDOUT: %E.decl: %E.type = class_decl @E [template = constants.%E.1] {
  458. // CHECK:STDOUT: %T.loc4_9.1: type = param T
  459. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = @E.%T (constants.%T)]
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT: %.decl: %.type = class_decl @.1 [template = constants.%.2] {
  462. // CHECK:STDOUT: %U.loc11_9.1: type = param U
  463. // CHECK:STDOUT: %U.loc11_9.2: type = bind_symbolic_name U 0, %U.loc11_9.1 [symbolic = @.1.%U (constants.%U)]
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT:
  467. // CHECK:STDOUT: generic class @E(file.%T.loc4_9.2: type) {
  468. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic = %T (constants.%T)]
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: class;
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: generic class @.1(file.%U.loc11_9.2: type) {
  474. // CHECK:STDOUT: %U: type = bind_symbolic_name U 0 [symbolic = %U (constants.%U)]
  475. // CHECK:STDOUT:
  476. // CHECK:STDOUT: !definition:
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: class {
  479. // CHECK:STDOUT: !members:
  480. // CHECK:STDOUT: .Self = constants.%.3
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: specific @E(constants.%T) {
  485. // CHECK:STDOUT: %T => constants.%T
  486. // CHECK:STDOUT: }
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: specific @.1(constants.%U) {
  489. // CHECK:STDOUT: %U => constants.%U
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: