specific_args.carbon 57 KB

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