generic_vs_params.carbon 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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/no_prelude/generic_vs_params.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/class/no_prelude/generic_vs_params.carbon
  10. // --- params.carbon
  11. library "[[@TEST_NAME]]";
  12. class NotGenericNoParams {}
  13. class NotGenericButParams() {}
  14. class GenericAndParams(T:! type) {}
  15. class C(T:! type) {
  16. class GenericNoParams {}
  17. class GenericAndParams(U:! type) {}
  18. }
  19. class X {}
  20. var a: NotGenericNoParams = {};
  21. var b: NotGenericButParams() = {};
  22. var c: GenericAndParams(X) = {};
  23. var d: C(X).GenericNoParams = {};
  24. var e: C(X).GenericAndParams(X) = {};
  25. // --- fail_non_generic_implicit_params.carbon
  26. library "[[@TEST_NAME]]";
  27. // CHECK:STDERR: fail_non_generic_implicit_params.carbon:[[@LINE+4]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant]
  28. // CHECK:STDERR: class A[T: type]() {}
  29. // CHECK:STDERR: ^~~~~~~
  30. // CHECK:STDERR:
  31. class A[T: type]() {}
  32. // --- fail_non_generic_params.carbon
  33. library "[[@TEST_NAME]]";
  34. // CHECK:STDERR: fail_non_generic_params.carbon:[[@LINE+3]]:9: error: parameters of generic types must be constant [GenericParamMustBeConstant]
  35. // CHECK:STDERR: class A(T: type) {}
  36. // CHECK:STDERR: ^~~~~~~
  37. class A(T: type) {}
  38. // This is testing a use of the invalid type.
  39. fn F(T:! type) {
  40. A(T);
  41. }
  42. // CHECK:STDOUT: --- params.carbon
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: constants {
  45. // CHECK:STDOUT: %NotGenericNoParams: type = class_type @NotGenericNoParams [template]
  46. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  47. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  48. // CHECK:STDOUT: %NotGenericButParams.type: type = generic_class_type @NotGenericButParams [template]
  49. // CHECK:STDOUT: %NotGenericButParams.generic: %NotGenericButParams.type = struct_value () [template]
  50. // CHECK:STDOUT: %NotGenericButParams: type = class_type @NotGenericButParams [template]
  51. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  52. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  53. // CHECK:STDOUT: %GenericAndParams.type.c8d: type = generic_class_type @GenericAndParams.1 [template]
  54. // CHECK:STDOUT: %GenericAndParams.generic.1e4: %GenericAndParams.type.c8d = struct_value () [template]
  55. // CHECK:STDOUT: %GenericAndParams.9d2: type = class_type @GenericAndParams.1, @GenericAndParams.1(%T) [symbolic]
  56. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  57. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  58. // CHECK:STDOUT: %C.37e: type = class_type @C, @C(%T) [symbolic]
  59. // CHECK:STDOUT: %GenericNoParams.0a9: type = class_type @GenericNoParams [template]
  60. // CHECK:STDOUT: %GenericNoParams.495: type = class_type @GenericNoParams, @GenericNoParams(%T) [symbolic]
  61. // CHECK:STDOUT: %U: type = bind_symbolic_name U, 1 [symbolic]
  62. // CHECK:STDOUT: %U.patt: type = symbolic_binding_pattern U, 1 [symbolic]
  63. // CHECK:STDOUT: %GenericAndParams.type.889: type = generic_class_type @GenericAndParams.2, @C(%T) [symbolic]
  64. // CHECK:STDOUT: %GenericAndParams.generic.7c2: %GenericAndParams.type.889 = struct_value () [symbolic]
  65. // CHECK:STDOUT: %GenericAndParams.b6f: type = class_type @GenericAndParams.2, @GenericAndParams.2(%T, %U) [symbolic]
  66. // CHECK:STDOUT: %X: type = class_type @X [template]
  67. // CHECK:STDOUT: %NotGenericNoParams.val: %NotGenericNoParams = struct_value () [template]
  68. // CHECK:STDOUT: %NotGenericButParams.val: %NotGenericButParams = struct_value () [template]
  69. // CHECK:STDOUT: %GenericAndParams.0da: type = class_type @GenericAndParams.1, @GenericAndParams.1(%X) [template]
  70. // CHECK:STDOUT: %GenericAndParams.val.378: %GenericAndParams.0da = struct_value () [template]
  71. // CHECK:STDOUT: %GenericAndParams.type.531: type = generic_class_type @GenericAndParams.2, @C(%X) [template]
  72. // CHECK:STDOUT: %GenericAndParams.generic.6cc: %GenericAndParams.type.531 = struct_value () [template]
  73. // CHECK:STDOUT: %GenericNoParams.val: %GenericNoParams.0a9 = struct_value () [template]
  74. // CHECK:STDOUT: %GenericAndParams.ace: type = class_type @GenericAndParams.2, @GenericAndParams.2(%X, %X) [template]
  75. // CHECK:STDOUT: %GenericAndParams.val.32a: %GenericAndParams.ace = struct_value () [template]
  76. // CHECK:STDOUT: }
  77. // CHECK:STDOUT:
  78. // CHECK:STDOUT: file {
  79. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  80. // CHECK:STDOUT: .NotGenericNoParams = %NotGenericNoParams.decl
  81. // CHECK:STDOUT: .NotGenericButParams = %NotGenericButParams.decl
  82. // CHECK:STDOUT: .GenericAndParams = %GenericAndParams.decl
  83. // CHECK:STDOUT: .C = %C.decl
  84. // CHECK:STDOUT: .X = %X.decl
  85. // CHECK:STDOUT: .a = %a
  86. // CHECK:STDOUT: .b = %b
  87. // CHECK:STDOUT: .c = %c
  88. // CHECK:STDOUT: .d = %d
  89. // CHECK:STDOUT: .e = %e
  90. // CHECK:STDOUT: }
  91. // CHECK:STDOUT: %NotGenericNoParams.decl: type = class_decl @NotGenericNoParams [template = constants.%NotGenericNoParams] {} {}
  92. // CHECK:STDOUT: %NotGenericButParams.decl: %NotGenericButParams.type = class_decl @NotGenericButParams [template = constants.%NotGenericButParams.generic] {} {}
  93. // CHECK:STDOUT: %GenericAndParams.decl: %GenericAndParams.type.c8d = class_decl @GenericAndParams.1 [template = constants.%GenericAndParams.generic.1e4] {
  94. // CHECK:STDOUT: %T.patt.loc6_24.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_24.2 (constants.%T.patt)]
  95. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc6_24.1, runtime_param<invalid> [symbolic = %T.patt.loc6_24.2 (constants.%T.patt)]
  96. // CHECK:STDOUT: } {
  97. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  98. // CHECK:STDOUT: %T.loc6_24.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc6_24.2 (constants.%T)]
  99. // CHECK:STDOUT: }
  100. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  101. // CHECK:STDOUT: %T.patt.loc8_9.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_9.2 (constants.%T.patt)]
  102. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc8_9.1, runtime_param<invalid> [symbolic = %T.patt.loc8_9.2 (constants.%T.patt)]
  103. // CHECK:STDOUT: } {
  104. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  105. // CHECK:STDOUT: %T.loc8_9.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc8_9.2 (constants.%T)]
  106. // CHECK:STDOUT: }
  107. // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} {}
  108. // CHECK:STDOUT: %a.var: ref %NotGenericNoParams = var a
  109. // CHECK:STDOUT: %a: ref %NotGenericNoParams = bind_name a, %a.var
  110. // CHECK:STDOUT: %b.var: ref %NotGenericButParams = var b
  111. // CHECK:STDOUT: %b: ref %NotGenericButParams = bind_name b, %b.var
  112. // CHECK:STDOUT: %c.var: ref %GenericAndParams.0da = var c
  113. // CHECK:STDOUT: %c: ref %GenericAndParams.0da = bind_name c, %c.var
  114. // CHECK:STDOUT: %d.var: ref %GenericNoParams.0a9 = var d
  115. // CHECK:STDOUT: %d: ref %GenericNoParams.0a9 = bind_name d, %d.var
  116. // CHECK:STDOUT: %e.var: ref %GenericAndParams.ace = var e
  117. // CHECK:STDOUT: %e: ref %GenericAndParams.ace = bind_name e, %e.var
  118. // CHECK:STDOUT: }
  119. // CHECK:STDOUT:
  120. // CHECK:STDOUT: class @NotGenericNoParams {
  121. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  122. // CHECK:STDOUT:
  123. // CHECK:STDOUT: !members:
  124. // CHECK:STDOUT: .Self = constants.%NotGenericNoParams
  125. // CHECK:STDOUT: complete_type_witness = %complete_type
  126. // CHECK:STDOUT: }
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: class @NotGenericButParams {
  129. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: !members:
  132. // CHECK:STDOUT: .Self = constants.%NotGenericButParams
  133. // CHECK:STDOUT: complete_type_witness = %complete_type
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: generic class @GenericAndParams.1(%T.loc6_24.1: type) {
  137. // CHECK:STDOUT: %T.loc6_24.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc6_24.2 (constants.%T)]
  138. // CHECK:STDOUT: %T.patt.loc6_24.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc6_24.2 (constants.%T.patt)]
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: !definition:
  141. // CHECK:STDOUT:
  142. // CHECK:STDOUT: class {
  143. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: !members:
  146. // CHECK:STDOUT: .Self = constants.%GenericAndParams.9d2
  147. // CHECK:STDOUT: complete_type_witness = %complete_type
  148. // CHECK:STDOUT: }
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: generic class @C(%T.loc8_9.1: type) {
  152. // CHECK:STDOUT: %T.loc8_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc8_9.2 (constants.%T)]
  153. // CHECK:STDOUT: %T.patt.loc8_9.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc8_9.2 (constants.%T.patt)]
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: !definition:
  156. // CHECK:STDOUT: %GenericAndParams.type: type = generic_class_type @GenericAndParams.2, @C(%T.loc8_9.2) [symbolic = %GenericAndParams.type (constants.%GenericAndParams.type.889)]
  157. // CHECK:STDOUT: %GenericAndParams.generic: @C.%GenericAndParams.type (%GenericAndParams.type.889) = struct_value () [symbolic = %GenericAndParams.generic (constants.%GenericAndParams.generic.7c2)]
  158. // CHECK:STDOUT:
  159. // CHECK:STDOUT: class {
  160. // CHECK:STDOUT: %GenericNoParams.decl: type = class_decl @GenericNoParams [template = constants.%GenericNoParams.0a9] {} {}
  161. // CHECK:STDOUT: %GenericAndParams.decl: @C.%GenericAndParams.type (%GenericAndParams.type.889) = class_decl @GenericAndParams.2 [symbolic = @C.%GenericAndParams.generic (constants.%GenericAndParams.generic.7c2)] {
  162. // CHECK:STDOUT: %U.patt.loc10_26.1: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_26.2 (constants.%U.patt)]
  163. // CHECK:STDOUT: %U.param_patt: type = value_param_pattern %U.patt.loc10_26.1, runtime_param<invalid> [symbolic = %U.patt.loc10_26.2 (constants.%U.patt)]
  164. // CHECK:STDOUT: } {
  165. // CHECK:STDOUT: %U.param: type = value_param runtime_param<invalid>
  166. // CHECK:STDOUT: %U.loc10_26.1: type = bind_symbolic_name U, 1, %U.param [symbolic = %U.loc10_26.2 (constants.%U)]
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  169. // CHECK:STDOUT:
  170. // CHECK:STDOUT: !members:
  171. // CHECK:STDOUT: .Self = constants.%C.37e
  172. // CHECK:STDOUT: .GenericNoParams = %GenericNoParams.decl
  173. // CHECK:STDOUT: .GenericAndParams = %GenericAndParams.decl
  174. // CHECK:STDOUT: complete_type_witness = %complete_type
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: }
  177. // CHECK:STDOUT:
  178. // CHECK:STDOUT: generic class @GenericNoParams(@C.%T.loc8_9.1: type) {
  179. // CHECK:STDOUT: !definition:
  180. // CHECK:STDOUT:
  181. // CHECK:STDOUT: class {
  182. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  183. // CHECK:STDOUT:
  184. // CHECK:STDOUT: !members:
  185. // CHECK:STDOUT: .Self = constants.%GenericNoParams.495
  186. // CHECK:STDOUT: complete_type_witness = %complete_type
  187. // CHECK:STDOUT: }
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT:
  190. // CHECK:STDOUT: generic class @GenericAndParams.2(@C.%T.loc8_9.1: type, %U.loc10_26.1: type) {
  191. // CHECK:STDOUT: %U.loc10_26.2: type = bind_symbolic_name U, 1 [symbolic = %U.loc10_26.2 (constants.%U)]
  192. // CHECK:STDOUT: %U.patt.loc10_26.2: type = symbolic_binding_pattern U, 1 [symbolic = %U.patt.loc10_26.2 (constants.%U.patt)]
  193. // CHECK:STDOUT:
  194. // CHECK:STDOUT: !definition:
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: class {
  197. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  198. // CHECK:STDOUT:
  199. // CHECK:STDOUT: !members:
  200. // CHECK:STDOUT: .Self = constants.%GenericAndParams.b6f
  201. // CHECK:STDOUT: complete_type_witness = %complete_type
  202. // CHECK:STDOUT: }
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT:
  205. // CHECK:STDOUT: class @X {
  206. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: !members:
  209. // CHECK:STDOUT: .Self = constants.%X
  210. // CHECK:STDOUT: complete_type_witness = %complete_type
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: fn @__global_init() {
  214. // CHECK:STDOUT: !entry:
  215. // CHECK:STDOUT: %.loc15_30.1: %empty_struct_type = struct_literal ()
  216. // CHECK:STDOUT: %.loc15_30.2: init %NotGenericNoParams = class_init (), file.%a.var [template = constants.%NotGenericNoParams.val]
  217. // CHECK:STDOUT: %.loc15_31: init %NotGenericNoParams = converted %.loc15_30.1, %.loc15_30.2 [template = constants.%NotGenericNoParams.val]
  218. // CHECK:STDOUT: assign file.%a.var, %.loc15_31
  219. // CHECK:STDOUT: %.loc16_33.1: %empty_struct_type = struct_literal ()
  220. // CHECK:STDOUT: %.loc16_33.2: init %NotGenericButParams = class_init (), file.%b.var [template = constants.%NotGenericButParams.val]
  221. // CHECK:STDOUT: %.loc16_34: init %NotGenericButParams = converted %.loc16_33.1, %.loc16_33.2 [template = constants.%NotGenericButParams.val]
  222. // CHECK:STDOUT: assign file.%b.var, %.loc16_34
  223. // CHECK:STDOUT: %.loc17_31.1: %empty_struct_type = struct_literal ()
  224. // CHECK:STDOUT: %.loc17_31.2: init %GenericAndParams.0da = class_init (), file.%c.var [template = constants.%GenericAndParams.val.378]
  225. // CHECK:STDOUT: %.loc17_32: init %GenericAndParams.0da = converted %.loc17_31.1, %.loc17_31.2 [template = constants.%GenericAndParams.val.378]
  226. // CHECK:STDOUT: assign file.%c.var, %.loc17_32
  227. // CHECK:STDOUT: %.loc18_32.1: %empty_struct_type = struct_literal ()
  228. // CHECK:STDOUT: %.loc18_32.2: init %GenericNoParams.0a9 = class_init (), file.%d.var [template = constants.%GenericNoParams.val]
  229. // CHECK:STDOUT: %.loc18_33: init %GenericNoParams.0a9 = converted %.loc18_32.1, %.loc18_32.2 [template = constants.%GenericNoParams.val]
  230. // CHECK:STDOUT: assign file.%d.var, %.loc18_33
  231. // CHECK:STDOUT: %.loc19_36.1: %empty_struct_type = struct_literal ()
  232. // CHECK:STDOUT: %.loc19_36.2: init %GenericAndParams.ace = class_init (), file.%e.var [template = constants.%GenericAndParams.val.32a]
  233. // CHECK:STDOUT: %.loc19_37: init %GenericAndParams.ace = converted %.loc19_36.1, %.loc19_36.2 [template = constants.%GenericAndParams.val.32a]
  234. // CHECK:STDOUT: assign file.%e.var, %.loc19_37
  235. // CHECK:STDOUT: return
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: specific @GenericAndParams.1(constants.%T) {
  239. // CHECK:STDOUT: %T.loc6_24.2 => constants.%T
  240. // CHECK:STDOUT: %T.patt.loc6_24.2 => constants.%T
  241. // CHECK:STDOUT: }
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: specific @C(constants.%T) {
  244. // CHECK:STDOUT: %T.loc8_9.2 => constants.%T
  245. // CHECK:STDOUT: %T.patt.loc8_9.2 => constants.%T
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: specific @GenericNoParams(constants.%T) {}
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: specific @GenericAndParams.2(constants.%T, constants.%U) {
  251. // CHECK:STDOUT: %U.loc10_26.2 => constants.%U
  252. // CHECK:STDOUT: %U.patt.loc10_26.2 => constants.%U
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @C(%T.loc8_9.2) {}
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: specific @GenericAndParams.1(constants.%X) {
  258. // CHECK:STDOUT: %T.loc6_24.2 => constants.%X
  259. // CHECK:STDOUT: %T.patt.loc6_24.2 => constants.%X
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: !definition:
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @C(constants.%X) {
  265. // CHECK:STDOUT: %T.loc8_9.2 => constants.%X
  266. // CHECK:STDOUT: %T.patt.loc8_9.2 => constants.%X
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: !definition:
  269. // CHECK:STDOUT: %GenericAndParams.type => constants.%GenericAndParams.type.531
  270. // CHECK:STDOUT: %GenericAndParams.generic => constants.%GenericAndParams.generic.6cc
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: specific @GenericAndParams.2(constants.%X, constants.%X) {
  274. // CHECK:STDOUT: %U.loc10_26.2 => constants.%X
  275. // CHECK:STDOUT: %U.patt.loc10_26.2 => constants.%X
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !definition:
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: --- fail_non_generic_implicit_params.carbon
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: constants {
  283. // CHECK:STDOUT: %A.type: type = generic_class_type @A [template]
  284. // CHECK:STDOUT: %A.generic: %A.type = struct_value () [template]
  285. // CHECK:STDOUT: %A: type = class_type @A [template]
  286. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  287. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  288. // CHECK:STDOUT: }
  289. // CHECK:STDOUT:
  290. // CHECK:STDOUT: file {
  291. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  292. // CHECK:STDOUT: .A = %A.decl
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [template = constants.%A.generic] {} {}
  295. // CHECK:STDOUT: }
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: class @A {
  298. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: !members:
  301. // CHECK:STDOUT: .Self = constants.%A
  302. // CHECK:STDOUT: complete_type_witness = %complete_type
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: --- fail_non_generic_params.carbon
  306. // CHECK:STDOUT:
  307. // CHECK:STDOUT: constants {
  308. // CHECK:STDOUT: %A.type: type = generic_class_type @A [template]
  309. // CHECK:STDOUT: %A.generic: %A.type = struct_value () [template]
  310. // CHECK:STDOUT: %A: type = class_type @A [template]
  311. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  312. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  313. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  314. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  315. // CHECK:STDOUT: %F.type: type = fn_type @F [template]
  316. // CHECK:STDOUT: %F: %F.type = struct_value () [template]
  317. // CHECK:STDOUT: }
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: file {
  320. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  321. // CHECK:STDOUT: .A = %A.decl
  322. // CHECK:STDOUT: .F = %F.decl
  323. // CHECK:STDOUT: }
  324. // CHECK:STDOUT: %A.decl: %A.type = class_decl @A [template = constants.%A.generic] {} {}
  325. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [template = constants.%F] {
  326. // CHECK:STDOUT: %T.patt.loc10_6.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  327. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc10_6.1, runtime_param<invalid> [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  328. // CHECK:STDOUT: } {
  329. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  330. // CHECK:STDOUT: %T.loc10_6.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc10_6.2 (constants.%T)]
  331. // CHECK:STDOUT: }
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: class @A {
  335. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: !members:
  338. // CHECK:STDOUT: .Self = constants.%A
  339. // CHECK:STDOUT: complete_type_witness = %complete_type
  340. // CHECK:STDOUT: }
  341. // CHECK:STDOUT:
  342. // CHECK:STDOUT: generic fn @F(%T.loc10_6.1: type) {
  343. // CHECK:STDOUT: %T.loc10_6.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc10_6.2 (constants.%T)]
  344. // CHECK:STDOUT: %T.patt.loc10_6.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc10_6.2 (constants.%T.patt)]
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: !definition:
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: fn(%T.param_patt: type) {
  349. // CHECK:STDOUT: !entry:
  350. // CHECK:STDOUT: %A.ref: %A.type = name_ref A, file.%A.decl [template = constants.%A.generic]
  351. // CHECK:STDOUT: %T.ref: type = name_ref T, %T.loc10_6.1 [symbolic = %T.loc10_6.2 (constants.%T)]
  352. // CHECK:STDOUT: %A: type = class_type @A [template = constants.%A]
  353. // CHECK:STDOUT: return
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: specific @F(constants.%T) {
  358. // CHECK:STDOUT: %T.loc10_6.2 => constants.%T
  359. // CHECK:STDOUT: %T.patt.loc10_6.2 => constants.%T
  360. // CHECK:STDOUT: }
  361. // CHECK:STDOUT: