access.carbon 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919
  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/convert.carbon
  6. //
  7. // AUTOUPDATE
  8. // TIP: To test this file alone, run:
  9. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/facet/access.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/access.carbon
  12. // --- access_assoc_fn.carbon
  13. library "[[@TEST_NAME]]";
  14. interface I {
  15. fn DoIt();
  16. }
  17. fn Use(T:! I) {
  18. //@dump-sem-ir-begin
  19. T.DoIt();
  20. //@dump-sem-ir-end
  21. }
  22. // --- assoc_fn_using_self.carbon
  23. library "[[@TEST_NAME]]";
  24. interface I {
  25. fn Make() -> Self;
  26. }
  27. fn Use(T:! I) -> T {
  28. //@dump-sem-ir-begin
  29. return T.Make();
  30. //@dump-sem-ir-end
  31. }
  32. // --- access_assoc_method.carbon
  33. library "[[@TEST_NAME]]";
  34. interface I {
  35. fn Copy[self: Self]() -> Self;
  36. }
  37. //@dump-sem-ir-begin
  38. fn Use[T:! I](x: T) -> T {
  39. return x.Copy();
  40. }
  41. //@dump-sem-ir-end
  42. // --- access_selfless_method.carbon
  43. library "[[@TEST_NAME]]";
  44. interface I {
  45. fn Hello();
  46. }
  47. fn Use[T:! I](x: T){
  48. //@dump-sem-ir-begin
  49. x.Hello();
  50. //@dump-sem-ir-end
  51. }
  52. // --- access_assoc_method_indirect.carbon
  53. library "[[@TEST_NAME]]";
  54. interface I {
  55. fn Copy[self: Self]() -> Self;
  56. }
  57. fn UseIndirect[T:! I](x: T) -> T {
  58. //@dump-sem-ir-begin
  59. return x.(T.Copy)();
  60. //@dump-sem-ir-end
  61. }
  62. // --- convert_from_period_self_to_full_facet_value.carbon
  63. library "[[@TEST_NAME]]";
  64. interface I {
  65. let I1:! type;
  66. }
  67. fn F(U:! I where .I1 = .Self) {
  68. U as (I where .I1 = U);
  69. (U as type) as (I where .I1 = U);
  70. }
  71. // --- convert_to_period_self.carbon
  72. library "[[@TEST_NAME]]";
  73. interface I {
  74. let I1:! type;
  75. let I2:! type;
  76. }
  77. fn F(U:! I where .I1 = .Self and .I2 = ()) {
  78. U as (I where .I1 = .Self);
  79. (U as type) as (I where .I1 = .Self);
  80. }
  81. // --- access_through_call_once.carbon
  82. library "[[@TEST_NAME]]";
  83. // TODO: Merge this test with the one below once it works.
  84. interface I {
  85. let X:! type;
  86. fn G() -> X*;
  87. }
  88. fn F2[U:! I](unused V: U*) {}
  89. fn F(U:! I where .X = .Self, unused V: U) {
  90. // The returned value of `G` type `U` which has access to the methods of `I`.
  91. U.G()->G();
  92. (U as type).G()->G();
  93. // The returned value of type `U` can be used as a value of type `U`.
  94. F2(U.G());
  95. }
  96. // --- access_through_call.carbon
  97. library "[[@TEST_NAME]]";
  98. interface I {
  99. let X:! type;
  100. fn G() -> X*;
  101. }
  102. fn F2[U:! I](unused V: U*) {}
  103. fn F3[U:! I where .X = .Self](unused V: U*) {}
  104. fn F(U:! I where .X = .Self, unused V: U*) {
  105. // The returned value of `G` type `U` which has access to the methods of `I`.
  106. U.G()->G()->G();
  107. (U as type).G()->G()->G();
  108. // The returned value of type `U` can be used as a value of type `U`.
  109. F2(U.G()->G()->G());
  110. // The constraints in the type `U` are preserved.
  111. F3(U.G());
  112. F3(U.G()->G()->G());
  113. }
  114. // --- fail_compound_access_through_call.carbon
  115. library "[[@TEST_NAME]]";
  116. interface I {
  117. let X:! type;
  118. fn G() -> X;
  119. }
  120. fn F(U:! Core.Destroy & I where .X = .Self) {
  121. // Compound member lookup through a non-type value is possible for methods
  122. // which take a `self` parameter. But it's not possible for methods without
  123. // `self`. For those you need to go directly throug the type.
  124. // See: https://github.com/carbon-language/carbon-lang/issues/6025
  125. let u: U = U.(I.G)();
  126. // `u` is a non-type value. Can call methods with `self` through compound
  127. // member lookup, but can't call methods without `self`. See the
  128. // `compound_access_through_call_with_self_param.carbon` test for the former.
  129. //
  130. // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet]
  131. // CHECK:STDERR: u.(I.G)();
  132. // CHECK:STDERR: ^~~~~~~
  133. // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext]
  134. // CHECK:STDERR: u.(I.G)();
  135. // CHECK:STDERR: ^~~~~~~
  136. // CHECK:STDERR:
  137. u.(I.G)();
  138. // This is the same as the above, since G() returns a non-type value of type
  139. // `U`.
  140. //
  141. // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+7]]:3: error: cannot implicitly convert non-type value of type `U` into type implementing `I` [ConversionFailureNonTypeToFacet]
  142. // CHECK:STDERR: U.(I.G)().(I.G)();
  143. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  144. // CHECK:STDERR: fail_compound_access_through_call.carbon:[[@LINE+4]]:3: note: type `U` does not implement interface `Core.ImplicitAs(I)` [MissingImplInMemberAccessInContext]
  145. // CHECK:STDERR: U.(I.G)().(I.G)();
  146. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  147. // CHECK:STDERR:
  148. U.(I.G)().(I.G)();
  149. }
  150. // --- compound_access_through_call_with_self_param.carbon
  151. library "[[@TEST_NAME]]";
  152. interface I {
  153. let X:! type;
  154. fn G[self: Self]() -> X*;
  155. }
  156. fn F(U:! I where .X = .Self, v: U) {
  157. // Compound member lookup through a non-type value is possible for methods
  158. // which take a `self` parameter.
  159. let u: U* = v.(I.G)();
  160. // `u` is a non-type value. Can call methods with `self` through compound
  161. // member lookup, but can't call methods without `self`. See the
  162. // `compound_access_through_call.carbon` test for the latter.
  163. u->(I.G)();
  164. // This is the same as the above, since G() returns a non-type value of type
  165. // `U`. This works because G has a `self` parameter.
  166. v.(I.G)()->(I.G)();
  167. }
  168. // --- fail_non_const_associated.carbon
  169. library "[[@TEST_NAME]]";
  170. interface I { let T:! type; }
  171. fn Id[U:! type](x: U) -> U { return Id(x); }
  172. impl () as I where .T = () {}
  173. // Type of member expr is associated entity type,
  174. // but value is not constant.
  175. // CHECK:STDERR: fail_non_const_associated.carbon:[[@LINE+4]]:8: error: semantics TODO: `Non-constant associated entity value` [SemanticsTodo]
  176. // CHECK:STDERR: var v: ().(Id(I.T));
  177. // CHECK:STDERR: ^~~~~~~~~~~~
  178. // CHECK:STDERR:
  179. var v: ().(Id(I.T));
  180. // --- fail_non_const_associated_in_interface.carbon
  181. library "[[@TEST_NAME]]";
  182. fn Id[U:! type](x: U) -> U { return Id(x); }
  183. interface J {
  184. let T:! type;
  185. // CHECK:STDERR: fail_non_const_associated_in_interface.carbon:[[@LINE+4]]:13: error: cannot evaluate type expression [TypeExprEvaluationFailure]
  186. // CHECK:STDERR: fn F() -> Id(T);
  187. // CHECK:STDERR: ^~~~~
  188. // CHECK:STDERR:
  189. fn F() -> Id(T);
  190. }
  191. // --- fail_alias_to_non_const_assoc_entity.carbon
  192. library "[[@TEST_NAME]]";
  193. interface I {
  194. let T:! type;
  195. }
  196. // CHECK:STDERR: fail_alias_to_non_const_assoc_entity.carbon:[[@LINE+4]]:8: error: semantics TODO: `HandleAutoTypeLiteral` [SemanticsTodo]
  197. // CHECK:STDERR: let x: auto = I.T;
  198. // CHECK:STDERR: ^~~~
  199. // CHECK:STDERR:
  200. let x: auto = I.T;
  201. interface J {
  202. // Is this valid?
  203. alias U = x;
  204. // type of U is an assoc entity type, but value is not constant.
  205. fn F() -> U;
  206. }
  207. // --- to_import.carbon
  208. library "[[@TEST_NAME]]";
  209. interface I {
  210. let T:! type;
  211. }
  212. alias U = I.T;
  213. // --- fail_access_alias_in_imported_library.carbon
  214. library "[[@TEST_NAME]]";
  215. import library "to_import";
  216. interface J {
  217. // extend I;
  218. alias V = U;
  219. // CHECK:STDERR: fail_access_alias_in_imported_library.carbon:[[@LINE+4]]:13: error: cannot convert type `Self` that implements `J` into type implementing `I` [ConversionFailureFacetToFacet]
  220. // CHECK:STDERR: fn F() -> V;
  221. // CHECK:STDERR: ^
  222. // CHECK:STDERR:
  223. fn F() -> V;
  224. }
  225. // --- access_constant_in_self_facet.carbon
  226. library "[[@TEST_NAME]]";
  227. //@dump-sem-ir-begin
  228. interface A { let X:! type; }
  229. fn F(AA:! A where .X = ()) -> AA.X {
  230. return ();
  231. }
  232. //@dump-sem-ir-end
  233. // --- access_constant_in_self_facet_with_multiple_interfaces.carbon
  234. library "[[@TEST_NAME]]";
  235. interface A { let X:! type; }
  236. interface B { let Y:! type; }
  237. // The rewrite rules of .X and .Y come in some canonically sorted order. The
  238. // ImplWitnessAccess instruction looks at them to try find a value for the
  239. // rewrite in the conversion target. We use different orderings to more reliably
  240. // create the scenario where the ImplWitnessAccess sees a rewrite of a value in
  241. // an interface other than the one it is accessing before finding the correct
  242. // rewrite.
  243. //@dump-sem-ir-begin
  244. fn F(AB:! A & B where .X = () and .Y = {}) -> AB.X {
  245. return ();
  246. }
  247. fn G(AB:! A & B where .X = () and .Y = {}) -> AB.Y {
  248. return {};
  249. }
  250. //@dump-sem-ir-end
  251. // --- symbolic_binding_type_of_impl_witness_access.carbon
  252. interface Y {}
  253. impl () as Y {}
  254. interface Z {
  255. let Y1:! Y;
  256. fn G() -> Y1*;
  257. }
  258. // The type of `T` matches exactly the type of `Z.Y1`, which prevents the
  259. // specific in the call from F2 from deducing a `FacetValue`. Instead it just
  260. // passes in the `ImplWitnessAccess` instruction as is.
  261. //
  262. // The `t: T` creates a `T as type`, or a `SymbolicBindingType` that gets
  263. // evaluated against the specific. The facet value that it evaluates against is
  264. // the `ImplWitnessAccess` from the call in F2.
  265. //
  266. // This requires that `SymbolicBindingType` evaluation correctly handles
  267. // arbitrary facet value instructions. Not just the common case of `FacetValue`
  268. // or `SymbolicBinding`.
  269. fn F1(T:! Y, unused t: T*) {}
  270. fn F2(U:! Z) {
  271. F1(U.Y1, U.G());
  272. }
  273. // CHECK:STDOUT: --- access_assoc_fn.carbon
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: constants {
  276. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  277. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  278. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  279. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.DoIt.decl [concrete]
  280. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  281. // CHECK:STDOUT: %I.WithSelf.DoIt.type.66b: type = fn_type @I.WithSelf.DoIt, @I.WithSelf(%T) [symbolic]
  282. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  283. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  284. // CHECK:STDOUT: %.f37: type = fn_type_with_self_type %I.WithSelf.DoIt.type.66b, %T [symbolic]
  285. // CHECK:STDOUT: %impl.elem0: %.f37 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  286. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.DoIt(%T) [symbolic]
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  290. // CHECK:STDOUT: <elided>
  291. // CHECK:STDOUT:
  292. // CHECK:STDOUT: !definition:
  293. // CHECK:STDOUT: %T.as_type.loc10_4.2: type = facet_access_type %T.loc8_9.1 [symbolic = %T.as_type.loc10_4.2 (constants.%T.as_type)]
  294. // CHECK:STDOUT: %I.WithSelf.DoIt.type: type = fn_type @I.WithSelf.DoIt, @I.WithSelf(%T.loc8_9.1) [symbolic = %I.WithSelf.DoIt.type (constants.%I.WithSelf.DoIt.type.66b)]
  295. // CHECK:STDOUT: %.loc10_4.2: type = fn_type_with_self_type %I.WithSelf.DoIt.type, %T.loc8_9.1 [symbolic = %.loc10_4.2 (constants.%.f37)]
  296. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc8_9.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  297. // CHECK:STDOUT: %impl.elem0.loc10_4.2: @Use.%.loc10_4.2 (%.f37) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0)]
  298. // CHECK:STDOUT: %specific_impl_fn.loc10_4.2: <specific function> = specific_impl_function %impl.elem0.loc10_4.2, @I.WithSelf.DoIt(%T.loc8_9.1) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn)]
  299. // CHECK:STDOUT:
  300. // CHECK:STDOUT: fn() {
  301. // CHECK:STDOUT: !entry:
  302. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc8_9.2 [symbolic = %T.loc8_9.1 (constants.%T)]
  303. // CHECK:STDOUT: %T.as_type.loc10_4.1: type = facet_access_type %T.ref [symbolic = %T.as_type.loc10_4.2 (constants.%T.as_type)]
  304. // CHECK:STDOUT: %.loc10_4.1: type = converted %T.ref, %T.as_type.loc10_4.1 [symbolic = %T.as_type.loc10_4.2 (constants.%T.as_type)]
  305. // CHECK:STDOUT: %DoIt.ref: %I.assoc_type = name_ref DoIt, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  306. // CHECK:STDOUT: %impl.elem0.loc10_4.1: @Use.%.loc10_4.2 (%.f37) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0)]
  307. // CHECK:STDOUT: %specific_impl_fn.loc10_4.1: <specific function> = specific_impl_function %impl.elem0.loc10_4.1, @I.WithSelf.DoIt(constants.%T) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn)]
  308. // CHECK:STDOUT: %I.WithSelf.DoIt.call: init %empty_tuple.type = call %specific_impl_fn.loc10_4.1()
  309. // CHECK:STDOUT: <elided>
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT: }
  312. // CHECK:STDOUT:
  313. // CHECK:STDOUT: specific @Use(constants.%T) {
  314. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  315. // CHECK:STDOUT: }
  316. // CHECK:STDOUT:
  317. // CHECK:STDOUT: --- assoc_fn_using_self.carbon
  318. // CHECK:STDOUT:
  319. // CHECK:STDOUT: constants {
  320. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  321. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  322. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Make.decl [concrete]
  323. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  324. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  325. // CHECK:STDOUT: %.ae9: Core.Form = init_form %T.as_type [symbolic]
  326. // CHECK:STDOUT: %pattern_type.f4e: type = pattern_type %T.as_type [symbolic]
  327. // CHECK:STDOUT: %I.WithSelf.Make.type.f20: type = fn_type @I.WithSelf.Make, @I.WithSelf(%T) [symbolic]
  328. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  329. // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %I.WithSelf.Make.type.f20, %T [symbolic]
  330. // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  331. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Make(%T) [symbolic]
  332. // CHECK:STDOUT: }
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  335. // CHECK:STDOUT: <elided>
  336. // CHECK:STDOUT:
  337. // CHECK:STDOUT: !definition:
  338. // CHECK:STDOUT: <elided>
  339. // CHECK:STDOUT: %I.WithSelf.Make.type: type = fn_type @I.WithSelf.Make, @I.WithSelf(%T.loc8_9.1) [symbolic = %I.WithSelf.Make.type (constants.%I.WithSelf.Make.type.f20)]
  340. // CHECK:STDOUT: %.loc10_11.2: type = fn_type_with_self_type %I.WithSelf.Make.type, %T.loc8_9.1 [symbolic = %.loc10_11.2 (constants.%.8e2)]
  341. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc8_9.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  342. // CHECK:STDOUT: %impl.elem0.loc10_11.2: @Use.%.loc10_11.2 (%.8e2) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_11.2 (constants.%impl.elem0)]
  343. // CHECK:STDOUT: %specific_impl_fn.loc10_11.2: <specific function> = specific_impl_function %impl.elem0.loc10_11.2, @I.WithSelf.Make(%T.loc8_9.1) [symbolic = %specific_impl_fn.loc10_11.2 (constants.%specific_impl_fn)]
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: fn() -> out %return.param: @Use.%T.as_type.loc8_18.1 (%T.as_type) {
  346. // CHECK:STDOUT: !entry:
  347. // CHECK:STDOUT: %T.ref.loc10: %I.type = name_ref T, %T.loc8_9.2 [symbolic = %T.loc8_9.1 (constants.%T)]
  348. // CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.as_type.loc8_18.1 (constants.%T.as_type)]
  349. // CHECK:STDOUT: %.loc10_11.1: type = converted %T.ref.loc10, %T.as_type.loc10 [symbolic = %T.as_type.loc8_18.1 (constants.%T.as_type)]
  350. // CHECK:STDOUT: %Make.ref: %I.assoc_type = name_ref Make, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  351. // CHECK:STDOUT: %impl.elem0.loc10_11.1: @Use.%.loc10_11.2 (%.8e2) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_11.2 (constants.%impl.elem0)]
  352. // CHECK:STDOUT: %specific_impl_fn.loc10_11.1: <specific function> = specific_impl_function %impl.elem0.loc10_11.1, @I.WithSelf.Make(constants.%T) [symbolic = %specific_impl_fn.loc10_11.2 (constants.%specific_impl_fn)]
  353. // CHECK:STDOUT: <elided>
  354. // CHECK:STDOUT: %I.WithSelf.Make.call: init @Use.%T.as_type.loc8_18.1 (%T.as_type) to %.loc8_18.1 = call %specific_impl_fn.loc10_11.1()
  355. // CHECK:STDOUT: return %I.WithSelf.Make.call to %return.param
  356. // CHECK:STDOUT: }
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: specific @Use(constants.%T) {
  360. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  361. // CHECK:STDOUT: %T.as_type.loc8_18.1 => constants.%T.as_type
  362. // CHECK:STDOUT: %.loc8_18.2 => constants.%.ae9
  363. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f4e
  364. // CHECK:STDOUT: }
  365. // CHECK:STDOUT:
  366. // CHECK:STDOUT: --- access_assoc_method.carbon
  367. // CHECK:STDOUT:
  368. // CHECK:STDOUT: constants {
  369. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  370. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  371. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Copy.decl [concrete]
  372. // CHECK:STDOUT: %pattern_type.9d9: type = pattern_type %I.type [concrete]
  373. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  374. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  375. // CHECK:STDOUT: %pattern_type.f4e: type = pattern_type %T.as_type [symbolic]
  376. // CHECK:STDOUT: %.ae9: Core.Form = init_form %T.as_type [symbolic]
  377. // CHECK:STDOUT: %Use.type: type = fn_type @Use [concrete]
  378. // CHECK:STDOUT: %Use: %Use.type = struct_value () [concrete]
  379. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type [symbolic]
  380. // CHECK:STDOUT: %I.WithSelf.Copy.type.035: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T) [symbolic]
  381. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  382. // CHECK:STDOUT: %.fa6: type = fn_type_with_self_type %I.WithSelf.Copy.type.035, %T [symbolic]
  383. // CHECK:STDOUT: %impl.elem0: %.fa6 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  384. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Copy(%T) [symbolic]
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: file {
  388. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [concrete = constants.%Use] {
  389. // CHECK:STDOUT: %T.patt: %pattern_type.9d9 = symbolic_binding_pattern T, 0 [concrete]
  390. // CHECK:STDOUT: %x.param_patt: @Use.%pattern_type (%pattern_type.f4e) = value_param_pattern [concrete]
  391. // CHECK:STDOUT: %x.patt: @Use.%pattern_type (%pattern_type.f4e) = at_binding_pattern x, %x.param_patt [concrete]
  392. // CHECK:STDOUT: %return.param_patt: @Use.%pattern_type (%pattern_type.f4e) = out_param_pattern [concrete]
  393. // CHECK:STDOUT: %return.patt: @Use.%pattern_type (%pattern_type.f4e) = return_slot_pattern %return.param_patt, %.loc9_24.3 [concrete]
  394. // CHECK:STDOUT: } {
  395. // CHECK:STDOUT: %T.ref.loc9_24: %I.type = name_ref T, %T.loc9_9.2 [symbolic = %T.loc9_9.1 (constants.%T)]
  396. // CHECK:STDOUT: %T.as_type.loc9_24: type = facet_access_type %T.ref.loc9_24 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)]
  397. // CHECK:STDOUT: %.loc9_24.3: type = converted %T.ref.loc9_24, %T.as_type.loc9_24 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)]
  398. // CHECK:STDOUT: %.loc9_24.4: Core.Form = init_form %.loc9_24.3 [symbolic = %.loc9_24.2 (constants.%.ae9)]
  399. // CHECK:STDOUT: %.loc9_12: type = splice_block %I.ref [concrete = constants.%I.type] {
  400. // CHECK:STDOUT: <elided>
  401. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT: %T.loc9_9.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc9_9.1 (constants.%T)]
  404. // CHECK:STDOUT: %x.param: @Use.%T.as_type.loc9_18.1 (%T.as_type) = value_param call_param0
  405. // CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)] {
  406. // CHECK:STDOUT: %T.ref.loc9_18: %I.type = name_ref T, %T.loc9_9.2 [symbolic = %T.loc9_9.1 (constants.%T)]
  407. // CHECK:STDOUT: %T.as_type.loc9_18.2: type = facet_access_type %T.ref.loc9_18 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)]
  408. // CHECK:STDOUT: %.loc9_18.2: type = converted %T.ref.loc9_18, %T.as_type.loc9_18.2 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)]
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT: %x: @Use.%T.as_type.loc9_18.1 (%T.as_type) = value_binding x, %x.param
  411. // CHECK:STDOUT: %return.param: ref @Use.%T.as_type.loc9_18.1 (%T.as_type) = out_param call_param1
  412. // CHECK:STDOUT: %return: ref @Use.%T.as_type.loc9_18.1 (%T.as_type) = return_slot %return.param
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: generic fn @Use(%T.loc9_9.2: %I.type) {
  417. // CHECK:STDOUT: %T.loc9_9.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc9_9.1 (constants.%T)]
  418. // CHECK:STDOUT: %T.as_type.loc9_18.1: type = facet_access_type %T.loc9_9.1 [symbolic = %T.as_type.loc9_18.1 (constants.%T.as_type)]
  419. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.as_type.loc9_18.1 [symbolic = %pattern_type (constants.%pattern_type.f4e)]
  420. // CHECK:STDOUT: %.loc9_24.2: Core.Form = init_form %T.as_type.loc9_18.1 [symbolic = %.loc9_24.2 (constants.%.ae9)]
  421. // CHECK:STDOUT:
  422. // CHECK:STDOUT: !definition:
  423. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.as_type.loc9_18.1 [symbolic = %require_complete (constants.%require_complete)]
  424. // CHECK:STDOUT: %I.WithSelf.Copy.type: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T.loc9_9.1) [symbolic = %I.WithSelf.Copy.type (constants.%I.WithSelf.Copy.type.035)]
  425. // CHECK:STDOUT: %.loc10: type = fn_type_with_self_type %I.WithSelf.Copy.type, %T.loc9_9.1 [symbolic = %.loc10 (constants.%.fa6)]
  426. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc9_9.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  427. // CHECK:STDOUT: %impl.elem0.loc10_11.2: @Use.%.loc10 (%.fa6) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_11.2 (constants.%impl.elem0)]
  428. // CHECK:STDOUT: %specific_impl_fn.loc10_11.2: <specific function> = specific_impl_function %impl.elem0.loc10_11.2, @I.WithSelf.Copy(%T.loc9_9.1) [symbolic = %specific_impl_fn.loc10_11.2 (constants.%specific_impl_fn)]
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: fn(%x.param: @Use.%T.as_type.loc9_18.1 (%T.as_type)) -> out %return.param: @Use.%T.as_type.loc9_18.1 (%T.as_type) {
  431. // CHECK:STDOUT: !entry:
  432. // CHECK:STDOUT: %x.ref: @Use.%T.as_type.loc9_18.1 (%T.as_type) = name_ref x, %x
  433. // CHECK:STDOUT: %Copy.ref: %I.assoc_type = name_ref Copy, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  434. // CHECK:STDOUT: %impl.elem0.loc10_11.1: @Use.%.loc10 (%.fa6) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_11.2 (constants.%impl.elem0)]
  435. // CHECK:STDOUT: %bound_method.loc10_11: <bound method> = bound_method %x.ref, %impl.elem0.loc10_11.1
  436. // CHECK:STDOUT: %specific_impl_fn.loc10_11.1: <specific function> = specific_impl_function %impl.elem0.loc10_11.1, @I.WithSelf.Copy(constants.%T) [symbolic = %specific_impl_fn.loc10_11.2 (constants.%specific_impl_fn)]
  437. // CHECK:STDOUT: %bound_method.loc10_17: <bound method> = bound_method %x.ref, %specific_impl_fn.loc10_11.1
  438. // CHECK:STDOUT: %.loc9_24.1: ref @Use.%T.as_type.loc9_18.1 (%T.as_type) = splice_block %return.param {}
  439. // CHECK:STDOUT: %I.WithSelf.Copy.call: init @Use.%T.as_type.loc9_18.1 (%T.as_type) to %.loc9_24.1 = call %bound_method.loc10_17(%x.ref)
  440. // CHECK:STDOUT: return %I.WithSelf.Copy.call to %return.param
  441. // CHECK:STDOUT: }
  442. // CHECK:STDOUT: }
  443. // CHECK:STDOUT:
  444. // CHECK:STDOUT: specific @Use(constants.%T) {
  445. // CHECK:STDOUT: %T.loc9_9.1 => constants.%T
  446. // CHECK:STDOUT: %T.as_type.loc9_18.1 => constants.%T.as_type
  447. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f4e
  448. // CHECK:STDOUT: %.loc9_24.2 => constants.%.ae9
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: --- access_selfless_method.carbon
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: constants {
  454. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  455. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  456. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  457. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Hello.decl [concrete]
  458. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  459. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  460. // CHECK:STDOUT: %pattern_type.f4e: type = pattern_type %T.as_type [symbolic]
  461. // CHECK:STDOUT: %I.WithSelf.Hello.type.3eb: type = fn_type @I.WithSelf.Hello, @I.WithSelf(%T) [symbolic]
  462. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  463. // CHECK:STDOUT: %.8de: type = fn_type_with_self_type %I.WithSelf.Hello.type.3eb, %T [symbolic]
  464. // CHECK:STDOUT: %impl.elem0: %.8de = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  465. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Hello(%T) [symbolic]
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  469. // CHECK:STDOUT: <elided>
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: !definition:
  472. // CHECK:STDOUT: <elided>
  473. // CHECK:STDOUT: %I.WithSelf.Hello.type: type = fn_type @I.WithSelf.Hello, @I.WithSelf(%T.loc8_9.1) [symbolic = %I.WithSelf.Hello.type (constants.%I.WithSelf.Hello.type.3eb)]
  474. // CHECK:STDOUT: %.loc10: type = fn_type_with_self_type %I.WithSelf.Hello.type, %T.loc8_9.1 [symbolic = %.loc10 (constants.%.8de)]
  475. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc8_9.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  476. // CHECK:STDOUT: %impl.elem0.loc10_4.2: @Use.%.loc10 (%.8de) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0)]
  477. // CHECK:STDOUT: %specific_impl_fn.loc10_4.2: <specific function> = specific_impl_function %impl.elem0.loc10_4.2, @I.WithSelf.Hello(%T.loc8_9.1) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn)]
  478. // CHECK:STDOUT:
  479. // CHECK:STDOUT: fn(%x.param: @Use.%T.as_type.loc8_18.1 (%T.as_type)) {
  480. // CHECK:STDOUT: !entry:
  481. // CHECK:STDOUT: %x.ref: @Use.%T.as_type.loc8_18.1 (%T.as_type) = name_ref x, %x
  482. // CHECK:STDOUT: %Hello.ref: %I.assoc_type = name_ref Hello, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  483. // CHECK:STDOUT: %impl.elem0.loc10_4.1: @Use.%.loc10 (%.8de) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_4.2 (constants.%impl.elem0)]
  484. // CHECK:STDOUT: %specific_impl_fn.loc10_4.1: <specific function> = specific_impl_function %impl.elem0.loc10_4.1, @I.WithSelf.Hello(constants.%T) [symbolic = %specific_impl_fn.loc10_4.2 (constants.%specific_impl_fn)]
  485. // CHECK:STDOUT: %I.WithSelf.Hello.call: init %empty_tuple.type = call %specific_impl_fn.loc10_4.1()
  486. // CHECK:STDOUT: <elided>
  487. // CHECK:STDOUT: }
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: specific @Use(constants.%T) {
  491. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  492. // CHECK:STDOUT: %T.as_type.loc8_18.1 => constants.%T.as_type
  493. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f4e
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT:
  496. // CHECK:STDOUT: --- access_assoc_method_indirect.carbon
  497. // CHECK:STDOUT:
  498. // CHECK:STDOUT: constants {
  499. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  500. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  501. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Copy.decl [concrete]
  502. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  503. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  504. // CHECK:STDOUT: %pattern_type.f4e: type = pattern_type %T.as_type [symbolic]
  505. // CHECK:STDOUT: %.ae9: Core.Form = init_form %T.as_type [symbolic]
  506. // CHECK:STDOUT: %I.WithSelf.Copy.type.035: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T) [symbolic]
  507. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  508. // CHECK:STDOUT: %.fa6: type = fn_type_with_self_type %I.WithSelf.Copy.type.035, %T [symbolic]
  509. // CHECK:STDOUT: %impl.elem0: %.fa6 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  510. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Copy(%T) [symbolic]
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: generic fn @UseIndirect(%T.loc8_17.2: %I.type) {
  514. // CHECK:STDOUT: <elided>
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: !definition:
  517. // CHECK:STDOUT: <elided>
  518. // CHECK:STDOUT: %I.WithSelf.Copy.type: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T.loc8_17.1) [symbolic = %I.WithSelf.Copy.type (constants.%I.WithSelf.Copy.type.035)]
  519. // CHECK:STDOUT: %.loc10_14.2: type = fn_type_with_self_type %I.WithSelf.Copy.type, %T.loc8_17.1 [symbolic = %.loc10_14.2 (constants.%.fa6)]
  520. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc8_17.1, @I [symbolic = %I.lookup_impl_witness (constants.%I.lookup_impl_witness)]
  521. // CHECK:STDOUT: %impl.elem0.loc10_14.2: @UseIndirect.%.loc10_14.2 (%.fa6) = impl_witness_access %I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_14.2 (constants.%impl.elem0)]
  522. // CHECK:STDOUT: %specific_impl_fn.loc10_14.2: <specific function> = specific_impl_function %impl.elem0.loc10_14.2, @I.WithSelf.Copy(%T.loc8_17.1) [symbolic = %specific_impl_fn.loc10_14.2 (constants.%specific_impl_fn)]
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: fn(%x.param: @UseIndirect.%T.as_type.loc8_26.1 (%T.as_type)) -> out %return.param: @UseIndirect.%T.as_type.loc8_26.1 (%T.as_type) {
  525. // CHECK:STDOUT: !entry:
  526. // CHECK:STDOUT: %x.ref: @UseIndirect.%T.as_type.loc8_26.1 (%T.as_type) = name_ref x, %x
  527. // CHECK:STDOUT: %T.ref.loc10: %I.type = name_ref T, %T.loc8_17.2 [symbolic = %T.loc8_17.1 (constants.%T)]
  528. // CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.as_type.loc8_26.1 (constants.%T.as_type)]
  529. // CHECK:STDOUT: %.loc10_14.1: type = converted %T.ref.loc10, %T.as_type.loc10 [symbolic = %T.as_type.loc8_26.1 (constants.%T.as_type)]
  530. // CHECK:STDOUT: %Copy.ref: %I.assoc_type = name_ref Copy, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  531. // CHECK:STDOUT: %impl.elem0.loc10_14.1: @UseIndirect.%.loc10_14.2 (%.fa6) = impl_witness_access constants.%I.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc10_14.2 (constants.%impl.elem0)]
  532. // CHECK:STDOUT: %bound_method.loc10_11: <bound method> = bound_method %x.ref, %impl.elem0.loc10_14.1
  533. // CHECK:STDOUT: %specific_impl_fn.loc10_14.1: <specific function> = specific_impl_function %impl.elem0.loc10_14.1, @I.WithSelf.Copy(constants.%T) [symbolic = %specific_impl_fn.loc10_14.2 (constants.%specific_impl_fn)]
  534. // CHECK:STDOUT: %bound_method.loc10_21: <bound method> = bound_method %x.ref, %specific_impl_fn.loc10_14.1
  535. // CHECK:STDOUT: <elided>
  536. // CHECK:STDOUT: %I.WithSelf.Copy.call: init @UseIndirect.%T.as_type.loc8_26.1 (%T.as_type) to %.loc8_32.1 = call %bound_method.loc10_21(%x.ref)
  537. // CHECK:STDOUT: return %I.WithSelf.Copy.call to %return.param
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT: }
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: specific @UseIndirect(constants.%T) {
  542. // CHECK:STDOUT: %T.loc8_17.1 => constants.%T
  543. // CHECK:STDOUT: %T.as_type.loc8_26.1 => constants.%T.as_type
  544. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.f4e
  545. // CHECK:STDOUT: %.loc8_32.2 => constants.%.ae9
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT:
  548. // CHECK:STDOUT: --- access_constant_in_self_facet.carbon
  549. // CHECK:STDOUT:
  550. // CHECK:STDOUT: constants {
  551. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  552. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic]
  553. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete]
  554. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete]
  555. // CHECK:STDOUT: %.Self.091: %A.type = symbolic_binding .Self [symbolic_self]
  556. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.091 [symbolic_self]
  557. // CHECK:STDOUT: %A.lookup_impl_witness.6a5: <witness> = lookup_impl_witness %.Self.091, @A [symbolic_self]
  558. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %A.lookup_impl_witness.6a5, element0 [symbolic_self]
  559. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  560. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  561. // CHECK:STDOUT: %A_where.type: type = facet_type <@A where %impl.elem0 = %empty_tuple.type> [concrete]
  562. // CHECK:STDOUT: %pattern_type.dc8: type = pattern_type %A_where.type [concrete]
  563. // CHECK:STDOUT: %AA: %A_where.type = symbolic_binding AA, 0 [symbolic]
  564. // CHECK:STDOUT: %AA.as_type: type = facet_access_type %AA [symbolic]
  565. // CHECK:STDOUT: %A.lookup_impl_witness.6c3: <witness> = lookup_impl_witness %AA, @A [symbolic]
  566. // CHECK:STDOUT: %A.facet: %A.type = facet_value %AA.as_type, (%A.lookup_impl_witness.6c3) [symbolic]
  567. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  568. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  569. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  570. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  571. // CHECK:STDOUT: }
  572. // CHECK:STDOUT:
  573. // CHECK:STDOUT: file {
  574. // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {}
  575. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  576. // CHECK:STDOUT: %AA.patt: %pattern_type.dc8 = symbolic_binding_pattern AA, 0 [concrete]
  577. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  578. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc6_33 [concrete]
  579. // CHECK:STDOUT: } {
  580. // CHECK:STDOUT: %AA.ref: %A_where.type = name_ref AA, %AA.loc6_8.2 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  581. // CHECK:STDOUT: %AA.as_type.loc6_33.2: type = facet_access_type %AA.ref [symbolic = %AA.as_type.loc6_33.1 (constants.%AA.as_type)]
  582. // CHECK:STDOUT: %.loc6_33.1: type = converted %AA.ref, %AA.as_type.loc6_33.2 [symbolic = %AA.as_type.loc6_33.1 (constants.%AA.as_type)]
  583. // CHECK:STDOUT: %X.ref.loc6_33: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  584. // CHECK:STDOUT: %impl.elem0.loc6_33: type = impl_witness_access constants.%A.lookup_impl_witness.6c3, element0 [concrete = constants.%empty_tuple.type]
  585. // CHECK:STDOUT: %.loc6_33.2: Core.Form = init_form %impl.elem0.loc6_33 [concrete = constants.%.262]
  586. // CHECK:STDOUT: %.loc6_13.1: type = splice_block %.loc6_13.2 [concrete = constants.%A_where.type] {
  587. // CHECK:STDOUT: <elided>
  588. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  589. // CHECK:STDOUT: <elided>
  590. // CHECK:STDOUT: %.Self.ref: %A.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.091]
  591. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  592. // CHECK:STDOUT: %.loc6_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  593. // CHECK:STDOUT: %X.ref.loc6_19: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  594. // CHECK:STDOUT: %impl.elem0.loc6_19: type = impl_witness_access constants.%A.lookup_impl_witness.6a5, element0 [symbolic_self = constants.%impl.elem0]
  595. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  596. // CHECK:STDOUT: %.loc6_25.2: type = converted %.loc6_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  597. // CHECK:STDOUT: %.loc6_13.2: type = where_expr [concrete = constants.%A_where.type] {
  598. // CHECK:STDOUT: requirement_base_facet_type %A.ref
  599. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc6_19, %.loc6_25.2
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT: %AA.loc6_8.2: %A_where.type = symbolic_binding AA, 0 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  603. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  604. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  605. // CHECK:STDOUT: }
  606. // CHECK:STDOUT: }
  607. // CHECK:STDOUT:
  608. // CHECK:STDOUT: interface @A {
  609. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  610. // CHECK:STDOUT: %A.WithSelf.decl = interface_with_self_decl @A [concrete]
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: !with Self:
  613. // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] {
  614. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete = constants.%assoc0]
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: !members:
  618. // CHECK:STDOUT: .Self = %Self
  619. // CHECK:STDOUT: .X = @X.%assoc0
  620. // CHECK:STDOUT: witness = (@A.WithSelf.%X)
  621. // CHECK:STDOUT:
  622. // CHECK:STDOUT: !requires:
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: generic fn @F(%AA.loc6_8.2: %A_where.type) {
  626. // CHECK:STDOUT: %AA.loc6_8.1: %A_where.type = symbolic_binding AA, 0 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  627. // CHECK:STDOUT: %AA.as_type.loc6_33.1: type = facet_access_type %AA.loc6_8.1 [symbolic = %AA.as_type.loc6_33.1 (constants.%AA.as_type)]
  628. // CHECK:STDOUT:
  629. // CHECK:STDOUT: !definition:
  630. // CHECK:STDOUT:
  631. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  632. // CHECK:STDOUT: !entry:
  633. // CHECK:STDOUT: %.loc7_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  634. // CHECK:STDOUT: %.loc7_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  635. // CHECK:STDOUT: %.loc7_12: init %empty_tuple.type = converted %.loc7_11.1, %.loc7_11.2 [concrete = constants.%empty_tuple]
  636. // CHECK:STDOUT: return %.loc7_12
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT: }
  639. // CHECK:STDOUT:
  640. // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {
  641. // CHECK:STDOUT: !definition:
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: specific @A.WithSelf(constants.%.Self.091) {
  645. // CHECK:STDOUT: !definition:
  646. // CHECK:STDOUT: }
  647. // CHECK:STDOUT:
  648. // CHECK:STDOUT: specific @A.WithSelf(constants.%AA) {
  649. // CHECK:STDOUT: !definition:
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: specific @A.WithSelf(constants.%A.facet) {
  653. // CHECK:STDOUT: !definition:
  654. // CHECK:STDOUT: }
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: specific @F(constants.%AA) {
  657. // CHECK:STDOUT: %AA.loc6_8.1 => constants.%AA
  658. // CHECK:STDOUT: %AA.as_type.loc6_33.1 => constants.%AA.as_type
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: --- access_constant_in_self_facet_with_multiple_interfaces.carbon
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: constants {
  664. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  665. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete]
  666. // CHECK:STDOUT: %assoc0.df7: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete]
  667. // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete]
  668. // CHECK:STDOUT: %B.assoc_type: type = assoc_entity_type @B [concrete]
  669. // CHECK:STDOUT: %assoc0.6fa: %B.assoc_type = assoc_entity element0, @B.WithSelf.%Y [concrete]
  670. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  671. // CHECK:STDOUT: %BitAndWith.type.b10: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete]
  672. // CHECK:STDOUT: %BitAndWith.impl_witness: <witness> = impl_witness imports.%BitAndWith.impl_witness_table [concrete]
  673. // CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.b10 = facet_value type, (%BitAndWith.impl_witness) [concrete]
  674. // CHECK:STDOUT: %BitAndWith.WithSelf.Op.type.4bd: type = fn_type @BitAndWith.WithSelf.Op, @BitAndWith.WithSelf(type, %BitAndWith.facet) [concrete]
  675. // CHECK:STDOUT: %.d15: type = fn_type_with_self_type %BitAndWith.WithSelf.Op.type.4bd, %BitAndWith.facet [concrete]
  676. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.type: type = fn_type @type.as.BitAndWith.impl.Op [concrete]
  677. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op: %type.as.BitAndWith.impl.Op.type = struct_value () [concrete]
  678. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.bound: <bound method> = bound_method %A.type, %type.as.BitAndWith.impl.Op [concrete]
  679. // CHECK:STDOUT: %facet_type.9bb: type = facet_type <@A & @B> [concrete]
  680. // CHECK:STDOUT: %.Self.e7e: %facet_type.9bb = symbolic_binding .Self [symbolic_self]
  681. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.e7e [symbolic_self]
  682. // CHECK:STDOUT: %A.lookup_impl_witness.6b3: <witness> = lookup_impl_witness %.Self.e7e, @A [symbolic_self]
  683. // CHECK:STDOUT: %impl.elem0.eb8: type = impl_witness_access %A.lookup_impl_witness.6b3, element0 [symbolic_self]
  684. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  685. // CHECK:STDOUT: %B.lookup_impl_witness.d4f: <witness> = lookup_impl_witness %.Self.e7e, @B [symbolic_self]
  686. // CHECK:STDOUT: %impl.elem0.11d: type = impl_witness_access %B.lookup_impl_witness.d4f, element0 [symbolic_self]
  687. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  688. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  689. // CHECK:STDOUT: %facet_type.82c: type = facet_type <@A & @B where %impl.elem0.eb8 = %empty_tuple.type and %impl.elem0.11d = %empty_struct_type> [concrete]
  690. // CHECK:STDOUT: %pattern_type.77e: type = pattern_type %facet_type.82c [concrete]
  691. // CHECK:STDOUT: %AB: %facet_type.82c = symbolic_binding AB, 0 [symbolic]
  692. // CHECK:STDOUT: %AB.as_type: type = facet_access_type %AB [symbolic]
  693. // CHECK:STDOUT: %A.lookup_impl_witness.1b9: <witness> = lookup_impl_witness %AB, @A [symbolic]
  694. // CHECK:STDOUT: %B.lookup_impl_witness.97b: <witness> = lookup_impl_witness %AB, @B [symbolic]
  695. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  696. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  697. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  698. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  699. // CHECK:STDOUT: %.469: Core.Form = init_form %empty_struct_type [concrete]
  700. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  701. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  702. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT:
  705. // CHECK:STDOUT: imports {
  706. // CHECK:STDOUT: %Core.import_ref.8d3: %type.as.BitAndWith.impl.Op.type = import_ref Core//prelude/parts/as, loc{{\d+_\d+}}, loaded [concrete = constants.%type.as.BitAndWith.impl.Op]
  707. // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.8d3), @type.as.BitAndWith.impl [concrete]
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: file {
  711. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  712. // CHECK:STDOUT: %AB.patt: %pattern_type.77e = symbolic_binding_pattern AB, 0 [concrete]
  713. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  714. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc14_49 [concrete]
  715. // CHECK:STDOUT: } {
  716. // CHECK:STDOUT: %AB.ref: %facet_type.82c = name_ref AB, %AB.loc14_8.2 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  717. // CHECK:STDOUT: %AB.as_type.loc14_49.2: type = facet_access_type %AB.ref [symbolic = %AB.as_type.loc14_49.1 (constants.%AB.as_type)]
  718. // CHECK:STDOUT: %.loc14_49.1: type = converted %AB.ref, %AB.as_type.loc14_49.2 [symbolic = %AB.as_type.loc14_49.1 (constants.%AB.as_type)]
  719. // CHECK:STDOUT: %X.ref.loc14_49: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  720. // CHECK:STDOUT: %impl.elem0.loc14_49: type = impl_witness_access constants.%A.lookup_impl_witness.1b9, element0 [concrete = constants.%empty_tuple.type]
  721. // CHECK:STDOUT: %.loc14_49.2: Core.Form = init_form %impl.elem0.loc14_49 [concrete = constants.%.262]
  722. // CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = constants.%facet_type.82c] {
  723. // CHECK:STDOUT: <elided>
  724. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  725. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type]
  726. // CHECK:STDOUT: %impl.elem0.loc14_13: %.d15 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
  727. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %A.ref, %impl.elem0.loc14_13 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
  728. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%A.ref, %B.ref) [concrete = constants.%facet_type.9bb]
  729. // CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type.9bb]
  730. // CHECK:STDOUT: %.loc14_13.2: type = converted %type.as.BitAndWith.impl.Op.call, %.loc14_13.1 [concrete = constants.%facet_type.9bb]
  731. // CHECK:STDOUT: <elided>
  732. // CHECK:STDOUT: %.Self.ref.loc14_23: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  733. // CHECK:STDOUT: %.Self.as_type.loc14_23: type = facet_access_type %.Self.ref.loc14_23 [symbolic_self = constants.%.Self.as_type]
  734. // CHECK:STDOUT: %.loc14_23: type = converted %.Self.ref.loc14_23, %.Self.as_type.loc14_23 [symbolic_self = constants.%.Self.as_type]
  735. // CHECK:STDOUT: %X.ref.loc14_23: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  736. // CHECK:STDOUT: %impl.elem0.loc14_23: type = impl_witness_access constants.%A.lookup_impl_witness.6b3, element0 [symbolic_self = constants.%impl.elem0.eb8]
  737. // CHECK:STDOUT: %.loc14_29.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  738. // CHECK:STDOUT: %.loc14_29.2: type = converted %.loc14_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  739. // CHECK:STDOUT: %.Self.ref.loc14_35: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  740. // CHECK:STDOUT: %.Self.as_type.loc14_35: type = facet_access_type %.Self.ref.loc14_35 [symbolic_self = constants.%.Self.as_type]
  741. // CHECK:STDOUT: %.loc14_35: type = converted %.Self.ref.loc14_35, %.Self.as_type.loc14_35 [symbolic_self = constants.%.Self.as_type]
  742. // CHECK:STDOUT: %Y.ref: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  743. // CHECK:STDOUT: %impl.elem0.loc14_35: type = impl_witness_access constants.%B.lookup_impl_witness.d4f, element0 [symbolic_self = constants.%impl.elem0.11d]
  744. // CHECK:STDOUT: %.loc14_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  745. // CHECK:STDOUT: %.loc14_41.2: type = converted %.loc14_41.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  746. // CHECK:STDOUT: %.loc14_17.2: type = where_expr [concrete = constants.%facet_type.82c] {
  747. // CHECK:STDOUT: requirement_base_facet_type %type.as.BitAndWith.impl.Op.call
  748. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc14_23, %.loc14_29.2
  749. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc14_35, %.loc14_41.2
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT: }
  752. // CHECK:STDOUT: %AB.loc14_8.2: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  753. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  754. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  755. // CHECK:STDOUT: }
  756. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  757. // CHECK:STDOUT: %AB.patt: %pattern_type.77e = symbolic_binding_pattern AB, 0 [concrete]
  758. // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete]
  759. // CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %impl.elem0.loc18_49 [concrete]
  760. // CHECK:STDOUT: } {
  761. // CHECK:STDOUT: %AB.ref: %facet_type.82c = name_ref AB, %AB.loc18_8.2 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  762. // CHECK:STDOUT: %AB.as_type.loc18_49.2: type = facet_access_type %AB.ref [symbolic = %AB.as_type.loc18_49.1 (constants.%AB.as_type)]
  763. // CHECK:STDOUT: %.loc18_49.1: type = converted %AB.ref, %AB.as_type.loc18_49.2 [symbolic = %AB.as_type.loc18_49.1 (constants.%AB.as_type)]
  764. // CHECK:STDOUT: %Y.ref.loc18_49: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  765. // CHECK:STDOUT: %impl.elem0.loc18_49: type = impl_witness_access constants.%B.lookup_impl_witness.97b, element0 [concrete = constants.%empty_struct_type]
  766. // CHECK:STDOUT: %.loc18_49.2: Core.Form = init_form %impl.elem0.loc18_49 [concrete = constants.%.469]
  767. // CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = constants.%facet_type.82c] {
  768. // CHECK:STDOUT: <elided>
  769. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  770. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type]
  771. // CHECK:STDOUT: %impl.elem0.loc18_13: %.d15 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
  772. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %A.ref, %impl.elem0.loc18_13 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
  773. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%A.ref, %B.ref) [concrete = constants.%facet_type.9bb]
  774. // CHECK:STDOUT: %.loc18_13.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type.9bb]
  775. // CHECK:STDOUT: %.loc18_13.2: type = converted %type.as.BitAndWith.impl.Op.call, %.loc18_13.1 [concrete = constants.%facet_type.9bb]
  776. // CHECK:STDOUT: <elided>
  777. // CHECK:STDOUT: %.Self.ref.loc18_23: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  778. // CHECK:STDOUT: %.Self.as_type.loc18_23: type = facet_access_type %.Self.ref.loc18_23 [symbolic_self = constants.%.Self.as_type]
  779. // CHECK:STDOUT: %.loc18_23: type = converted %.Self.ref.loc18_23, %.Self.as_type.loc18_23 [symbolic_self = constants.%.Self.as_type]
  780. // CHECK:STDOUT: %X.ref: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  781. // CHECK:STDOUT: %impl.elem0.loc18_23: type = impl_witness_access constants.%A.lookup_impl_witness.6b3, element0 [symbolic_self = constants.%impl.elem0.eb8]
  782. // CHECK:STDOUT: %.loc18_29.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  783. // CHECK:STDOUT: %.loc18_29.2: type = converted %.loc18_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  784. // CHECK:STDOUT: %.Self.ref.loc18_35: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  785. // CHECK:STDOUT: %.Self.as_type.loc18_35: type = facet_access_type %.Self.ref.loc18_35 [symbolic_self = constants.%.Self.as_type]
  786. // CHECK:STDOUT: %.loc18_35: type = converted %.Self.ref.loc18_35, %.Self.as_type.loc18_35 [symbolic_self = constants.%.Self.as_type]
  787. // CHECK:STDOUT: %Y.ref.loc18_35: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  788. // CHECK:STDOUT: %impl.elem0.loc18_35: type = impl_witness_access constants.%B.lookup_impl_witness.d4f, element0 [symbolic_self = constants.%impl.elem0.11d]
  789. // CHECK:STDOUT: %.loc18_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  790. // CHECK:STDOUT: %.loc18_41.2: type = converted %.loc18_41.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  791. // CHECK:STDOUT: %.loc18_17.2: type = where_expr [concrete = constants.%facet_type.82c] {
  792. // CHECK:STDOUT: requirement_base_facet_type %type.as.BitAndWith.impl.Op.call
  793. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18_23, %.loc18_29.2
  794. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18_35, %.loc18_41.2
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT: }
  797. // CHECK:STDOUT: %AB.loc18_8.2: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  798. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0
  799. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  800. // CHECK:STDOUT: }
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: generic fn @F(%AB.loc14_8.2: %facet_type.82c) {
  804. // CHECK:STDOUT: %AB.loc14_8.1: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  805. // CHECK:STDOUT: %AB.as_type.loc14_49.1: type = facet_access_type %AB.loc14_8.1 [symbolic = %AB.as_type.loc14_49.1 (constants.%AB.as_type)]
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: !definition:
  808. // CHECK:STDOUT:
  809. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  810. // CHECK:STDOUT: !entry:
  811. // CHECK:STDOUT: %.loc15_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  812. // CHECK:STDOUT: %.loc15_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  813. // CHECK:STDOUT: %.loc15_12: init %empty_tuple.type = converted %.loc15_11.1, %.loc15_11.2 [concrete = constants.%empty_tuple]
  814. // CHECK:STDOUT: return %.loc15_12
  815. // CHECK:STDOUT: }
  816. // CHECK:STDOUT: }
  817. // CHECK:STDOUT:
  818. // CHECK:STDOUT: generic fn @G(%AB.loc18_8.2: %facet_type.82c) {
  819. // CHECK:STDOUT: %AB.loc18_8.1: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  820. // CHECK:STDOUT: %AB.as_type.loc18_49.1: type = facet_access_type %AB.loc18_8.1 [symbolic = %AB.as_type.loc18_49.1 (constants.%AB.as_type)]
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: !definition:
  823. // CHECK:STDOUT:
  824. // CHECK:STDOUT: fn() -> out %return.param: %empty_struct_type {
  825. // CHECK:STDOUT: !entry:
  826. // CHECK:STDOUT: %.loc19_11.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  827. // CHECK:STDOUT: %.loc19_11.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct]
  828. // CHECK:STDOUT: %.loc19_12: init %empty_struct_type = converted %.loc19_11.1, %.loc19_11.2 [concrete = constants.%empty_struct]
  829. // CHECK:STDOUT: return %.loc19_12
  830. // CHECK:STDOUT: }
  831. // CHECK:STDOUT: }
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: specific @F(constants.%AB) {
  834. // CHECK:STDOUT: %AB.loc14_8.1 => constants.%AB
  835. // CHECK:STDOUT: %AB.as_type.loc14_49.1 => constants.%AB.as_type
  836. // CHECK:STDOUT: }
  837. // CHECK:STDOUT:
  838. // CHECK:STDOUT: specific @G(constants.%AB) {
  839. // CHECK:STDOUT: %AB.loc18_8.1 => constants.%AB
  840. // CHECK:STDOUT: %AB.as_type.loc18_49.1 => constants.%AB.as_type
  841. // CHECK:STDOUT: }
  842. // CHECK:STDOUT: