specific_args.carbon 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/lookup/specific_args.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/lookup/specific_args.carbon
  14. // --- types.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I(T:! type) { fn F[self: Self](); }
  17. class C(T:! type) {}
  18. class X {}
  19. // --- impl_in_interface_args.carbon
  20. library "[[@TEST_NAME]]";
  21. import library "types";
  22. class InInterfaceArgs {}
  23. impl X as I(InInterfaceArgs) { fn F[self: Self]() {} }
  24. // --- use_impl_in_interface_args.carbon
  25. library "[[@TEST_NAME]]";
  26. import library "types";
  27. import library "impl_in_interface_args";
  28. fn G(x: X) { x.(I(InInterfaceArgs).F)(); }
  29. // --- impl_in_class_args.carbon
  30. library "[[@TEST_NAME]]";
  31. import library "types";
  32. class InClassArgs {}
  33. impl C(InClassArgs) as I(X) { fn F[self: Self]() {} }
  34. // --- use_impl_in_class_args.carbon
  35. library "[[@TEST_NAME]]";
  36. import library "types";
  37. import library "impl_in_class_args";
  38. fn H(c: C(InClassArgs)) { c.(I(X).F)(); }
  39. // CHECK:STDOUT: --- types.carbon
  40. // CHECK:STDOUT:
  41. // CHECK:STDOUT: constants {
  42. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self]
  43. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  44. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  45. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  46. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  47. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  48. // CHECK:STDOUT: %Self: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  49. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic]
  50. // CHECK:STDOUT: %pattern_type.4be: type = pattern_type %Self.as_type [symbolic]
  51. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T) [symbolic]
  52. // CHECK:STDOUT: %I.F: %I.F.type = struct_value () [symbolic]
  53. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T) [symbolic]
  54. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%I.F.decl [symbolic]
  55. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  56. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  57. // CHECK:STDOUT: %C: type = class_type @C, @C(%T) [symbolic]
  58. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  59. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  60. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  61. // CHECK:STDOUT: }
  62. // CHECK:STDOUT:
  63. // CHECK:STDOUT: file {
  64. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  65. // CHECK:STDOUT: .I = %I.decl
  66. // CHECK:STDOUT: .C = %C.decl
  67. // CHECK:STDOUT: .X = %X.decl
  68. // CHECK:STDOUT: }
  69. // CHECK:STDOUT: %I.decl: %I.type.dac = interface_decl @I [concrete = constants.%I.generic] {
  70. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  71. // CHECK:STDOUT: } {
  72. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  73. // CHECK:STDOUT: %T.loc4_13.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  74. // CHECK:STDOUT: }
  75. // CHECK:STDOUT: %C.decl: %C.type = class_decl @C [concrete = constants.%C.generic] {
  76. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  77. // CHECK:STDOUT: } {
  78. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  79. // CHECK:STDOUT: %T.loc5_9.2: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_9.1 (constants.%T)]
  80. // CHECK:STDOUT: }
  81. // CHECK:STDOUT: %X.decl: type = class_decl @X [concrete = constants.%X] {} {}
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT:
  84. // CHECK:STDOUT: generic interface @I(%T.loc4_13.2: type) {
  85. // CHECK:STDOUT: %T.loc4_13.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc4_13.1 (constants.%T)]
  86. // CHECK:STDOUT:
  87. // CHECK:STDOUT: !definition:
  88. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc4_13.1)> [symbolic = %I.type (constants.%I.type.325)]
  89. // CHECK:STDOUT: %Self.2: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  90. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T.loc4_13.1) [symbolic = %I.F.type (constants.%I.F.type)]
  91. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type) = struct_value () [symbolic = %I.F (constants.%I.F)]
  92. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T.loc4_13.1) [symbolic = %I.assoc_type (constants.%I.assoc_type)]
  93. // CHECK:STDOUT: %assoc0.loc4_43.2: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %I.F.decl [symbolic = %assoc0.loc4_43.2 (constants.%assoc0)]
  94. // CHECK:STDOUT:
  95. // CHECK:STDOUT: interface {
  96. // CHECK:STDOUT: %Self.1: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self.2 (constants.%Self)]
  97. // CHECK:STDOUT: %I.F.decl: @I.%I.F.type (%I.F.type) = fn_decl @I.F [symbolic = @I.%I.F (constants.%I.F)] {
  98. // CHECK:STDOUT: %self.patt: @I.F.%pattern_type (%pattern_type.4be) = binding_pattern self [concrete]
  99. // CHECK:STDOUT: %self.param_patt: @I.F.%pattern_type (%pattern_type.4be) = value_param_pattern %self.patt, call_param0 [concrete]
  100. // CHECK:STDOUT: } {
  101. // CHECK:STDOUT: %self.param: @I.F.%Self.as_type.loc4_36.1 (%Self.as_type) = value_param call_param0
  102. // CHECK:STDOUT: %.loc4_36.1: type = splice_block %.loc4_36.3 [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)] {
  103. // CHECK:STDOUT: %.loc4_36.2: @I.F.%I.type (%I.type.325) = specific_constant @I.%Self.1, @I(constants.%T) [symbolic = %Self (constants.%Self)]
  104. // CHECK:STDOUT: %Self.ref: @I.F.%I.type (%I.type.325) = name_ref Self, %.loc4_36.2 [symbolic = %Self (constants.%Self)]
  105. // CHECK:STDOUT: %Self.as_type.loc4_36.2: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)]
  106. // CHECK:STDOUT: %.loc4_36.3: type = converted %Self.ref, %Self.as_type.loc4_36.2 [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)]
  107. // CHECK:STDOUT: }
  108. // CHECK:STDOUT: %self: @I.F.%Self.as_type.loc4_36.1 (%Self.as_type) = bind_name self, %self.param
  109. // CHECK:STDOUT: }
  110. // CHECK:STDOUT: %assoc0.loc4_43.1: @I.%I.assoc_type (%I.assoc_type) = assoc_entity element0, %I.F.decl [symbolic = %assoc0.loc4_43.2 (constants.%assoc0)]
  111. // CHECK:STDOUT:
  112. // CHECK:STDOUT: !members:
  113. // CHECK:STDOUT: .Self = %Self.1
  114. // CHECK:STDOUT: .F = %assoc0.loc4_43.1
  115. // CHECK:STDOUT: witness = (%I.F.decl)
  116. // CHECK:STDOUT: }
  117. // CHECK:STDOUT: }
  118. // CHECK:STDOUT:
  119. // CHECK:STDOUT: generic class @C(%T.loc5_9.2: type) {
  120. // CHECK:STDOUT: %T.loc5_9.1: type = bind_symbolic_name T, 0 [symbolic = %T.loc5_9.1 (constants.%T)]
  121. // CHECK:STDOUT:
  122. // CHECK:STDOUT: !definition:
  123. // CHECK:STDOUT:
  124. // CHECK:STDOUT: class {
  125. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  126. // CHECK:STDOUT: complete_type_witness = %complete_type
  127. // CHECK:STDOUT:
  128. // CHECK:STDOUT: !members:
  129. // CHECK:STDOUT: .Self = constants.%C
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT: }
  132. // CHECK:STDOUT:
  133. // CHECK:STDOUT: class @X {
  134. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  135. // CHECK:STDOUT: complete_type_witness = %complete_type
  136. // CHECK:STDOUT:
  137. // CHECK:STDOUT: !members:
  138. // CHECK:STDOUT: .Self = constants.%X
  139. // CHECK:STDOUT: }
  140. // CHECK:STDOUT:
  141. // CHECK:STDOUT: generic fn @I.F(@I.%T.loc4_13.2: type, @I.%Self.1: @I.%I.type (%I.type.325)) {
  142. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  143. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  144. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self)]
  145. // CHECK:STDOUT: %Self.as_type.loc4_36.1: type = facet_access_type %Self [symbolic = %Self.as_type.loc4_36.1 (constants.%Self.as_type)]
  146. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type.loc4_36.1 [symbolic = %pattern_type (constants.%pattern_type.4be)]
  147. // CHECK:STDOUT:
  148. // CHECK:STDOUT: fn(%self.param: @I.F.%Self.as_type.loc4_36.1 (%Self.as_type));
  149. // CHECK:STDOUT: }
  150. // CHECK:STDOUT:
  151. // CHECK:STDOUT: specific @I(constants.%T) {
  152. // CHECK:STDOUT: %T.loc4_13.1 => constants.%T
  153. // CHECK:STDOUT: }
  154. // CHECK:STDOUT:
  155. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self) {
  156. // CHECK:STDOUT: %T => constants.%T
  157. // CHECK:STDOUT: %I.type => constants.%I.type.325
  158. // CHECK:STDOUT: %Self => constants.%Self
  159. // CHECK:STDOUT: %Self.as_type.loc4_36.1 => constants.%Self.as_type
  160. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4be
  161. // CHECK:STDOUT: }
  162. // CHECK:STDOUT:
  163. // CHECK:STDOUT: specific @C(constants.%T) {
  164. // CHECK:STDOUT: %T.loc5_9.1 => constants.%T
  165. // CHECK:STDOUT: }
  166. // CHECK:STDOUT:
  167. // CHECK:STDOUT: --- impl_in_interface_args.carbon
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: constants {
  170. // CHECK:STDOUT: %InInterfaceArgs: type = class_type @InInterfaceArgs [concrete]
  171. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  172. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  173. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  174. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  175. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  176. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  177. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  178. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  179. // CHECK:STDOUT: %I.F.type.2ae: type = fn_type @I.F, @I(%T) [symbolic]
  180. // CHECK:STDOUT: %I.F.bb2: %I.F.type.2ae = struct_value () [symbolic]
  181. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.209 [symbolic]
  182. // CHECK:STDOUT: %pattern_type.4be: type = pattern_type %Self.as_type [symbolic]
  183. // CHECK:STDOUT: %I.assoc_type.1e5: type = assoc_entity_type @I, @I(%T) [symbolic]
  184. // CHECK:STDOUT: %assoc0.688: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic]
  185. // CHECK:STDOUT: %I.type.e45: type = facet_type <@I, @I(%InInterfaceArgs)> [concrete]
  186. // CHECK:STDOUT: %Self.061: %I.type.e45 = bind_symbolic_name Self, 1 [symbolic]
  187. // CHECK:STDOUT: %I.F.type.14f: type = fn_type @I.F, @I(%InInterfaceArgs) [concrete]
  188. // CHECK:STDOUT: %I.F.b81: %I.F.type.14f = struct_value () [concrete]
  189. // CHECK:STDOUT: %I.assoc_type.521: type = assoc_entity_type @I, @I(%InInterfaceArgs) [concrete]
  190. // CHECK:STDOUT: %assoc0.676: %I.assoc_type.521 = assoc_entity element0, imports.%Main.import_ref.479 [concrete]
  191. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  192. // CHECK:STDOUT: %pattern_type.019: type = pattern_type %X [concrete]
  193. // CHECK:STDOUT: %X.as.I.impl.F.type: type = fn_type @X.as.I.impl.F [concrete]
  194. // CHECK:STDOUT: %X.as.I.impl.F: %X.as.I.impl.F.type = struct_value () [concrete]
  195. // CHECK:STDOUT: %I.facet: %I.type.e45 = facet_value %X, (%I.impl_witness) [concrete]
  196. // CHECK:STDOUT: }
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: imports {
  199. // CHECK:STDOUT: %Main.I: %I.type.dac = import_ref Main//types, I, loaded [concrete = constants.%I.generic]
  200. // CHECK:STDOUT: %Main.C = import_ref Main//types, C, unloaded
  201. // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X]
  202. // CHECK:STDOUT: %Main.import_ref.8f2: <witness> = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type]
  203. // CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst69 [no loc], unloaded
  204. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  205. // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst27 [no loc], unloaded
  206. // CHECK:STDOUT: %Main.import_ref.2bb = import_ref Main//types, loc4_43, unloaded
  207. // CHECK:STDOUT: %Main.F: @I.%I.F.type (%I.F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%I.F (constants.%I.F.bb2)]
  208. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  209. // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst27 [no loc], loaded [symbolic = @I.%Self (constants.%Self.209)]
  210. // CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded
  211. // CHECK:STDOUT: }
  212. // CHECK:STDOUT:
  213. // CHECK:STDOUT: file {
  214. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  215. // CHECK:STDOUT: .I = imports.%Main.I
  216. // CHECK:STDOUT: .C = imports.%Main.C
  217. // CHECK:STDOUT: .X = imports.%Main.X
  218. // CHECK:STDOUT: .InInterfaceArgs = %InInterfaceArgs.decl
  219. // CHECK:STDOUT: }
  220. // CHECK:STDOUT: %default.import = import <none>
  221. // CHECK:STDOUT: %InInterfaceArgs.decl: type = class_decl @InInterfaceArgs [concrete = constants.%InInterfaceArgs] {} {}
  222. // CHECK:STDOUT: impl_decl @X.as.I.impl [concrete] {} {
  223. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Main.X [concrete = constants.%X]
  224. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  225. // CHECK:STDOUT: %InInterfaceArgs.ref: type = name_ref InInterfaceArgs, file.%InInterfaceArgs.decl [concrete = constants.%InInterfaceArgs]
  226. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%InInterfaceArgs)> [concrete = constants.%I.type.e45]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@X.as.I.impl.%X.as.I.impl.F.decl), @X.as.I.impl [concrete]
  229. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  230. // CHECK:STDOUT: }
  231. // CHECK:STDOUT:
  232. // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.5ab3ec.1: type) [from "types.carbon"] {
  233. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: !definition:
  236. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  237. // CHECK:STDOUT: %Self: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  238. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T) [symbolic = %I.F.type (constants.%I.F.type.2ae)]
  239. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type.2ae) = struct_value () [symbolic = %I.F (constants.%I.F.bb2)]
  240. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T) [symbolic = %I.assoc_type (constants.%I.assoc_type.1e5)]
  241. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.1e5) = assoc_entity element0, imports.%Main.import_ref.479 [symbolic = %assoc0 (constants.%assoc0.688)]
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: interface {
  244. // CHECK:STDOUT: !members:
  245. // CHECK:STDOUT: .Self = imports.%Main.import_ref.884
  246. // CHECK:STDOUT: .F = imports.%Main.import_ref.2bb
  247. // CHECK:STDOUT: witness = (imports.%Main.F)
  248. // CHECK:STDOUT: }
  249. // CHECK:STDOUT: }
  250. // CHECK:STDOUT:
  251. // CHECK:STDOUT: impl @X.as.I.impl: %X.ref as %I.type {
  252. // CHECK:STDOUT: %X.as.I.impl.F.decl: %X.as.I.impl.F.type = fn_decl @X.as.I.impl.F [concrete = constants.%X.as.I.impl.F] {
  253. // CHECK:STDOUT: %self.patt: %pattern_type.019 = binding_pattern self [concrete]
  254. // CHECK:STDOUT: %self.param_patt: %pattern_type.019 = value_param_pattern %self.patt, call_param0 [concrete]
  255. // CHECK:STDOUT: } {
  256. // CHECK:STDOUT: %self.param: %X = value_param call_param0
  257. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @X.as.I.impl.%X.ref [concrete = constants.%X]
  258. // CHECK:STDOUT: %self: %X = bind_name self, %self.param
  259. // CHECK:STDOUT: }
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: !members:
  262. // CHECK:STDOUT: .F = %X.as.I.impl.F.decl
  263. // CHECK:STDOUT: witness = file.%I.impl_witness
  264. // CHECK:STDOUT: }
  265. // CHECK:STDOUT:
  266. // CHECK:STDOUT: class @InInterfaceArgs {
  267. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  268. // CHECK:STDOUT: complete_type_witness = %complete_type
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: !members:
  271. // CHECK:STDOUT: .Self = constants.%InInterfaceArgs
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: class @X [from "types.carbon"] {
  275. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f2
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: !members:
  278. // CHECK:STDOUT: .Self = imports.%Main.import_ref.acf
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] {
  282. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  283. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  284. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  285. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  286. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.4be)]
  287. // CHECK:STDOUT:
  288. // CHECK:STDOUT: fn;
  289. // CHECK:STDOUT: }
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: fn @X.as.I.impl.F(%self.param: %X) {
  292. // CHECK:STDOUT: !entry:
  293. // CHECK:STDOUT: return
  294. // CHECK:STDOUT: }
  295. // CHECK:STDOUT:
  296. // CHECK:STDOUT: specific @I(constants.%T) {
  297. // CHECK:STDOUT: %T => constants.%T
  298. // CHECK:STDOUT: }
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self.209) {
  301. // CHECK:STDOUT: %T => constants.%T
  302. // CHECK:STDOUT: %I.type => constants.%I.type.325
  303. // CHECK:STDOUT: %Self => constants.%Self.209
  304. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  305. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4be
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) {
  309. // CHECK:STDOUT: %T => constants.%InInterfaceArgs
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: !definition:
  312. // CHECK:STDOUT: %I.type => constants.%I.type.e45
  313. // CHECK:STDOUT: %Self => constants.%Self.061
  314. // CHECK:STDOUT: %I.F.type => constants.%I.F.type.14f
  315. // CHECK:STDOUT: %I.F => constants.%I.F.b81
  316. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.521
  317. // CHECK:STDOUT: %assoc0 => constants.%assoc0.676
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT:
  320. // CHECK:STDOUT: specific @I.F(constants.%InInterfaceArgs, constants.%I.facet) {
  321. // CHECK:STDOUT: %T => constants.%InInterfaceArgs
  322. // CHECK:STDOUT: %I.type => constants.%I.type.e45
  323. // CHECK:STDOUT: %Self => constants.%I.facet
  324. // CHECK:STDOUT: %Self.as_type => constants.%X
  325. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.019
  326. // CHECK:STDOUT: }
  327. // CHECK:STDOUT:
  328. // CHECK:STDOUT: --- use_impl_in_interface_args.carbon
  329. // CHECK:STDOUT:
  330. // CHECK:STDOUT: constants {
  331. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  332. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  333. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  334. // CHECK:STDOUT: %pattern_type.019: type = pattern_type %X [concrete]
  335. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  336. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  337. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  338. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  339. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  340. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  341. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  342. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  343. // CHECK:STDOUT: %I.F.type.2ae: type = fn_type @I.F, @I(%T) [symbolic]
  344. // CHECK:STDOUT: %I.F.bb2: %I.F.type.2ae = struct_value () [symbolic]
  345. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.209 [symbolic]
  346. // CHECK:STDOUT: %pattern_type.4be: type = pattern_type %Self.as_type [symbolic]
  347. // CHECK:STDOUT: %I.assoc_type.1e5: type = assoc_entity_type @I, @I(%T) [symbolic]
  348. // CHECK:STDOUT: %assoc0.429: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic]
  349. // CHECK:STDOUT: %InInterfaceArgs: type = class_type @InInterfaceArgs [concrete]
  350. // CHECK:STDOUT: %I.type.e45: type = facet_type <@I, @I(%InInterfaceArgs)> [concrete]
  351. // CHECK:STDOUT: %Self.061: %I.type.e45 = bind_symbolic_name Self, 1 [symbolic]
  352. // CHECK:STDOUT: %I.F.type.14f: type = fn_type @I.F, @I(%InInterfaceArgs) [concrete]
  353. // CHECK:STDOUT: %I.F.b81: %I.F.type.14f = struct_value () [concrete]
  354. // CHECK:STDOUT: %I.assoc_type.521: type = assoc_entity_type @I, @I(%InInterfaceArgs) [concrete]
  355. // CHECK:STDOUT: %assoc0.63d: %I.assoc_type.521 = assoc_entity element0, imports.%Main.import_ref.e54 [concrete]
  356. // CHECK:STDOUT: %assoc0.688: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic]
  357. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table [concrete]
  358. // CHECK:STDOUT: %I.facet: %I.type.e45 = facet_value %X, (%I.impl_witness) [concrete]
  359. // CHECK:STDOUT: %.658: type = fn_type_with_self_type %I.F.type.14f, %I.facet [concrete]
  360. // CHECK:STDOUT: %X.as.I.impl.F.type: type = fn_type @X.as.I.impl.F [concrete]
  361. // CHECK:STDOUT: %X.as.I.impl.F: %X.as.I.impl.F.type = struct_value () [concrete]
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: imports {
  365. // CHECK:STDOUT: %Main.I: %I.type.dac = import_ref Main//types, I, loaded [concrete = constants.%I.generic]
  366. // CHECK:STDOUT: %Main.C = import_ref Main//types, C, unloaded
  367. // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X]
  368. // CHECK:STDOUT: %Main.InInterfaceArgs: type = import_ref Main//impl_in_interface_args, InInterfaceArgs, loaded [concrete = constants.%InInterfaceArgs]
  369. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type]
  370. // CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst69 [no loc], unloaded
  371. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  372. // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst27 [no loc], unloaded
  373. // CHECK:STDOUT: %Main.import_ref.474: @I.%I.assoc_type (%I.assoc_type.1e5) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.688)]
  374. // CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded
  375. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  376. // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst27 [no loc], loaded [symbolic = @I.%Self (constants.%Self.209)]
  377. // CHECK:STDOUT: %Main.import_ref.e54: @I.%I.F.type (%I.F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%I.F (constants.%I.F.bb2)]
  378. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//impl_in_interface_args, loc5_24, loaded [concrete = constants.%complete_type]
  379. // CHECK:STDOUT: %Main.import_ref.bf8 = import_ref Main//impl_in_interface_args, inst20 [no loc], unloaded
  380. // CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded
  381. // CHECK:STDOUT: %Main.import_ref.e08: <witness> = import_ref Main//impl_in_interface_args, loc7_30, loaded [concrete = constants.%I.impl_witness]
  382. // CHECK:STDOUT: %Main.import_ref.956: type = import_ref Main//impl_in_interface_args, loc7_6, loaded [concrete = constants.%X]
  383. // CHECK:STDOUT: %Main.import_ref.e8c: type = import_ref Main//impl_in_interface_args, loc7_28, loaded [concrete = constants.%I.type.e45]
  384. // CHECK:STDOUT: %Main.import_ref.7f5: %X.as.I.impl.F.type = import_ref Main//impl_in_interface_args, loc7_51, loaded [concrete = constants.%X.as.I.impl.F]
  385. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.7f5), @X.as.I.impl [concrete]
  386. // CHECK:STDOUT: }
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: file {
  389. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  390. // CHECK:STDOUT: .I = imports.%Main.I
  391. // CHECK:STDOUT: .C = imports.%Main.C
  392. // CHECK:STDOUT: .X = imports.%Main.X
  393. // CHECK:STDOUT: .InInterfaceArgs = imports.%Main.InInterfaceArgs
  394. // CHECK:STDOUT: .G = %G.decl
  395. // CHECK:STDOUT: }
  396. // CHECK:STDOUT: %default.import = import <none>
  397. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  398. // CHECK:STDOUT: %x.patt: %pattern_type.019 = binding_pattern x [concrete]
  399. // CHECK:STDOUT: %x.param_patt: %pattern_type.019 = value_param_pattern %x.patt, call_param0 [concrete]
  400. // CHECK:STDOUT: } {
  401. // CHECK:STDOUT: %x.param: %X = value_param call_param0
  402. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Main.X [concrete = constants.%X]
  403. // CHECK:STDOUT: %x: %X = bind_name x, %x.param
  404. // CHECK:STDOUT: }
  405. // CHECK:STDOUT: }
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.5ab3ec.1: type) [from "types.carbon"] {
  408. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: !definition:
  411. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  412. // CHECK:STDOUT: %Self: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  413. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T) [symbolic = %I.F.type (constants.%I.F.type.2ae)]
  414. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type.2ae) = struct_value () [symbolic = %I.F (constants.%I.F.bb2)]
  415. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T) [symbolic = %I.assoc_type (constants.%I.assoc_type.1e5)]
  416. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.1e5) = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic = %assoc0 (constants.%assoc0.429)]
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: interface {
  419. // CHECK:STDOUT: !members:
  420. // CHECK:STDOUT: .Self = imports.%Main.import_ref.884
  421. // CHECK:STDOUT: .F = imports.%Main.import_ref.474
  422. // CHECK:STDOUT: witness = (imports.%Main.F)
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: impl @X.as.I.impl: imports.%Main.import_ref.956 as imports.%Main.import_ref.e8c [from "impl_in_interface_args.carbon"] {
  427. // CHECK:STDOUT: !members:
  428. // CHECK:STDOUT: witness = imports.%Main.import_ref.e08
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: class @X [from "types.carbon"] {
  432. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  433. // CHECK:STDOUT:
  434. // CHECK:STDOUT: !members:
  435. // CHECK:STDOUT: .Self = imports.%Main.import_ref.acf
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: class @InInterfaceArgs [from "impl_in_interface_args.carbon"] {
  439. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: !members:
  442. // CHECK:STDOUT: .Self = imports.%Main.import_ref.bf8
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: fn @G(%x.param: %X) {
  446. // CHECK:STDOUT: !entry:
  447. // CHECK:STDOUT: %x.ref: %X = name_ref x, %x
  448. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  449. // CHECK:STDOUT: %InInterfaceArgs.ref: type = name_ref InInterfaceArgs, imports.%Main.InInterfaceArgs [concrete = constants.%InInterfaceArgs]
  450. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%InInterfaceArgs)> [concrete = constants.%I.type.e45]
  451. // CHECK:STDOUT: %.loc6: %I.assoc_type.521 = specific_constant imports.%Main.import_ref.474, @I(constants.%InInterfaceArgs) [concrete = constants.%assoc0.63d]
  452. // CHECK:STDOUT: %F.ref: %I.assoc_type.521 = name_ref F, %.loc6 [concrete = constants.%assoc0.63d]
  453. // CHECK:STDOUT: %impl.elem0: %.658 = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%X.as.I.impl.F]
  454. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %x.ref, %impl.elem0
  455. // CHECK:STDOUT: %X.as.I.impl.F.call: init %empty_tuple.type = call %bound_method(%x.ref)
  456. // CHECK:STDOUT: return
  457. // CHECK:STDOUT: }
  458. // CHECK:STDOUT:
  459. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.5ab3ec.2: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] {
  460. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  461. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  462. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  463. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  464. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.4be)]
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: fn;
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: fn @X.as.I.impl.F [from "impl_in_interface_args.carbon"];
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: specific @I(constants.%T) {
  472. // CHECK:STDOUT: %T => constants.%T
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self.209) {
  476. // CHECK:STDOUT: %T => constants.%T
  477. // CHECK:STDOUT: %I.type => constants.%I.type.325
  478. // CHECK:STDOUT: %Self => constants.%Self.209
  479. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  480. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4be
  481. // CHECK:STDOUT: }
  482. // CHECK:STDOUT:
  483. // CHECK:STDOUT: specific @I(constants.%InInterfaceArgs) {
  484. // CHECK:STDOUT: %T => constants.%InInterfaceArgs
  485. // CHECK:STDOUT:
  486. // CHECK:STDOUT: !definition:
  487. // CHECK:STDOUT: %I.type => constants.%I.type.e45
  488. // CHECK:STDOUT: %Self => constants.%Self.061
  489. // CHECK:STDOUT: %I.F.type => constants.%I.F.type.14f
  490. // CHECK:STDOUT: %I.F => constants.%I.F.b81
  491. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.521
  492. // CHECK:STDOUT: %assoc0 => constants.%assoc0.63d
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: --- impl_in_class_args.carbon
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: constants {
  498. // CHECK:STDOUT: %InClassArgs: type = class_type @InClassArgs [concrete]
  499. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  500. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  501. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  502. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  503. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  504. // CHECK:STDOUT: %C.23b: type = class_type @C, @C(%InClassArgs) [concrete]
  505. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  506. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  507. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  508. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  509. // CHECK:STDOUT: %I.F.type.2ae: type = fn_type @I.F, @I(%T) [symbolic]
  510. // CHECK:STDOUT: %I.F.bb2: %I.F.type.2ae = struct_value () [symbolic]
  511. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.209 [symbolic]
  512. // CHECK:STDOUT: %pattern_type.4be: type = pattern_type %Self.as_type [symbolic]
  513. // CHECK:STDOUT: %I.assoc_type.1e5: type = assoc_entity_type @I, @I(%T) [symbolic]
  514. // CHECK:STDOUT: %assoc0.688: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic]
  515. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  516. // CHECK:STDOUT: %I.type.45c: type = facet_type <@I, @I(%X)> [concrete]
  517. // CHECK:STDOUT: %Self.a34: %I.type.45c = bind_symbolic_name Self, 1 [symbolic]
  518. // CHECK:STDOUT: %I.F.type.56a: type = fn_type @I.F, @I(%X) [concrete]
  519. // CHECK:STDOUT: %I.F.a79: %I.F.type.56a = struct_value () [concrete]
  520. // CHECK:STDOUT: %I.assoc_type.2db: type = assoc_entity_type @I, @I(%X) [concrete]
  521. // CHECK:STDOUT: %assoc0.8c1: %I.assoc_type.2db = assoc_entity element0, imports.%Main.import_ref.479 [concrete]
  522. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness file.%I.impl_witness_table [concrete]
  523. // CHECK:STDOUT: %pattern_type.e06: type = pattern_type %C.23b [concrete]
  524. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  525. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  526. // CHECK:STDOUT: %I.facet: %I.type.45c = facet_value %C.23b, (%I.impl_witness) [concrete]
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: imports {
  530. // CHECK:STDOUT: %Main.I: %I.type.dac = import_ref Main//types, I, loaded [concrete = constants.%I.generic]
  531. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//types, C, loaded [concrete = constants.%C.generic]
  532. // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X]
  533. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//types, loc5_9, loaded [symbolic = @C.%T (constants.%T)]
  534. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//types, loc5_20, loaded [concrete = constants.%complete_type]
  535. // CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst64 [no loc], unloaded
  536. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  537. // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst27 [no loc], unloaded
  538. // CHECK:STDOUT: %Main.import_ref.2bb = import_ref Main//types, loc4_43, unloaded
  539. // CHECK:STDOUT: %Main.F: @I.%I.F.type (%I.F.type.2ae) = import_ref Main//types, F, loaded [symbolic = @I.%I.F (constants.%I.F.bb2)]
  540. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  541. // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst27 [no loc], loaded [symbolic = @I.%Self (constants.%Self.209)]
  542. // CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded
  543. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type]
  544. // CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst69 [no loc], unloaded
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: file {
  548. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  549. // CHECK:STDOUT: .I = imports.%Main.I
  550. // CHECK:STDOUT: .C = imports.%Main.C
  551. // CHECK:STDOUT: .X = imports.%Main.X
  552. // CHECK:STDOUT: .InClassArgs = %InClassArgs.decl
  553. // CHECK:STDOUT: }
  554. // CHECK:STDOUT: %default.import = import <none>
  555. // CHECK:STDOUT: %InClassArgs.decl: type = class_decl @InClassArgs [concrete = constants.%InClassArgs] {} {}
  556. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  557. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  558. // CHECK:STDOUT: %InClassArgs.ref: type = name_ref InClassArgs, file.%InClassArgs.decl [concrete = constants.%InClassArgs]
  559. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%InClassArgs) [concrete = constants.%C.23b]
  560. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  561. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Main.X [concrete = constants.%X]
  562. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%X)> [concrete = constants.%I.type.45c]
  563. // CHECK:STDOUT: }
  564. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (@C.as.I.impl.%C.as.I.impl.F.decl), @C.as.I.impl [concrete]
  565. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  566. // CHECK:STDOUT: }
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.5ab3ec.2: type) [from "types.carbon"] {
  569. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: !definition:
  572. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  573. // CHECK:STDOUT: %Self: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  574. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T) [symbolic = %I.F.type (constants.%I.F.type.2ae)]
  575. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type.2ae) = struct_value () [symbolic = %I.F (constants.%I.F.bb2)]
  576. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T) [symbolic = %I.assoc_type (constants.%I.assoc_type.1e5)]
  577. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.1e5) = assoc_entity element0, imports.%Main.import_ref.479 [symbolic = %assoc0 (constants.%assoc0.688)]
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: interface {
  580. // CHECK:STDOUT: !members:
  581. // CHECK:STDOUT: .Self = imports.%Main.import_ref.884
  582. // CHECK:STDOUT: .F = imports.%Main.import_ref.2bb
  583. // CHECK:STDOUT: witness = (imports.%Main.F)
  584. // CHECK:STDOUT: }
  585. // CHECK:STDOUT: }
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: impl @C.as.I.impl: %C as %I.type {
  588. // CHECK:STDOUT: %C.as.I.impl.F.decl: %C.as.I.impl.F.type = fn_decl @C.as.I.impl.F [concrete = constants.%C.as.I.impl.F] {
  589. // CHECK:STDOUT: %self.patt: %pattern_type.e06 = binding_pattern self [concrete]
  590. // CHECK:STDOUT: %self.param_patt: %pattern_type.e06 = value_param_pattern %self.patt, call_param0 [concrete]
  591. // CHECK:STDOUT: } {
  592. // CHECK:STDOUT: %self.param: %C.23b = value_param call_param0
  593. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.I.impl.%C [concrete = constants.%C.23b]
  594. // CHECK:STDOUT: %self: %C.23b = bind_name self, %self.param
  595. // CHECK:STDOUT: }
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: !members:
  598. // CHECK:STDOUT: .F = %C.as.I.impl.F.decl
  599. // CHECK:STDOUT: witness = file.%I.impl_witness
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT:
  602. // CHECK:STDOUT: class @InClassArgs {
  603. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  604. // CHECK:STDOUT: complete_type_witness = %complete_type
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: !members:
  607. // CHECK:STDOUT: .Self = constants.%InClassArgs
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: generic class @C(imports.%Main.import_ref.5ab3ec.1: type) [from "types.carbon"] {
  611. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: !definition:
  614. // CHECK:STDOUT:
  615. // CHECK:STDOUT: class {
  616. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: !members:
  619. // CHECK:STDOUT: .Self = imports.%Main.import_ref.4c0
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT: }
  622. // CHECK:STDOUT:
  623. // CHECK:STDOUT: class @X [from "types.carbon"] {
  624. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  625. // CHECK:STDOUT:
  626. // CHECK:STDOUT: !members:
  627. // CHECK:STDOUT: .Self = imports.%Main.import_ref.acf
  628. // CHECK:STDOUT: }
  629. // CHECK:STDOUT:
  630. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] {
  631. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  632. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  633. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  634. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  635. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.4be)]
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: fn;
  638. // CHECK:STDOUT: }
  639. // CHECK:STDOUT:
  640. // CHECK:STDOUT: fn @C.as.I.impl.F(%self.param: %C.23b) {
  641. // CHECK:STDOUT: !entry:
  642. // CHECK:STDOUT: return
  643. // CHECK:STDOUT: }
  644. // CHECK:STDOUT:
  645. // CHECK:STDOUT: specific @C(constants.%T) {
  646. // CHECK:STDOUT: %T => constants.%T
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: specific @C(constants.%InClassArgs) {
  650. // CHECK:STDOUT: %T => constants.%InClassArgs
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: !definition:
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: specific @I(constants.%T) {
  656. // CHECK:STDOUT: %T => constants.%T
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self.209) {
  660. // CHECK:STDOUT: %T => constants.%T
  661. // CHECK:STDOUT: %I.type => constants.%I.type.325
  662. // CHECK:STDOUT: %Self => constants.%Self.209
  663. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  664. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4be
  665. // CHECK:STDOUT: }
  666. // CHECK:STDOUT:
  667. // CHECK:STDOUT: specific @I(constants.%X) {
  668. // CHECK:STDOUT: %T => constants.%X
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: !definition:
  671. // CHECK:STDOUT: %I.type => constants.%I.type.45c
  672. // CHECK:STDOUT: %Self => constants.%Self.a34
  673. // CHECK:STDOUT: %I.F.type => constants.%I.F.type.56a
  674. // CHECK:STDOUT: %I.F => constants.%I.F.a79
  675. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.2db
  676. // CHECK:STDOUT: %assoc0 => constants.%assoc0.8c1
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: specific @I.F(constants.%X, constants.%I.facet) {
  680. // CHECK:STDOUT: %T => constants.%X
  681. // CHECK:STDOUT: %I.type => constants.%I.type.45c
  682. // CHECK:STDOUT: %Self => constants.%I.facet
  683. // CHECK:STDOUT: %Self.as_type => constants.%C.23b
  684. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.e06
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: --- use_impl_in_class_args.carbon
  688. // CHECK:STDOUT:
  689. // CHECK:STDOUT: constants {
  690. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  691. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  692. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  693. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  694. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  695. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic]
  696. // CHECK:STDOUT: %InClassArgs: type = class_type @InClassArgs [concrete]
  697. // CHECK:STDOUT: %C.23b: type = class_type @C, @C(%InClassArgs) [concrete]
  698. // CHECK:STDOUT: %pattern_type.e06: type = pattern_type %C.23b [concrete]
  699. // CHECK:STDOUT: %H.type: type = fn_type @H [concrete]
  700. // CHECK:STDOUT: %H: %H.type = struct_value () [concrete]
  701. // CHECK:STDOUT: %I.type.dac: type = generic_interface_type @I [concrete]
  702. // CHECK:STDOUT: %I.generic: %I.type.dac = struct_value () [concrete]
  703. // CHECK:STDOUT: %I.type.325: type = facet_type <@I, @I(%T)> [symbolic]
  704. // CHECK:STDOUT: %Self.209: %I.type.325 = bind_symbolic_name Self, 1 [symbolic]
  705. // CHECK:STDOUT: %I.F.type.2ae: type = fn_type @I.F, @I(%T) [symbolic]
  706. // CHECK:STDOUT: %I.F.bb2: %I.F.type.2ae = struct_value () [symbolic]
  707. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.209 [symbolic]
  708. // CHECK:STDOUT: %pattern_type.4be: type = pattern_type %Self.as_type [symbolic]
  709. // CHECK:STDOUT: %I.assoc_type.1e5: type = assoc_entity_type @I, @I(%T) [symbolic]
  710. // CHECK:STDOUT: %assoc0.429: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic]
  711. // CHECK:STDOUT: %X: type = class_type @X [concrete]
  712. // CHECK:STDOUT: %I.type.45c: type = facet_type <@I, @I(%X)> [concrete]
  713. // CHECK:STDOUT: %Self.a34: %I.type.45c = bind_symbolic_name Self, 1 [symbolic]
  714. // CHECK:STDOUT: %I.F.type.56a: type = fn_type @I.F, @I(%X) [concrete]
  715. // CHECK:STDOUT: %I.F.a79: %I.F.type.56a = struct_value () [concrete]
  716. // CHECK:STDOUT: %I.assoc_type.2db: type = assoc_entity_type @I, @I(%X) [concrete]
  717. // CHECK:STDOUT: %assoc0.071: %I.assoc_type.2db = assoc_entity element0, imports.%Main.import_ref.e54 [concrete]
  718. // CHECK:STDOUT: %assoc0.688: %I.assoc_type.1e5 = assoc_entity element0, imports.%Main.import_ref.479 [symbolic]
  719. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness imports.%I.impl_witness_table [concrete]
  720. // CHECK:STDOUT: %I.facet: %I.type.45c = facet_value %C.23b, (%I.impl_witness) [concrete]
  721. // CHECK:STDOUT: %.d3f: type = fn_type_with_self_type %I.F.type.56a, %I.facet [concrete]
  722. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  723. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: imports {
  727. // CHECK:STDOUT: %Main.I: %I.type.dac = import_ref Main//types, I, loaded [concrete = constants.%I.generic]
  728. // CHECK:STDOUT: %Main.C: %C.type = import_ref Main//types, C, loaded [concrete = constants.%C.generic]
  729. // CHECK:STDOUT: %Main.X: type = import_ref Main//types, X, loaded [concrete = constants.%X]
  730. // CHECK:STDOUT: %Main.InClassArgs: type = import_ref Main//impl_in_class_args, InClassArgs, loaded [concrete = constants.%InClassArgs]
  731. // CHECK:STDOUT: %Main.import_ref.5ab3ec.1: type = import_ref Main//types, loc5_9, loaded [symbolic = @C.%T (constants.%T)]
  732. // CHECK:STDOUT: %Main.import_ref.8f24d3.1: <witness> = import_ref Main//types, loc5_20, loaded [concrete = constants.%complete_type]
  733. // CHECK:STDOUT: %Main.import_ref.4c0 = import_ref Main//types, inst64 [no loc], unloaded
  734. // CHECK:STDOUT: %Main.import_ref.8f24d3.2: <witness> = import_ref Main//impl_in_class_args, loc5_20, loaded [concrete = constants.%complete_type]
  735. // CHECK:STDOUT: %Main.import_ref.683 = import_ref Main//impl_in_class_args, inst20 [no loc], unloaded
  736. // CHECK:STDOUT: %Main.import_ref.5ab3ec.2: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  737. // CHECK:STDOUT: %Main.import_ref.884 = import_ref Main//types, inst27 [no loc], unloaded
  738. // CHECK:STDOUT: %Main.import_ref.474: @I.%I.assoc_type (%I.assoc_type.1e5) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%assoc0 (constants.%assoc0.688)]
  739. // CHECK:STDOUT: %Main.F = import_ref Main//types, F, unloaded
  740. // CHECK:STDOUT: %Main.import_ref.5ab3ec.3: type = import_ref Main//types, loc4_13, loaded [symbolic = @I.%T (constants.%T)]
  741. // CHECK:STDOUT: %Main.import_ref.38e: @I.%I.type (%I.type.325) = import_ref Main//types, inst27 [no loc], loaded [symbolic = @I.%Self (constants.%Self.209)]
  742. // CHECK:STDOUT: %Main.import_ref.e54: @I.%I.F.type (%I.F.type.2ae) = import_ref Main//types, loc4_43, loaded [symbolic = @I.%I.F (constants.%I.F.bb2)]
  743. // CHECK:STDOUT: %Main.import_ref.8f24d3.3: <witness> = import_ref Main//types, loc7_10, loaded [concrete = constants.%complete_type]
  744. // CHECK:STDOUT: %Main.import_ref.acf = import_ref Main//types, inst69 [no loc], unloaded
  745. // CHECK:STDOUT: %Main.import_ref.479 = import_ref Main//types, loc4_43, unloaded
  746. // CHECK:STDOUT: %Main.import_ref.a72: <witness> = import_ref Main//impl_in_class_args, loc7_29, loaded [concrete = constants.%I.impl_witness]
  747. // CHECK:STDOUT: %Main.import_ref.d6e: type = import_ref Main//impl_in_class_args, loc7_19, loaded [concrete = constants.%C.23b]
  748. // CHECK:STDOUT: %Main.import_ref.208: type = import_ref Main//impl_in_class_args, loc7_27, loaded [concrete = constants.%I.type.45c]
  749. // CHECK:STDOUT: %Main.import_ref.ae4: %C.as.I.impl.F.type = import_ref Main//impl_in_class_args, loc7_50, loaded [concrete = constants.%C.as.I.impl.F]
  750. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (%Main.import_ref.ae4), @C.as.I.impl [concrete]
  751. // CHECK:STDOUT: }
  752. // CHECK:STDOUT:
  753. // CHECK:STDOUT: file {
  754. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  755. // CHECK:STDOUT: .I = imports.%Main.I
  756. // CHECK:STDOUT: .C = imports.%Main.C
  757. // CHECK:STDOUT: .X = imports.%Main.X
  758. // CHECK:STDOUT: .InClassArgs = imports.%Main.InClassArgs
  759. // CHECK:STDOUT: .H = %H.decl
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT: %default.import = import <none>
  762. // CHECK:STDOUT: %H.decl: %H.type = fn_decl @H [concrete = constants.%H] {
  763. // CHECK:STDOUT: %c.patt: %pattern_type.e06 = binding_pattern c [concrete]
  764. // CHECK:STDOUT: %c.param_patt: %pattern_type.e06 = value_param_pattern %c.patt, call_param0 [concrete]
  765. // CHECK:STDOUT: } {
  766. // CHECK:STDOUT: %c.param: %C.23b = value_param call_param0
  767. // CHECK:STDOUT: %.loc6_22: type = splice_block %C [concrete = constants.%C.23b] {
  768. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, imports.%Main.C [concrete = constants.%C.generic]
  769. // CHECK:STDOUT: %InClassArgs.ref: type = name_ref InClassArgs, imports.%Main.InClassArgs [concrete = constants.%InClassArgs]
  770. // CHECK:STDOUT: %C: type = class_type @C, @C(constants.%InClassArgs) [concrete = constants.%C.23b]
  771. // CHECK:STDOUT: }
  772. // CHECK:STDOUT: %c: %C.23b = bind_name c, %c.param
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT: }
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: generic interface @I(imports.%Main.import_ref.5ab3ec.2: type) [from "types.carbon"] {
  777. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: !definition:
  780. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  781. // CHECK:STDOUT: %Self: @I.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  782. // CHECK:STDOUT: %I.F.type: type = fn_type @I.F, @I(%T) [symbolic = %I.F.type (constants.%I.F.type.2ae)]
  783. // CHECK:STDOUT: %I.F: @I.%I.F.type (%I.F.type.2ae) = struct_value () [symbolic = %I.F (constants.%I.F.bb2)]
  784. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I, @I(%T) [symbolic = %I.assoc_type (constants.%I.assoc_type.1e5)]
  785. // CHECK:STDOUT: %assoc0: @I.%I.assoc_type (%I.assoc_type.1e5) = assoc_entity element0, imports.%Main.import_ref.e54 [symbolic = %assoc0 (constants.%assoc0.429)]
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: interface {
  788. // CHECK:STDOUT: !members:
  789. // CHECK:STDOUT: .Self = imports.%Main.import_ref.884
  790. // CHECK:STDOUT: .F = imports.%Main.import_ref.474
  791. // CHECK:STDOUT: witness = (imports.%Main.F)
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT: }
  794. // CHECK:STDOUT:
  795. // CHECK:STDOUT: impl @C.as.I.impl: imports.%Main.import_ref.d6e as imports.%Main.import_ref.208 [from "impl_in_class_args.carbon"] {
  796. // CHECK:STDOUT: !members:
  797. // CHECK:STDOUT: witness = imports.%Main.import_ref.a72
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: generic class @C(imports.%Main.import_ref.5ab3ec.1: type) [from "types.carbon"] {
  801. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: !definition:
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: class {
  806. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.1
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: !members:
  809. // CHECK:STDOUT: .Self = imports.%Main.import_ref.4c0
  810. // CHECK:STDOUT: }
  811. // CHECK:STDOUT: }
  812. // CHECK:STDOUT:
  813. // CHECK:STDOUT: class @InClassArgs [from "impl_in_class_args.carbon"] {
  814. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.2
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: !members:
  817. // CHECK:STDOUT: .Self = imports.%Main.import_ref.683
  818. // CHECK:STDOUT: }
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: class @X [from "types.carbon"] {
  821. // CHECK:STDOUT: complete_type_witness = imports.%Main.import_ref.8f24d3.3
  822. // CHECK:STDOUT:
  823. // CHECK:STDOUT: !members:
  824. // CHECK:STDOUT: .Self = imports.%Main.import_ref.acf
  825. // CHECK:STDOUT: }
  826. // CHECK:STDOUT:
  827. // CHECK:STDOUT: fn @H(%c.param: %C.23b) {
  828. // CHECK:STDOUT: !entry:
  829. // CHECK:STDOUT: %c.ref: %C.23b = name_ref c, %c
  830. // CHECK:STDOUT: %I.ref: %I.type.dac = name_ref I, imports.%Main.I [concrete = constants.%I.generic]
  831. // CHECK:STDOUT: %X.ref: type = name_ref X, imports.%Main.X [concrete = constants.%X]
  832. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%X)> [concrete = constants.%I.type.45c]
  833. // CHECK:STDOUT: %.loc6_34: %I.assoc_type.2db = specific_constant imports.%Main.import_ref.474, @I(constants.%X) [concrete = constants.%assoc0.071]
  834. // CHECK:STDOUT: %F.ref: %I.assoc_type.2db = name_ref F, %.loc6_34 [concrete = constants.%assoc0.071]
  835. // CHECK:STDOUT: %impl.elem0: %.d3f = impl_witness_access constants.%I.impl_witness, element0 [concrete = constants.%C.as.I.impl.F]
  836. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %c.ref, %impl.elem0
  837. // CHECK:STDOUT: %C.as.I.impl.F.call: init %empty_tuple.type = call %bound_method(%c.ref)
  838. // CHECK:STDOUT: return
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: generic fn @I.F(imports.%Main.import_ref.5ab3ec.3: type, imports.%Main.import_ref.38e: @I.%I.type (%I.type.325)) [from "types.carbon"] {
  842. // CHECK:STDOUT: %T: type = bind_symbolic_name T, 0 [symbolic = %T (constants.%T)]
  843. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T)> [symbolic = %I.type (constants.%I.type.325)]
  844. // CHECK:STDOUT: %Self: @I.F.%I.type (%I.type.325) = bind_symbolic_name Self, 1 [symbolic = %Self (constants.%Self.209)]
  845. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self [symbolic = %Self.as_type (constants.%Self.as_type)]
  846. // CHECK:STDOUT: %pattern_type: type = pattern_type %Self.as_type [symbolic = %pattern_type (constants.%pattern_type.4be)]
  847. // CHECK:STDOUT:
  848. // CHECK:STDOUT: fn;
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: fn @C.as.I.impl.F [from "impl_in_class_args.carbon"];
  852. // CHECK:STDOUT:
  853. // CHECK:STDOUT: specific @C(constants.%T) {
  854. // CHECK:STDOUT: %T => constants.%T
  855. // CHECK:STDOUT: }
  856. // CHECK:STDOUT:
  857. // CHECK:STDOUT: specific @C(constants.%InClassArgs) {
  858. // CHECK:STDOUT: %T => constants.%InClassArgs
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: !definition:
  861. // CHECK:STDOUT: }
  862. // CHECK:STDOUT:
  863. // CHECK:STDOUT: specific @I(constants.%T) {
  864. // CHECK:STDOUT: %T => constants.%T
  865. // CHECK:STDOUT: }
  866. // CHECK:STDOUT:
  867. // CHECK:STDOUT: specific @I.F(constants.%T, constants.%Self.209) {
  868. // CHECK:STDOUT: %T => constants.%T
  869. // CHECK:STDOUT: %I.type => constants.%I.type.325
  870. // CHECK:STDOUT: %Self => constants.%Self.209
  871. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  872. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.4be
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: specific @I(constants.%X) {
  876. // CHECK:STDOUT: %T => constants.%X
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: !definition:
  879. // CHECK:STDOUT: %I.type => constants.%I.type.45c
  880. // CHECK:STDOUT: %Self => constants.%Self.a34
  881. // CHECK:STDOUT: %I.F.type => constants.%I.F.type.56a
  882. // CHECK:STDOUT: %I.F => constants.%I.F.a79
  883. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.2db
  884. // CHECK:STDOUT: %assoc0 => constants.%assoc0.071
  885. // CHECK:STDOUT: }
  886. // CHECK:STDOUT: