access.carbon 57 KB

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