specific_args.carbon 55 KB

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