specific_args.carbon 54 KB

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