specific_args.carbon 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  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/impl/lookup/no_prelude/specific_args.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/no_prelude/specific_args.carbon
  10. // --- types.carbon
  11. library "[[@TEST_NAME]]";
  12. interface I(T:! type) { fn F(); }
  13. class C(T:! type) {}
  14. class X {}
  15. // --- impl_in_interface_args.carbon
  16. library "[[@TEST_NAME]]";
  17. import library "types";
  18. class InInterfaceArgs {}
  19. impl X as I(InInterfaceArgs) { fn F() {} }
  20. // --- use_impl_in_interface_args.carbon
  21. library "[[@TEST_NAME]]";
  22. import library "types";
  23. import library "impl_in_interface_args";
  24. fn G(x: X) { x.(I(InInterfaceArgs).F)(); }
  25. // --- impl_in_class_args.carbon
  26. library "[[@TEST_NAME]]";
  27. import library "types";
  28. class InClassArgs {}
  29. impl C(InClassArgs) as I(X) { fn F() {} }
  30. // --- use_impl_in_class_args.carbon
  31. library "[[@TEST_NAME]]";
  32. import library "types";
  33. import library "impl_in_class_args";
  34. fn H(c: C(InClassArgs)) { c.(I(X).F)(); }
  35. // CHECK:STDOUT: --- types.carbon
  36. // CHECK:STDOUT:
  37. // CHECK:STDOUT: constants {
  38. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  39. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  40. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
  41. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
  42. // CHECK:STDOUT: %I.type.bc4: type = facet_type <@I, @I(%T)> [symbolic]
  43. // CHECK:STDOUT: %Self: %I.type.bc4 = bind_symbolic_name Self, 1 [symbolic]
  44. // CHECK:STDOUT: %F.type: type = fn_type @F, @I(%T) [symbolic]
  45. // CHECK:STDOUT: %F: %F.type = struct_value () [symbolic]
  46. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type %I.type.bc4, %F.type [symbolic]
  47. // CHECK:STDOUT: %assoc0: %F.assoc_type = assoc_entity element0, @I.%F.decl [symbolic]
  48. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  49. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  50. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic]
  51. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  52. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  53. // CHECK:STDOUT: %X: type = class_type @X [template]
  54. // CHECK:STDOUT: }
  55. // CHECK:STDOUT:
  56. // CHECK:STDOUT: file {
  57. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  58. // CHECK:STDOUT: .I = %I.decl
  59. // CHECK:STDOUT: .C = %C.decl
  60. // CHECK:STDOUT: .X = %X.decl
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [template = constants.%I.generic] {
  63. // CHECK:STDOUT: %T.patt.loc4_13.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  64. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc4_13.1, runtime_param<invalid> [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  65. // CHECK:STDOUT: } {
  66. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  67. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc4_13.2 (constants.%T)]
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [template = constants.%C.generic] {
  70. // CHECK:STDOUT: %T.patt.loc5_9.1: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_9.2 (constants.%T.patt)]
  71. // CHECK:STDOUT: %T.param_patt: type = value_param_pattern %T.patt.loc5_9.1, runtime_param<invalid> [symbolic = %T.patt.loc5_9.2 (constants.%T.patt)]
  72. // CHECK:STDOUT: } {
  73. // CHECK:STDOUT: %T.param: type = value_param runtime_param<invalid>
  74. // CHECK:STDOUT: %T.loc5_9.1: type = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc5_9.2 (constants.%T)]
  75. // CHECK:STDOUT: }
  76. // CHECK:STDOUT: %X.decl: type = class_decl @X [template = constants.%X] {} {}
  77. // CHECK:STDOUT: }
  78. // CHECK:STDOUT:
  79. // CHECK:STDOUT: generic interface @I(%T.loc4_13.1: type) {
  80. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.2 (constants.%T)]
  81. // CHECK:STDOUT: %T.patt.loc4_13.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc4_13.2 (constants.%T.patt)]
  82. // CHECK:STDOUT:
  83. // CHECK:STDOUT: !definition:
  84. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc4_13.2)> [symbolic = %I.type (constants.%I.type.bc4)]
  85. // CHECK:STDOUT: %Self.2: %I.type.bc4 = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  86. // CHECK:STDOUT: %F.type: type = fn_type @F, @I(%T.loc4_13.2) [symbolic = %F.type (constants.%F.type)]
  87. // CHECK:STDOUT: %F: @I.%F.type (%F.type) = struct_value () [symbolic = %F (constants.%F)]
  88. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.bc4), @I.%F.type (%F.type) [symbolic = %F.assoc_type (constants.%F.assoc_type)]
  89. // CHECK:STDOUT: %assoc0.loc4_31.2: @I.%F.assoc_type (%F.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_31.2 (constants.%assoc0)]
  90. // CHECK:STDOUT:
  91. // CHECK:STDOUT: interface {
  92. // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.bc4) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  93. // CHECK:STDOUT: %F.decl: @I.%F.type (%F.type) = fn_decl @F [symbolic = @I.%F (constants.%F)] {} {}
  94. // CHECK:STDOUT: %assoc0.loc4_31.1: @I.%F.assoc_type (%F.assoc_type) = assoc_entity element0, %F.decl [symbolic = %assoc0.loc4_31.2 (constants.%assoc0)]
  95. // CHECK:STDOUT:
  96. // CHECK:STDOUT: !members:
  97. // CHECK:STDOUT: .Self = %Self.1
  98. // CHECK:STDOUT: .F = %assoc0.loc4_31.1
  99. // CHECK:STDOUT: witness = (%F.decl)
  100. // CHECK:STDOUT: }
  101. // CHECK:STDOUT: }
  102. // CHECK:STDOUT:
  103. // CHECK:STDOUT: generic class @C(%T.loc5_9.1: type) {
  104. // CHECK:STDOUT: %T.loc5_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_9.2 (constants.%T)]
  105. // CHECK:STDOUT: %T.patt.loc5_9.2: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc5_9.2 (constants.%T.patt)]
  106. // CHECK:STDOUT:
  107. // CHECK:STDOUT: !definition:
  108. // CHECK:STDOUT:
  109. // CHECK:STDOUT: class {
  110. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: !members:
  113. // CHECK:STDOUT: .Self = constants.%C
  114. // CHECK:STDOUT: complete_type_witness = %complete_type
  115. // CHECK:STDOUT: }
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT:
  118. // CHECK:STDOUT: class @X {
  119. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  120. // CHECK:STDOUT:
  121. // CHECK:STDOUT: !members:
  122. // CHECK:STDOUT: .Self = constants.%X
  123. // CHECK:STDOUT: complete_type_witness = %complete_type
  124. // CHECK:STDOUT: }
  125. // CHECK:STDOUT:
  126. // CHECK:STDOUT: generic fn @F(@I.%T.loc4_13.1: type, @I.%Self.1: @I.%I.type (%I.type.bc4)) {
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: fn();
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT:
  131. // CHECK:STDOUT: specific @I(constants.%T) {
  132. // CHECK:STDOUT: %T.loc4_13.2 => constants.%T
  133. // CHECK:STDOUT: %T.patt.loc4_13.2 => constants.%T
  134. // CHECK:STDOUT: }
  135. // CHECK:STDOUT:
  136. // CHECK:STDOUT: specific @F(constants.%T, constants.%Self) {}
  137. // CHECK:STDOUT:
  138. // CHECK:STDOUT: specific @I(%T.loc4_13.2) {}
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: specific @C(constants.%T) {
  141. // CHECK:STDOUT: %T.loc5_9.2 => constants.%T
  142. // CHECK:STDOUT: %T.patt.loc5_9.2 => constants.%T
  143. // CHECK:STDOUT: }
  144. // CHECK:STDOUT:
  145. // CHECK:STDOUT: --- impl_in_interface_args.carbon
  146. // CHECK:STDOUT:
  147. // CHECK:STDOUT: constants {
  148. // CHECK:STDOUT: %InInterfaceArgs: type = class_type @InInterfaceArgs [template]
  149. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  150. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  151. // CHECK:STDOUT: %X: type = class_type @X [template]
  152. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
  153. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
  154. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  155. // CHECK:STDOUT: %I.type.9d1: type = facet_type <@I, @I(%T)> [symbolic]
  156. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic]
  157. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  158. // CHECK:STDOUT: %F.type.8ee: type = fn_type @F.1, @I(%T) [symbolic]
  159. // CHECK:STDOUT: %F.129: %F.type.8ee = struct_value () [symbolic]
  160. // CHECK:STDOUT: %F.assoc_type.351: type = assoc_entity_type %I.type.9d1, %F.type.8ee [symbolic]
  161. // CHECK:STDOUT: %assoc0.fd0: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d8 [symbolic]
  162. // CHECK:STDOUT: %I.type.da1: type = facet_type <@I, @I(%InInterfaceArgs)> [template]
  163. // CHECK:STDOUT: %F.type.5dc: type = fn_type @F.1, @I(%InInterfaceArgs) [template]
  164. // CHECK:STDOUT: %F.55d: %F.type.5dc = struct_value () [template]
  165. // CHECK:STDOUT: %F.assoc_type.800: type = assoc_entity_type %I.type.da1, %F.type.5dc [template]
  166. // CHECK:STDOUT: %assoc0.d7d: %F.assoc_type.800 = assoc_entity element0, imports.%import_ref.8d8 [template]
  167. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template]
  168. // CHECK:STDOUT: %F.type.2a0: type = fn_type @F.2 [template]
  169. // CHECK:STDOUT: %F.eb4: %F.type.2a0 = struct_value () [template]
  170. // CHECK:STDOUT: %I.facet: %I.type.9d1 = facet_value %X, %impl_witness [symbolic]
  171. // CHECK:STDOUT: }
  172. // CHECK:STDOUT:
  173. // CHECK:STDOUT: imports {
  174. // CHECK:STDOUT: %import_ref.848: %I.type.dac = import_ref Main//types, I, loaded [template = constants.%I.generic]
  175. // CHECK:STDOUT: %import_ref.208 = import_ref Main//types, C, unloaded
  176. // CHECK:STDOUT: %import_ref.58f: type = import_ref Main//types, X, loaded [template = constants.%X]
  177. // CHECK:STDOUT: %import_ref.8f2: <witness> = import_ref Main//types, loc7_10, loaded [template = constants.%complete_type]
  178. // CHECK:STDOUT: %import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded
  179. // CHECK:STDOUT: %import_ref.9c1 = import_ref Main//types, inst26 [no loc], unloaded
  180. // CHECK:STDOUT: %import_ref.355 = import_ref Main//types, loc4_31, unloaded
  181. // CHECK:STDOUT: %import_ref.938: @I.%F.type (%F.type.8ee) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.129)]
  182. // CHECK:STDOUT: %import_ref.8d8 = import_ref Main//types, loc4_31, unloaded
  183. // CHECK:STDOUT: }
  184. // CHECK:STDOUT:
  185. // CHECK:STDOUT: file {
  186. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  187. // CHECK:STDOUT: .I = imports.%import_ref.848
  188. // CHECK:STDOUT: .C = imports.%import_ref.208
  189. // CHECK:STDOUT: .X = imports.%import_ref.58f
  190. // CHECK:STDOUT: .InInterfaceArgs = %InInterfaceArgs.decl
  191. // CHECK:STDOUT: }
  192. // CHECK:STDOUT: %default.import = import <invalid>
  193. // CHECK:STDOUT: %InInterfaceArgs.decl: type = class_decl @InInterfaceArgs [template = constants.%InInterfaceArgs] {} {}
  194. // CHECK:STDOUT: impl_decl @impl [template] {} {
  195. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%import_ref.58f [template = constants.%X]
  196. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%import_ref.848 [template = constants.%I.generic]
  197. // CHECK:STDOUT: %InInterfaceArgs.ref: type = name_ref InInterfaceArgs, file.%InInterfaceArgs.decl [template = constants.%InInterfaceArgs]
  198. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%InInterfaceArgs)> [template = constants.%I.type.da1]
  199. // CHECK:STDOUT: }
  200. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template = constants.%impl_witness]
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT:
  203. // CHECK:STDOUT: generic interface @I(constants.%T: type) [from "types.carbon"] {
  204. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  205. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  206. // CHECK:STDOUT:
  207. // CHECK:STDOUT: !definition:
  208. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.9d1)]
  209. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  210. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%T) [symbolic = %F.type (constants.%F.type.8ee)]
  211. // CHECK:STDOUT: %F: @I.%F.type (%F.type.8ee) = struct_value () [symbolic = %F (constants.%F.129)]
  212. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.9d1), @I.%F.type (%F.type.8ee) [symbolic = %F.assoc_type (constants.%F.assoc_type.351)]
  213. // CHECK:STDOUT: %assoc0: @I.%F.assoc_type (%F.assoc_type.351) = assoc_entity element0, imports.%import_ref.8d8 [symbolic = %assoc0 (constants.%assoc0.fd0)]
  214. // CHECK:STDOUT:
  215. // CHECK:STDOUT: interface {
  216. // CHECK:STDOUT: !members:
  217. // CHECK:STDOUT: .Self = imports.%import_ref.9c1
  218. // CHECK:STDOUT: .F = imports.%import_ref.355
  219. // CHECK:STDOUT: witness = (imports.%import_ref.938)
  220. // CHECK:STDOUT: }
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: impl @impl: %X.ref as %I.type {
  224. // CHECK:STDOUT: %F.decl: %F.type.2a0 = fn_decl @F.2 [template = constants.%F.eb4] {} {}
  225. // CHECK:STDOUT:
  226. // CHECK:STDOUT: !members:
  227. // CHECK:STDOUT: .F = %F.decl
  228. // CHECK:STDOUT: witness = file.%impl_witness
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: class @InInterfaceArgs {
  232. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: !members:
  235. // CHECK:STDOUT: .Self = constants.%InInterfaceArgs
  236. // CHECK:STDOUT: complete_type_witness = %complete_type
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: class @X [from "types.carbon"] {
  240. // CHECK:STDOUT: !members:
  241. // CHECK:STDOUT: .Self = imports.%import_ref.acf
  242. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f2
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: generic fn @F.1(constants.%T: type, constants.%Self: %I.type.9d1) [from "types.carbon"] {
  246. // CHECK:STDOUT:
  247. // CHECK:STDOUT: fn();
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: fn @F.2() {
  251. // CHECK:STDOUT: !entry:
  252. // CHECK:STDOUT: return
  253. // CHECK:STDOUT: }
  254. // CHECK:STDOUT:
  255. // CHECK:STDOUT: specific @I(constants.%T) {
  256. // CHECK:STDOUT: %T => constants.%T
  257. // CHECK:STDOUT: %T.patt => constants.%T
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @I(%T) {}
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {}
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) {
  265. // CHECK:STDOUT: %T => constants.%InInterfaceArgs
  266. // CHECK:STDOUT: %T.patt => constants.%InInterfaceArgs
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: !definition:
  269. // CHECK:STDOUT: %I.type => constants.%I.type.da1
  270. // CHECK:STDOUT: %Self => constants.%Self
  271. // CHECK:STDOUT: %F.type => constants.%F.type.5dc
  272. // CHECK:STDOUT: %F => constants.%F.55d
  273. // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.800
  274. // CHECK:STDOUT: %assoc0 => constants.%assoc0.d7d
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: specific @F.1(constants.%InInterfaceArgs, constants.%I.facet) {}
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: --- use_impl_in_interface_args.carbon
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: constants {
  282. // CHECK:STDOUT: %X: type = class_type @X [template]
  283. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  284. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  285. // CHECK:STDOUT: %G.type: type = fn_type @G [template]
  286. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  287. // CHECK:STDOUT: %G: %G.type = struct_value () [template]
  288. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
  289. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
  290. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  291. // CHECK:STDOUT: %I.type.9d1: type = facet_type <@I, @I(%T)> [symbolic]
  292. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic]
  293. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  294. // CHECK:STDOUT: %F.type.8ee: type = fn_type @F.1, @I(%T) [symbolic]
  295. // CHECK:STDOUT: %F.129: %F.type.8ee = struct_value () [symbolic]
  296. // CHECK:STDOUT: %F.assoc_type.351: type = assoc_entity_type %I.type.9d1, %F.type.8ee [symbolic]
  297. // CHECK:STDOUT: %assoc0.fd0b7a.1: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d80ba.1 [symbolic]
  298. // CHECK:STDOUT: %InInterfaceArgs: type = class_type @InInterfaceArgs [template]
  299. // CHECK:STDOUT: %I.type.da1: type = facet_type <@I, @I(%InInterfaceArgs)> [template]
  300. // CHECK:STDOUT: %F.type.5dc: type = fn_type @F.1, @I(%InInterfaceArgs) [template]
  301. // CHECK:STDOUT: %F.55d: %F.type.5dc = struct_value () [template]
  302. // CHECK:STDOUT: %F.assoc_type.800: type = assoc_entity_type %I.type.da1, %F.type.5dc [template]
  303. // CHECK:STDOUT: %assoc0.d7d: %F.assoc_type.800 = assoc_entity element0, imports.%import_ref.8d80ba.1 [template]
  304. // CHECK:STDOUT: %assoc0.fd0b7a.2: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d80ba.2 [symbolic]
  305. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%import_ref.a9d) [template]
  306. // CHECK:STDOUT: %F.type.461: type = fn_type @F.2 [template]
  307. // CHECK:STDOUT: %F.479: %F.type.461 = struct_value () [template]
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT:
  310. // CHECK:STDOUT: imports {
  311. // CHECK:STDOUT: %import_ref.848: %I.type.dac = import_ref Main//types, I, loaded [template = constants.%I.generic]
  312. // CHECK:STDOUT: %import_ref.208 = import_ref Main//types, C, unloaded
  313. // CHECK:STDOUT: %import_ref.58f: type = import_ref Main//types, X, loaded [template = constants.%X]
  314. // CHECK:STDOUT: %import_ref.4a4: type = import_ref Main//impl_in_interface_args, InInterfaceArgs, loaded [template = constants.%InInterfaceArgs]
  315. // CHECK:STDOUT: %import_ref.8f24d3.1: <witness> = import_ref Main//types, loc7_10, loaded [template = constants.%complete_type]
  316. // CHECK:STDOUT: %import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded
  317. // CHECK:STDOUT: %import_ref.9c1 = import_ref Main//types, inst26 [no loc], unloaded
  318. // CHECK:STDOUT: %import_ref.336: @I.%F.assoc_type (%F.assoc_type.351) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%assoc0 (constants.%assoc0.fd0b7a.2)]
  319. // CHECK:STDOUT: %import_ref.3d2 = import_ref Main//types, F, unloaded
  320. // CHECK:STDOUT: %import_ref.8d80ba.1 = import_ref Main//types, loc4_31, unloaded
  321. // CHECK:STDOUT: %import_ref.8f24d3.2: <witness> = import_ref Main//impl_in_interface_args, loc5_24, loaded [template = constants.%complete_type]
  322. // CHECK:STDOUT: %import_ref.bf8 = import_ref Main//impl_in_interface_args, inst18 [no loc], unloaded
  323. // CHECK:STDOUT: %import_ref.9b8: <witness> = import_ref Main//impl_in_interface_args, loc7_30, loaded [template = constants.%impl_witness]
  324. // CHECK:STDOUT: %import_ref.0ae: type = import_ref Main//impl_in_interface_args, loc7_6, loaded [template = constants.%X]
  325. // CHECK:STDOUT: %import_ref.927: type = import_ref Main//impl_in_interface_args, loc7_28, loaded [template = constants.%I.type.da1]
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: file {
  329. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  330. // CHECK:STDOUT: .I = imports.%import_ref.848
  331. // CHECK:STDOUT: .C = imports.%import_ref.208
  332. // CHECK:STDOUT: .X = imports.%import_ref.58f
  333. // CHECK:STDOUT: .InInterfaceArgs = imports.%import_ref.4a4
  334. // CHECK:STDOUT: .G = %G.decl
  335. // CHECK:STDOUT: }
  336. // CHECK:STDOUT: %default.import = import <invalid>
  337. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [template = constants.%G] {
  338. // CHECK:STDOUT: %x.patt: %X = binding_pattern x
  339. // CHECK:STDOUT: %x.param_patt: %X = value_param_pattern %x.patt, runtime_param0
  340. // CHECK:STDOUT: } {
  341. // CHECK:STDOUT: %x.param: %X = value_param runtime_param0
  342. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%import_ref.58f [template = constants.%X]
  343. // CHECK:STDOUT: %x: %X = bind_name x, %x.param
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: generic interface @I(constants.%T: type) [from "types.carbon"] {
  348. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  349. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: !definition:
  352. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.9d1)]
  353. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  354. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%T) [symbolic = %F.type (constants.%F.type.8ee)]
  355. // CHECK:STDOUT: %F: @I.%F.type (%F.type.8ee) = struct_value () [symbolic = %F (constants.%F.129)]
  356. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.9d1), @I.%F.type (%F.type.8ee) [symbolic = %F.assoc_type (constants.%F.assoc_type.351)]
  357. // CHECK:STDOUT: %assoc0: @I.%F.assoc_type (%F.assoc_type.351) = assoc_entity element0, imports.%import_ref.8d80ba.1 [symbolic = %assoc0 (constants.%assoc0.fd0b7a.1)]
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: interface {
  360. // CHECK:STDOUT: !members:
  361. // CHECK:STDOUT: .Self = imports.%import_ref.9c1
  362. // CHECK:STDOUT: .F = imports.%import_ref.336
  363. // CHECK:STDOUT: witness = (imports.%import_ref.3d2)
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: impl @impl: imports.%import_ref.0ae as imports.%import_ref.927 [from "impl_in_interface_args.carbon"] {
  368. // CHECK:STDOUT: !members:
  369. // CHECK:STDOUT: witness = imports.%import_ref.9b8
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: class @X [from "types.carbon"] {
  373. // CHECK:STDOUT: !members:
  374. // CHECK:STDOUT: .Self = imports.%import_ref.acf
  375. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.1
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: class @InInterfaceArgs [from "impl_in_interface_args.carbon"] {
  379. // CHECK:STDOUT: !members:
  380. // CHECK:STDOUT: .Self = imports.%import_ref.bf8
  381. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.2
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: fn @G(%x.param_patt: %X) {
  385. // CHECK:STDOUT: !entry:
  386. // CHECK:STDOUT: %x.ref: %X = name_ref x, %x
  387. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%import_ref.848 [template = constants.%I.generic]
  388. // CHECK:STDOUT: %InInterfaceArgs.ref: type = name_ref InInterfaceArgs, imports.%import_ref.4a4 [template = constants.%InInterfaceArgs]
  389. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%InInterfaceArgs)> [template = constants.%I.type.da1]
  390. // CHECK:STDOUT: %.loc6: %F.assoc_type.800 = specific_constant imports.%import_ref.336, @I(constants.%InInterfaceArgs) [template = constants.%assoc0.d7d]
  391. // CHECK:STDOUT: %F.ref: %F.assoc_type.800 = name_ref F, %.loc6 [template = constants.%assoc0.d7d]
  392. // CHECK:STDOUT: %impl.elem0: %F.type.5dc = impl_witness_access constants.%impl_witness, element0 [template = constants.%F.479]
  393. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0()
  394. // CHECK:STDOUT: return
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT:
  397. // CHECK:STDOUT: generic fn @F.1(constants.%T: type, constants.%Self: %I.type.9d1) [from "types.carbon"] {
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: fn();
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: fn @F.2() [from "impl_in_interface_args.carbon"];
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: specific @I(constants.%T) {
  405. // CHECK:STDOUT: %T => constants.%T
  406. // CHECK:STDOUT: %T.patt => constants.%T
  407. // CHECK:STDOUT: }
  408. // CHECK:STDOUT:
  409. // CHECK:STDOUT: specific @I(%T) {}
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {}
  412. // CHECK:STDOUT:
  413. // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) {
  414. // CHECK:STDOUT: %T => constants.%InInterfaceArgs
  415. // CHECK:STDOUT: %T.patt => constants.%InInterfaceArgs
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: !definition:
  418. // CHECK:STDOUT: %I.type => constants.%I.type.da1
  419. // CHECK:STDOUT: %Self => constants.%Self
  420. // CHECK:STDOUT: %F.type => constants.%F.type.5dc
  421. // CHECK:STDOUT: %F => constants.%F.55d
  422. // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.800
  423. // CHECK:STDOUT: %assoc0 => constants.%assoc0.d7d
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: --- impl_in_class_args.carbon
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: constants {
  429. // CHECK:STDOUT: %InClassArgs: type = class_type @InClassArgs [template]
  430. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  431. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  432. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  433. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  434. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  435. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  436. // CHECK:STDOUT: %C.5b1: type = class_type @C, @C(%InClassArgs) [template]
  437. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
  438. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
  439. // CHECK:STDOUT: %I.type.9d1: type = facet_type <@I, @I(%T)> [symbolic]
  440. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic]
  441. // CHECK:STDOUT: %F.type.8ee: type = fn_type @F.1, @I(%T) [symbolic]
  442. // CHECK:STDOUT: %F.129: %F.type.8ee = struct_value () [symbolic]
  443. // CHECK:STDOUT: %F.assoc_type.351: type = assoc_entity_type %I.type.9d1, %F.type.8ee [symbolic]
  444. // CHECK:STDOUT: %assoc0.fd0: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d8 [symbolic]
  445. // CHECK:STDOUT: %X: type = class_type @X [template]
  446. // CHECK:STDOUT: %I.type.914: type = facet_type <@I, @I(%X)> [template]
  447. // CHECK:STDOUT: %F.type.ea3: type = fn_type @F.1, @I(%X) [template]
  448. // CHECK:STDOUT: %F.e0e: %F.type.ea3 = struct_value () [template]
  449. // CHECK:STDOUT: %F.assoc_type.f41: type = assoc_entity_type %I.type.914, %F.type.ea3 [template]
  450. // CHECK:STDOUT: %assoc0.7c3: %F.assoc_type.f41 = assoc_entity element0, imports.%import_ref.8d8 [template]
  451. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template]
  452. // CHECK:STDOUT: %F.type.73d: type = fn_type @F.2 [template]
  453. // CHECK:STDOUT: %F.e0f: %F.type.73d = struct_value () [template]
  454. // CHECK:STDOUT: %I.facet: %I.type.9d1 = facet_value %C.5b1, %impl_witness [symbolic]
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: imports {
  458. // CHECK:STDOUT: %import_ref.848: %I.type.dac = import_ref Main//types, I, loaded [template = constants.%I.generic]
  459. // CHECK:STDOUT: %import_ref.26e: %C.type = import_ref Main//types, C, loaded [template = constants.%C.generic]
  460. // CHECK:STDOUT: %import_ref.58f: type = import_ref Main//types, X, loaded [template = constants.%X]
  461. // CHECK:STDOUT: %import_ref.8f24d3.1: <witness> = import_ref Main//types, loc5_20, loaded [template = constants.%complete_type]
  462. // CHECK:STDOUT: %import_ref.495 = import_ref Main//types, inst49 [no loc], unloaded
  463. // CHECK:STDOUT: %import_ref.9c1 = import_ref Main//types, inst26 [no loc], unloaded
  464. // CHECK:STDOUT: %import_ref.355 = import_ref Main//types, loc4_31, unloaded
  465. // CHECK:STDOUT: %import_ref.938: @I.%F.type (%F.type.8ee) = import_ref Main//types, F, loaded [symbolic = @I.%F (constants.%F.129)]
  466. // CHECK:STDOUT: %import_ref.8d8 = import_ref Main//types, loc4_31, unloaded
  467. // CHECK:STDOUT: %import_ref.8f24d3.2: <witness> = import_ref Main//types, loc7_10, loaded [template = constants.%complete_type]
  468. // CHECK:STDOUT: %import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: file {
  472. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  473. // CHECK:STDOUT: .I = imports.%import_ref.848
  474. // CHECK:STDOUT: .C = imports.%import_ref.26e
  475. // CHECK:STDOUT: .X = imports.%import_ref.58f
  476. // CHECK:STDOUT: .InClassArgs = %InClassArgs.decl
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: %default.import = import <invalid>
  479. // CHECK:STDOUT: %InClassArgs.decl: type = class_decl @InClassArgs [template = constants.%InClassArgs] {} {}
  480. // CHECK:STDOUT: impl_decl @impl [template] {} {
  481. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.26e [template = constants.%C.generic]
  482. // CHECK:STDOUT: %InClassArgs.ref: type = name_ref InClassArgs, file.%InClassArgs.decl [template = constants.%InClassArgs]
  483. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%InClassArgs) [template = constants.%C.5b1]
  484. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%import_ref.848 [template = constants.%I.generic]
  485. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%import_ref.58f [template = constants.%X]
  486. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%X)> [template = constants.%I.type.914]
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (@impl.%F.decl) [template = constants.%impl_witness]
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT:
  491. // CHECK:STDOUT: generic interface @I(constants.%T: type) [from "types.carbon"] {
  492. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  493. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: !definition:
  496. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.9d1)]
  497. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  498. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%T) [symbolic = %F.type (constants.%F.type.8ee)]
  499. // CHECK:STDOUT: %F: @I.%F.type (%F.type.8ee) = struct_value () [symbolic = %F (constants.%F.129)]
  500. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.9d1), @I.%F.type (%F.type.8ee) [symbolic = %F.assoc_type (constants.%F.assoc_type.351)]
  501. // CHECK:STDOUT: %assoc0: @I.%F.assoc_type (%F.assoc_type.351) = assoc_entity element0, imports.%import_ref.8d8 [symbolic = %assoc0 (constants.%assoc0.fd0)]
  502. // CHECK:STDOUT:
  503. // CHECK:STDOUT: interface {
  504. // CHECK:STDOUT: !members:
  505. // CHECK:STDOUT: .Self = imports.%import_ref.9c1
  506. // CHECK:STDOUT: .F = imports.%import_ref.355
  507. // CHECK:STDOUT: witness = (imports.%import_ref.938)
  508. // CHECK:STDOUT: }
  509. // CHECK:STDOUT: }
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: impl @impl: %C as %I.type {
  512. // CHECK:STDOUT: %F.decl: %F.type.73d = fn_decl @F.2 [template = constants.%F.e0f] {} {}
  513. // CHECK:STDOUT:
  514. // CHECK:STDOUT: !members:
  515. // CHECK:STDOUT: .F = %F.decl
  516. // CHECK:STDOUT: witness = file.%impl_witness
  517. // CHECK:STDOUT: }
  518. // CHECK:STDOUT:
  519. // CHECK:STDOUT: class @InClassArgs {
  520. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: !members:
  523. // CHECK:STDOUT: .Self = constants.%InClassArgs
  524. // CHECK:STDOUT: complete_type_witness = %complete_type
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: generic class @C(constants.%T: type) [from "types.carbon"] {
  528. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  529. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  530. // CHECK:STDOUT:
  531. // CHECK:STDOUT: !definition:
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: class {
  534. // CHECK:STDOUT: !members:
  535. // CHECK:STDOUT: .Self = imports.%import_ref.495
  536. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.1
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: class @X [from "types.carbon"] {
  541. // CHECK:STDOUT: !members:
  542. // CHECK:STDOUT: .Self = imports.%import_ref.acf
  543. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.2
  544. // CHECK:STDOUT: }
  545. // CHECK:STDOUT:
  546. // CHECK:STDOUT: generic fn @F.1(constants.%T: type, constants.%Self: %I.type.9d1) [from "types.carbon"] {
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: fn();
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT:
  551. // CHECK:STDOUT: fn @F.2() {
  552. // CHECK:STDOUT: !entry:
  553. // CHECK:STDOUT: return
  554. // CHECK:STDOUT: }
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: specific @C(constants.%T) {
  557. // CHECK:STDOUT: %T => constants.%T
  558. // CHECK:STDOUT: %T.patt => constants.%T
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: specific @C(constants.%InClassArgs) {
  562. // CHECK:STDOUT: %T => constants.%InClassArgs
  563. // CHECK:STDOUT: %T.patt => constants.%InClassArgs
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: specific @I(constants.%T) {
  567. // CHECK:STDOUT: %T => constants.%T
  568. // CHECK:STDOUT: %T.patt => constants.%T
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: specific @I(%T) {}
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {}
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: specific @I(constants.%X) {
  576. // CHECK:STDOUT: %T => constants.%X
  577. // CHECK:STDOUT: %T.patt => constants.%X
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: !definition:
  580. // CHECK:STDOUT: %I.type => constants.%I.type.914
  581. // CHECK:STDOUT: %Self => constants.%Self
  582. // CHECK:STDOUT: %F.type => constants.%F.type.ea3
  583. // CHECK:STDOUT: %F => constants.%F.e0e
  584. // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.f41
  585. // CHECK:STDOUT: %assoc0 => constants.%assoc0.7c3
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: specific @F.1(constants.%X, constants.%I.facet) {}
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: --- use_impl_in_class_args.carbon
  591. // CHECK:STDOUT:
  592. // CHECK:STDOUT: constants {
  593. // CHECK:STDOUT: %C.type: type = generic_class_type @C [template]
  594. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  595. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [template]
  596. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  597. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  598. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  599. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic]
  600. // CHECK:STDOUT: %InClassArgs: type = class_type @InClassArgs [template]
  601. // CHECK:STDOUT: %C.5b1: type = class_type @C, @C(%InClassArgs) [template]
  602. // CHECK:STDOUT: %H.type: type = fn_type @H [template]
  603. // CHECK:STDOUT: %H: %H.type = struct_value () [template]
  604. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [template]
  605. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [template]
  606. // CHECK:STDOUT: %I.type.9d1: type = facet_type <@I, @I(%T)> [symbolic]
  607. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic]
  608. // CHECK:STDOUT: %F.type.8ee: type = fn_type @F.1, @I(%T) [symbolic]
  609. // CHECK:STDOUT: %F.129: %F.type.8ee = struct_value () [symbolic]
  610. // CHECK:STDOUT: %F.assoc_type.351: type = assoc_entity_type %I.type.9d1, %F.type.8ee [symbolic]
  611. // CHECK:STDOUT: %assoc0.fd0b7a.1: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d80ba.1 [symbolic]
  612. // CHECK:STDOUT: %X: type = class_type @X [template]
  613. // CHECK:STDOUT: %I.type.914: type = facet_type <@I, @I(%X)> [template]
  614. // CHECK:STDOUT: %F.type.ea3: type = fn_type @F.1, @I(%X) [template]
  615. // CHECK:STDOUT: %F.e0e: %F.type.ea3 = struct_value () [template]
  616. // CHECK:STDOUT: %F.assoc_type.f41: type = assoc_entity_type %I.type.914, %F.type.ea3 [template]
  617. // CHECK:STDOUT: %assoc0.7c3: %F.assoc_type.f41 = assoc_entity element0, imports.%import_ref.8d80ba.1 [template]
  618. // CHECK:STDOUT: %assoc0.fd0b7a.2: %F.assoc_type.351 = assoc_entity element0, imports.%import_ref.8d80ba.2 [symbolic]
  619. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness (imports.%import_ref.8f2f) [template]
  620. // CHECK:STDOUT: %F.type.563: type = fn_type @F.2 [template]
  621. // CHECK:STDOUT: %F.6f3: %F.type.563 = struct_value () [template]
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT:
  624. // CHECK:STDOUT: imports {
  625. // CHECK:STDOUT: %import_ref.848: %I.type.dac = import_ref Main//types, I, loaded [template = constants.%I.generic]
  626. // CHECK:STDOUT: %import_ref.26e: %C.type = import_ref Main//types, C, loaded [template = constants.%C.generic]
  627. // CHECK:STDOUT: %import_ref.58f: type = import_ref Main//types, X, loaded [template = constants.%X]
  628. // CHECK:STDOUT: %import_ref.4d5: type = import_ref Main//impl_in_class_args, InClassArgs, loaded [template = constants.%InClassArgs]
  629. // CHECK:STDOUT: %import_ref.8f24d3.1: <witness> = import_ref Main//types, loc5_20, loaded [template = constants.%complete_type]
  630. // CHECK:STDOUT: %import_ref.495 = import_ref Main//types, inst49 [no loc], unloaded
  631. // CHECK:STDOUT: %import_ref.8f24d3.2: <witness> = import_ref Main//impl_in_class_args, loc5_20, loaded [template = constants.%complete_type]
  632. // CHECK:STDOUT: %import_ref.683 = import_ref Main//impl_in_class_args, inst18 [no loc], unloaded
  633. // CHECK:STDOUT: %import_ref.9c1 = import_ref Main//types, inst26 [no loc], unloaded
  634. // CHECK:STDOUT: %import_ref.336: @I.%F.assoc_type (%F.assoc_type.351) = import_ref Main//types, loc4_31, loaded [symbolic = @I.%assoc0 (constants.%assoc0.fd0b7a.2)]
  635. // CHECK:STDOUT: %import_ref.3d2 = import_ref Main//types, F, unloaded
  636. // CHECK:STDOUT: %import_ref.8d80ba.1 = import_ref Main//types, loc4_31, unloaded
  637. // CHECK:STDOUT: %import_ref.8f24d3.3: <witness> = import_ref Main//types, loc7_10, loaded [template = constants.%complete_type]
  638. // CHECK:STDOUT: %import_ref.acf = import_ref Main//types, inst54 [no loc], unloaded
  639. // CHECK:STDOUT: %import_ref.74e: <witness> = import_ref Main//impl_in_class_args, loc7_29, loaded [template = constants.%impl_witness]
  640. // CHECK:STDOUT: %import_ref.829: type = import_ref Main//impl_in_class_args, loc7_19, loaded [template = constants.%C.5b1]
  641. // CHECK:STDOUT: %import_ref.022: type = import_ref Main//impl_in_class_args, loc7_27, loaded [template = constants.%I.type.914]
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: file {
  645. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  646. // CHECK:STDOUT: .I = imports.%import_ref.848
  647. // CHECK:STDOUT: .C = imports.%import_ref.26e
  648. // CHECK:STDOUT: .X = imports.%import_ref.58f
  649. // CHECK:STDOUT: .InClassArgs = imports.%import_ref.4d5
  650. // CHECK:STDOUT: .H = %H.decl
  651. // CHECK:STDOUT: }
  652. // CHECK:STDOUT: %default.import = import <invalid>
  653. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [template = constants.%H] {
  654. // CHECK:STDOUT: %c.patt: %C.5b1 = binding_pattern c
  655. // CHECK:STDOUT: %c.param_patt: %C.5b1 = value_param_pattern %c.patt, runtime_param0
  656. // CHECK:STDOUT: } {
  657. // CHECK:STDOUT: %c.param: %C.5b1 = value_param runtime_param0
  658. // CHECK:STDOUT: %.loc6_22: type = splice_block %C [template = constants.%C.5b1] {
  659. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%import_ref.26e [template = constants.%C.generic]
  660. // CHECK:STDOUT: %InClassArgs.ref: type = name_ref InClassArgs, imports.%import_ref.4d5 [template = constants.%InClassArgs]
  661. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%InClassArgs) [template = constants.%C.5b1]
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT: %c: %C.5b1 = bind_name c, %c.param
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: generic interface @I(constants.%T: type) [from "types.carbon"] {
  668. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  669. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: !definition:
  672. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.9d1)]
  673. // CHECK:STDOUT: %Self: %I.type.9d1 = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  674. // CHECK:STDOUT: %F.type: type = fn_type @F.1, @I(%T) [symbolic = %F.type (constants.%F.type.8ee)]
  675. // CHECK:STDOUT: %F: @I.%F.type (%F.type.8ee) = struct_value () [symbolic = %F (constants.%F.129)]
  676. // CHECK:STDOUT: %F.assoc_type: type = assoc_entity_type @I.%I.type (%I.type.9d1), @I.%F.type (%F.type.8ee) [symbolic = %F.assoc_type (constants.%F.assoc_type.351)]
  677. // CHECK:STDOUT: %assoc0: @I.%F.assoc_type (%F.assoc_type.351) = assoc_entity element0, imports.%import_ref.8d80ba.1 [symbolic = %assoc0 (constants.%assoc0.fd0b7a.1)]
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: interface {
  680. // CHECK:STDOUT: !members:
  681. // CHECK:STDOUT: .Self = imports.%import_ref.9c1
  682. // CHECK:STDOUT: .F = imports.%import_ref.336
  683. // CHECK:STDOUT: witness = (imports.%import_ref.3d2)
  684. // CHECK:STDOUT: }
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: impl @impl: imports.%import_ref.829 as imports.%import_ref.022 [from "impl_in_class_args.carbon"] {
  688. // CHECK:STDOUT: !members:
  689. // CHECK:STDOUT: witness = imports.%import_ref.74e
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT:
  692. // CHECK:STDOUT: generic class @C(constants.%T: type) [from "types.carbon"] {
  693. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  694. // CHECK:STDOUT: %T.patt: type = symbolic_binding_pattern T, 0 [symbolic = %T.patt (constants.%T.patt)]
  695. // CHECK:STDOUT:
  696. // CHECK:STDOUT: !definition:
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: class {
  699. // CHECK:STDOUT: !members:
  700. // CHECK:STDOUT: .Self = imports.%import_ref.495
  701. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.1
  702. // CHECK:STDOUT: }
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: class @InClassArgs [from "impl_in_class_args.carbon"] {
  706. // CHECK:STDOUT: !members:
  707. // CHECK:STDOUT: .Self = imports.%import_ref.683
  708. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.2
  709. // CHECK:STDOUT: }
  710. // CHECK:STDOUT:
  711. // CHECK:STDOUT: class @X [from "types.carbon"] {
  712. // CHECK:STDOUT: !members:
  713. // CHECK:STDOUT: .Self = imports.%import_ref.acf
  714. // CHECK:STDOUT: complete_type_witness = imports.%import_ref.8f24d3.3
  715. // CHECK:STDOUT: }
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: fn @H(%c.param_patt: %C.5b1) {
  718. // CHECK:STDOUT: !entry:
  719. // CHECK:STDOUT: %c.ref: %C.5b1 = name_ref c, %c
  720. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%import_ref.848 [template = constants.%I.generic]
  721. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%import_ref.58f [template = constants.%X]
  722. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%X)> [template = constants.%I.type.914]
  723. // CHECK:STDOUT: %.loc6_34: %F.assoc_type.f41 = specific_constant imports.%import_ref.336, @I(constants.%X) [template = constants.%assoc0.7c3]
  724. // CHECK:STDOUT: %F.ref: %F.assoc_type.f41 = name_ref F, %.loc6_34 [template = constants.%assoc0.7c3]
  725. // CHECK:STDOUT: %impl.elem0: %F.type.ea3 = impl_witness_access constants.%impl_witness, element0 [template = constants.%F.6f3]
  726. // CHECK:STDOUT: %F.call: init %empty_tuple.type = call %impl.elem0()
  727. // CHECK:STDOUT: return
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: generic fn @F.1(constants.%T: type, constants.%Self: %I.type.9d1) [from "types.carbon"] {
  731. // CHECK:STDOUT:
  732. // CHECK:STDOUT: fn();
  733. // CHECK:STDOUT: }
  734. // CHECK:STDOUT:
  735. // CHECK:STDOUT: fn @F.2() [from "impl_in_class_args.carbon"];
  736. // CHECK:STDOUT:
  737. // CHECK:STDOUT: specific @C(constants.%T) {
  738. // CHECK:STDOUT: %T => constants.%T
  739. // CHECK:STDOUT: %T.patt => constants.%T
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: specific @C(constants.%InClassArgs) {
  743. // CHECK:STDOUT: %T => constants.%InClassArgs
  744. // CHECK:STDOUT: %T.patt => constants.%InClassArgs
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: !definition:
  747. // CHECK:STDOUT: }
  748. // CHECK:STDOUT:
  749. // CHECK:STDOUT: specific @I(constants.%T) {
  750. // CHECK:STDOUT: %T => constants.%T
  751. // CHECK:STDOUT: %T.patt => constants.%T
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT:
  754. // CHECK:STDOUT: specific @I(%T) {}
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: specific @F.1(constants.%T, constants.%Self) {}
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: specific @I(constants.%X) {
  759. // CHECK:STDOUT: %T => constants.%X
  760. // CHECK:STDOUT: %T.patt => constants.%X
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: !definition:
  763. // CHECK:STDOUT: %I.type => constants.%I.type.914
  764. // CHECK:STDOUT: %Self => constants.%Self
  765. // CHECK:STDOUT: %F.type => constants.%F.type.ea3
  766. // CHECK:STDOUT: %F => constants.%F.e0e
  767. // CHECK:STDOUT: %F.assoc_type => constants.%F.assoc_type.f41
  768. // CHECK:STDOUT: %assoc0 => constants.%assoc0.7c3
  769. // CHECK:STDOUT: }
  770. // CHECK:STDOUT: