member_out_of_line.carbon 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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/member_out_of_line.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/generic/member_out_of_line.carbon
  10. // --- basic.carbon
  11. library "basic";
  12. class Class(T:! type) {
  13. fn F(n: T) -> T;
  14. }
  15. fn Class(T:! type).F(n: T) -> T {
  16. return n;
  17. }
  18. // --- nested.carbon
  19. library "nested";
  20. class A(T:! type) {
  21. class B(N:! T) {
  22. fn F[self: Self](a: T);
  23. }
  24. }
  25. fn A(T:! type).B(N:! T).F[self: Self](a: T) {}
  26. // --- fail_mismatched_not_generic_vs_generic.carbon
  27. library "fail_mismatched_not_generic_vs_generic";
  28. class NotGeneric {
  29. fn F();
  30. }
  31. // CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE+7]]:4: ERROR: Redeclaration differs because of parameter list.
  32. // CHECK:STDERR: fn NotGeneric(T:! type).F() {}
  33. // CHECK:STDERR: ^~~~~~~~~~
  34. // CHECK:STDERR: fail_mismatched_not_generic_vs_generic.carbon:[[@LINE-7]]:1: Previously declared without parameter list.
  35. // CHECK:STDERR: class NotGeneric {
  36. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  37. // CHECK:STDERR:
  38. fn NotGeneric(T:! type).F() {}
  39. // --- fail_mismatched_too_few_args.carbon
  40. library "fail_mismatched_too_few_args";
  41. class Generic(T:! type) {
  42. fn TooFew();
  43. }
  44. // CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE+7]]:4: ERROR: Redeclaration differs because of parameter count of 0.
  45. // CHECK:STDERR: fn Generic().TooFew() {}
  46. // CHECK:STDERR: ^~~~~~~
  47. // CHECK:STDERR: fail_mismatched_too_few_args.carbon:[[@LINE-7]]:1: Previously declared with parameter count of 1.
  48. // CHECK:STDERR: class Generic(T:! type) {
  49. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  50. // CHECK:STDERR:
  51. fn Generic().TooFew() {}
  52. // --- fail_mismatched_too_many_args.carbon
  53. library "fail_mismatched_too_many_args";
  54. class Generic(T:! type) {
  55. fn TooMany();
  56. }
  57. // CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE+7]]:4: ERROR: Redeclaration differs because of parameter count of 2.
  58. // CHECK:STDERR: fn Generic(T:! type, U:! type).TooMany() {}
  59. // CHECK:STDERR: ^~~~~~~
  60. // CHECK:STDERR: fail_mismatched_too_many_args.carbon:[[@LINE-7]]:1: Previously declared with parameter count of 1.
  61. // CHECK:STDERR: class Generic(T:! type) {
  62. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  63. // CHECK:STDERR:
  64. fn Generic(T:! type, U:! type).TooMany() {}
  65. // --- fail_mismatched_wrong_arg_type.carbon
  66. library "fail_mismatched_wrong_arg_type";
  67. class Generic(T:! type) {
  68. fn WrongType();
  69. }
  70. // CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE+6]]:12: ERROR: Redeclaration differs at parameter 1.
  71. // CHECK:STDERR: fn Generic(T:! ()).WrongType() {}
  72. // CHECK:STDERR: ^
  73. // CHECK:STDERR: fail_mismatched_wrong_arg_type.carbon:[[@LINE-7]]:15: Previous declaration's corresponding parameter here.
  74. // CHECK:STDERR: class Generic(T:! type) {
  75. // CHECK:STDERR: ^
  76. fn Generic(T:! ()).WrongType() {}
  77. // CHECK:STDOUT: --- basic.carbon
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: constants {
  80. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  81. // CHECK:STDOUT: %Class.type: type = generic_class_type @Class [template]
  82. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  83. // CHECK:STDOUT: %Class.1: %Class.type = struct_value () [template]
  84. // CHECK:STDOUT: %Class.2: type = class_type @Class, (%T) [symbolic]
  85. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  86. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  87. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  88. // CHECK:STDOUT: }
  89. // CHECK:STDOUT:
  90. // CHECK:STDOUT: file {
  91. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  92. // CHECK:STDOUT: .Core = %Core
  93. // CHECK:STDOUT: .Class = %Class.decl
  94. // CHECK:STDOUT: }
  95. // CHECK:STDOUT: %Core.import = import Core
  96. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  97. // CHECK:STDOUT: %Class.decl: %Class.type = class_decl @Class [template = constants.%Class.1] {
  98. // CHECK:STDOUT: %T.loc4_13.1: type = param T
  99. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T 0, %T.loc4_13.1 [symbolic = %T.loc4_13.2 (constants.%T)]
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  102. // CHECK:STDOUT: %T.loc8_10.1: type = param T
  103. // CHECK:STDOUT: %T.loc8_10.2: type = bind_symbolic_name T 0, %T.loc8_10.1 [symbolic = constants.%T]
  104. // CHECK:STDOUT: %T.ref.loc8_25: type = name_ref T, %T.loc8_10.2 [symbolic = constants.%T]
  105. // CHECK:STDOUT: %n.loc8_22.1: %T = param n
  106. // CHECK:STDOUT: @F.%n: %T = bind_name n, %n.loc8_22.1
  107. // CHECK:STDOUT: %T.ref.loc8_31: type = name_ref T, %T.loc8_10.2 [symbolic = constants.%T]
  108. // CHECK:STDOUT: @F.%return: ref %T = var <return slot>
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: }
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: class @Class
  113. // CHECK:STDOUT: generic [file.%T.loc4_13.2: type] {
  114. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  115. // CHECK:STDOUT: %T.ref.loc5_11: type = name_ref T, file.%T.loc4_13.2 [symbolic = %T.ref.loc5_11 (constants.%T)]
  116. // CHECK:STDOUT: %n.loc5_8.1: @Class.%T.ref.loc5_11 (%T) = param n
  117. // CHECK:STDOUT: %n.loc5_8.2: @Class.%T.ref.loc5_11 (%T) = bind_name n, %n.loc5_8.1
  118. // CHECK:STDOUT: %T.ref.loc5_17: type = name_ref T, file.%T.loc4_13.2 [symbolic = %T.ref.loc5_11 (constants.%T)]
  119. // CHECK:STDOUT: %return.var: ref %T = var <return slot>
  120. // CHECK:STDOUT: }
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: !members:
  123. // CHECK:STDOUT: .Self = constants.%Class.2
  124. // CHECK:STDOUT: .F = %F.decl
  125. // CHECK:STDOUT: }
  126. // CHECK:STDOUT:
  127. // CHECK:STDOUT: fn @F(%n: %T) -> %T
  128. // CHECK:STDOUT: generic [file.%T.loc4_13.2: type] {
  129. // CHECK:STDOUT: !entry:
  130. // CHECK:STDOUT: %n.ref: %T = name_ref n, %n
  131. // CHECK:STDOUT: return %n.ref
  132. // CHECK:STDOUT: }
  133. // CHECK:STDOUT:
  134. // CHECK:STDOUT: --- nested.carbon
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: constants {
  137. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  138. // CHECK:STDOUT: %A.type: type = generic_class_type @A [template]
  139. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  140. // CHECK:STDOUT: %A.1: %A.type = struct_value () [template]
  141. // CHECK:STDOUT: %A.2: type = class_type @A, (%T) [symbolic]
  142. // CHECK:STDOUT: %N: %T = bind_symbolic_name N 1 [symbolic]
  143. // CHECK:STDOUT: %B.type: type = generic_class_type @B [template]
  144. // CHECK:STDOUT: %B.1: %B.type = struct_value () [template]
  145. // CHECK:STDOUT: %B.2: type = class_type @B, (%T, %N) [symbolic]
  146. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  147. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  148. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  149. // CHECK:STDOUT: %.3: type = ptr_type %.2 [template]
  150. // CHECK:STDOUT: }
  151. // CHECK:STDOUT:
  152. // CHECK:STDOUT: file {
  153. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  154. // CHECK:STDOUT: .Core = %Core
  155. // CHECK:STDOUT: .A = %A.decl
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: %Core.import = import Core
  158. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  159. // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [template = constants.%A.1] {
  160. // CHECK:STDOUT: %T.loc4_9.1: type = param T
  161. // CHECK:STDOUT: %T.loc4_9.2: type = bind_symbolic_name T 0, %T.loc4_9.1 [symbolic = %T.loc4_9.2 (constants.%T)]
  162. // CHECK:STDOUT: }
  163. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  164. // CHECK:STDOUT: %T.loc10_6.1: type = param T
  165. // CHECK:STDOUT: %T.loc10_6.2: type = bind_symbolic_name T 0, %T.loc10_6.1 [symbolic = constants.%T]
  166. // CHECK:STDOUT: %T.ref.loc10_22: type = name_ref T, %T.loc10_6.2 [symbolic = constants.%T]
  167. // CHECK:STDOUT: %N.loc10_18.1: %T = param N
  168. // CHECK:STDOUT: %N.loc10_18.2: %T = bind_symbolic_name N 1, %N.loc10_18.1 [symbolic = constants.%N]
  169. // CHECK:STDOUT: %.loc10: type = specific_constant constants.%B.2, (constants.%T, constants.%N) [symbolic = constants.%B.2]
  170. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc10 [symbolic = constants.%B.2]
  171. // CHECK:STDOUT: %self.loc10_27.1: %B.2 = param self
  172. // CHECK:STDOUT: @F.%self: %B.2 = bind_name self, %self.loc10_27.1
  173. // CHECK:STDOUT: %T.ref.loc10_42: type = name_ref T, %T.loc10_6.2 [symbolic = constants.%T]
  174. // CHECK:STDOUT: %a.loc10_39.1: %T = param a
  175. // CHECK:STDOUT: @F.%a: %T = bind_name a, %a.loc10_39.1
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: class @A
  180. // CHECK:STDOUT: generic [file.%T.loc4_9.2: type] {
  181. // CHECK:STDOUT: %B.decl: %B.type = class_decl @B [template = constants.%B.1] {
  182. // CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc4_9.2 [symbolic = %T.ref (constants.%T)]
  183. // CHECK:STDOUT: %N.loc5_11.1: @A.%T.ref (%T) = param N
  184. // CHECK:STDOUT: %N.loc5_11.2: @A.%T.ref (%T) = bind_symbolic_name N 1, %N.loc5_11.1 [symbolic = %N.loc5_11.2 (constants.%N)]
  185. // CHECK:STDOUT: }
  186. // CHECK:STDOUT:
  187. // CHECK:STDOUT: !members:
  188. // CHECK:STDOUT: .Self = constants.%A.2
  189. // CHECK:STDOUT: .B = %B.decl
  190. // CHECK:STDOUT: }
  191. // CHECK:STDOUT:
  192. // CHECK:STDOUT: class @B
  193. // CHECK:STDOUT: generic [file.%T.loc4_9.2: type, @A.%N.loc5_11.2: @A.%T.ref (%T)] {
  194. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  195. // CHECK:STDOUT: %.loc6: type = specific_constant constants.%B.2, (constants.%T, constants.%N) [symbolic = %.loc6 (constants.%B.2)]
  196. // CHECK:STDOUT: %Self.ref: type = name_ref Self, %.loc6 [symbolic = %.loc6 (constants.%B.2)]
  197. // CHECK:STDOUT: %self.loc6_10.1: @B.%.loc6 (%B.2) = param self
  198. // CHECK:STDOUT: %self.loc6_10.2: @B.%.loc6 (%B.2) = bind_name self, %self.loc6_10.1
  199. // CHECK:STDOUT: %T.ref: type = name_ref T, file.%T.loc4_9.2 [symbolic = %T.ref (constants.%T)]
  200. // CHECK:STDOUT: %a.loc6_22.1: @B.%T.ref (%T) = param a
  201. // CHECK:STDOUT: %a.loc6_22.2: @B.%T.ref (%T) = bind_name a, %a.loc6_22.1
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT:
  204. // CHECK:STDOUT: !members:
  205. // CHECK:STDOUT: .Self = constants.%B.2
  206. // CHECK:STDOUT: .F = %F.decl
  207. // CHECK:STDOUT: }
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: fn @F[%self: %B.2](%a: %T)
  210. // CHECK:STDOUT: generic [file.%T.loc4_9.2: type, @A.%N.loc5_11.2: @A.%T.ref (%T)] {
  211. // CHECK:STDOUT: !entry:
  212. // CHECK:STDOUT: return
  213. // CHECK:STDOUT: }
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: --- fail_mismatched_not_generic_vs_generic.carbon
  216. // CHECK:STDOUT:
  217. // CHECK:STDOUT: constants {
  218. // CHECK:STDOUT: %NotGeneric: type = class_type @NotGeneric [template]
  219. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  220. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  221. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  222. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  223. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  224. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  225. // CHECK:STDOUT: %.3: %.type = struct_value () [template]
  226. // CHECK:STDOUT: }
  227. // CHECK:STDOUT:
  228. // CHECK:STDOUT: file {
  229. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  230. // CHECK:STDOUT: .Core = %Core
  231. // CHECK:STDOUT: .NotGeneric = %NotGeneric.decl
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT: %Core.import = import Core
  234. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  235. // CHECK:STDOUT: %NotGeneric.decl: type = class_decl @NotGeneric [template = constants.%NotGeneric] {}
  236. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.3] {
  237. // CHECK:STDOUT: %T.loc15_15.1: type = param T
  238. // CHECK:STDOUT: %T.loc15_15.2: type = bind_symbolic_name T 0, %T.loc15_15.1 [symbolic = %T.loc15_15.2 (constants.%T)]
  239. // CHECK:STDOUT: }
  240. // CHECK:STDOUT: }
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: class @NotGeneric {
  243. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {}
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: !members:
  246. // CHECK:STDOUT: .Self = constants.%NotGeneric
  247. // CHECK:STDOUT: .F = %F.decl
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: fn @F();
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: fn @.1()
  253. // CHECK:STDOUT: generic [file.%T.loc15_15.2: type] {
  254. // CHECK:STDOUT: !entry:
  255. // CHECK:STDOUT: return
  256. // CHECK:STDOUT: }
  257. // CHECK:STDOUT:
  258. // CHECK:STDOUT: --- fail_mismatched_too_few_args.carbon
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: constants {
  261. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  262. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [template]
  263. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  264. // CHECK:STDOUT: %Generic.1: %Generic.type = struct_value () [template]
  265. // CHECK:STDOUT: %Generic.2: type = class_type @Generic, (%T) [symbolic]
  266. // CHECK:STDOUT: %TooFew.type: type = fn_type @TooFew [template]
  267. // CHECK:STDOUT: %TooFew: %TooFew.type = struct_value () [template]
  268. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  269. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  270. // CHECK:STDOUT: %.3: %.type = struct_value () [template]
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: file {
  274. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  275. // CHECK:STDOUT: .Core = %Core
  276. // CHECK:STDOUT: .Generic = %Generic.decl
  277. // CHECK:STDOUT: }
  278. // CHECK:STDOUT: %Core.import = import Core
  279. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  280. // CHECK:STDOUT: %Generic.decl: %Generic.type = class_decl @Generic [template = constants.%Generic.1] {
  281. // CHECK:STDOUT: %T.loc4_15.1: type = param T
  282. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T 0, %T.loc4_15.1 [symbolic = %T.loc4_15.2 (constants.%T)]
  283. // CHECK:STDOUT: }
  284. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.3] {}
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: class @Generic
  288. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type] {
  289. // CHECK:STDOUT: %TooFew.decl: %TooFew.type = fn_decl @TooFew [template = constants.%TooFew] {}
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: !members:
  292. // CHECK:STDOUT: .Self = constants.%Generic.2
  293. // CHECK:STDOUT: .TooFew = %TooFew.decl
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: fn @TooFew()
  297. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type];
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: fn @.1() {
  300. // CHECK:STDOUT: !entry:
  301. // CHECK:STDOUT: return
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: --- fail_mismatched_too_many_args.carbon
  305. // CHECK:STDOUT:
  306. // CHECK:STDOUT: constants {
  307. // CHECK:STDOUT: %T: type = bind_symbolic_name T 0 [symbolic]
  308. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [template]
  309. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  310. // CHECK:STDOUT: %Generic.1: %Generic.type = struct_value () [template]
  311. // CHECK:STDOUT: %Generic.2: type = class_type @Generic, (%T) [symbolic]
  312. // CHECK:STDOUT: %TooMany.type: type = fn_type @TooMany [template]
  313. // CHECK:STDOUT: %TooMany: %TooMany.type = struct_value () [template]
  314. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  315. // CHECK:STDOUT: %U: type = bind_symbolic_name U 1 [symbolic]
  316. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  317. // CHECK:STDOUT: %.3: %.type = struct_value () [template]
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: file {
  321. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  322. // CHECK:STDOUT: .Core = %Core
  323. // CHECK:STDOUT: .Generic = %Generic.decl
  324. // CHECK:STDOUT: }
  325. // CHECK:STDOUT: %Core.import = import Core
  326. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  327. // CHECK:STDOUT: %Generic.decl: %Generic.type = class_decl @Generic [template = constants.%Generic.1] {
  328. // CHECK:STDOUT: %T.loc4_15.1: type = param T
  329. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T 0, %T.loc4_15.1 [symbolic = %T.loc4_15.2 (constants.%T)]
  330. // CHECK:STDOUT: }
  331. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.3] {
  332. // CHECK:STDOUT: %T.loc15_12.1: type = param T
  333. // CHECK:STDOUT: %T.loc15_12.2: type = bind_symbolic_name T 0, %T.loc15_12.1 [symbolic = %T.loc15_12.2 (constants.%T)]
  334. // CHECK:STDOUT: %U.loc15_22.1: type = param U
  335. // CHECK:STDOUT: %U.loc15_22.2: type = bind_symbolic_name U 1, %U.loc15_22.1 [symbolic = %U.loc15_22.2 (constants.%U)]
  336. // CHECK:STDOUT: }
  337. // CHECK:STDOUT: }
  338. // CHECK:STDOUT:
  339. // CHECK:STDOUT: class @Generic
  340. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type] {
  341. // CHECK:STDOUT: %TooMany.decl: %TooMany.type = fn_decl @TooMany [template = constants.%TooMany] {}
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: !members:
  344. // CHECK:STDOUT: .Self = constants.%Generic.2
  345. // CHECK:STDOUT: .TooMany = %TooMany.decl
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: fn @TooMany()
  349. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type];
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: fn @.1()
  352. // CHECK:STDOUT: generic [file.%T.loc15_12.2: type, file.%U.loc15_22.2: type] {
  353. // CHECK:STDOUT: !entry:
  354. // CHECK:STDOUT: return
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: --- fail_mismatched_wrong_arg_type.carbon
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: constants {
  360. // CHECK:STDOUT: %T.1: type = bind_symbolic_name T 0 [symbolic]
  361. // CHECK:STDOUT: %Generic.type: type = generic_class_type @Generic [template]
  362. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  363. // CHECK:STDOUT: %Generic.1: %Generic.type = struct_value () [template]
  364. // CHECK:STDOUT: %Generic.2: type = class_type @Generic, (%T.1) [symbolic]
  365. // CHECK:STDOUT: %WrongType.type: type = fn_type @WrongType [template]
  366. // CHECK:STDOUT: %WrongType: %WrongType.type = struct_value () [template]
  367. // CHECK:STDOUT: %.2: type = struct_type {} [template]
  368. // CHECK:STDOUT: %T.2: %.1 = bind_symbolic_name T 0 [symbolic]
  369. // CHECK:STDOUT: %.type: type = fn_type @.1 [template]
  370. // CHECK:STDOUT: %.3: %.type = struct_value () [template]
  371. // CHECK:STDOUT: }
  372. // CHECK:STDOUT:
  373. // CHECK:STDOUT: file {
  374. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  375. // CHECK:STDOUT: .Core = %Core
  376. // CHECK:STDOUT: .Generic = %Generic.decl
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT: %Core.import = import Core
  379. // CHECK:STDOUT: %Core: <namespace> = namespace %Core.import, [template] {}
  380. // CHECK:STDOUT: %Generic.decl: %Generic.type = class_decl @Generic [template = constants.%Generic.1] {
  381. // CHECK:STDOUT: %T.loc4_15.1: type = param T
  382. // CHECK:STDOUT: %T.loc4_15.2: type = bind_symbolic_name T 0, %T.loc4_15.1 [symbolic = %T.loc4_15.2 (constants.%T.1)]
  383. // CHECK:STDOUT: }
  384. // CHECK:STDOUT: %.decl: %.type = fn_decl @.1 [template = constants.%.3] {
  385. // CHECK:STDOUT: %.loc14_17.1: %.1 = tuple_literal ()
  386. // CHECK:STDOUT: %.loc14_17.2: type = converted %.loc14_17.1, constants.%.1 [template = constants.%.1]
  387. // CHECK:STDOUT: %T.loc14_12.1: %.1 = param T
  388. // CHECK:STDOUT: %T.loc14_12.2: %.1 = bind_symbolic_name T 0, %T.loc14_12.1 [symbolic = %T.loc14_12.2 (constants.%T.2)]
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT: }
  391. // CHECK:STDOUT:
  392. // CHECK:STDOUT: class @Generic
  393. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type] {
  394. // CHECK:STDOUT: %WrongType.decl: %WrongType.type = fn_decl @WrongType [template = constants.%WrongType] {}
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: !members:
  397. // CHECK:STDOUT: .Self = constants.%Generic.2
  398. // CHECK:STDOUT: .WrongType = %WrongType.decl
  399. // CHECK:STDOUT: }
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: fn @WrongType()
  402. // CHECK:STDOUT: generic [file.%T.loc4_15.2: type];
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: fn @.1()
  405. // CHECK:STDOUT: generic [file.%T.loc14_12.2: %.1] {
  406. // CHECK:STDOUT: !entry:
  407. // CHECK:STDOUT: return
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT: