access.carbon 58 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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](unused V: U*) {}
  97. fn F(U:! I where .X = .Self, unused 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](unused V: U*) {}
  111. fn F3[U:! I where .X = .Self](unused V: U*) {}
  112. fn F(U:! I where .X = .Self, unused 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](unused 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)` [MissingImplInMemberAccessInContext]
  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)` [MissingImplInMemberAccessInContext]
  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)` [MissingImplInMemberAccessInContext]
  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*)` [MissingImplInMemberAccessInContext]
  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. //@dump-sem-ir-begin
  290. interface A { let X:! type; }
  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, unused 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: %empty_tuple.type: type = tuple_type () [concrete]
  340. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  341. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.DoIt.decl [concrete]
  342. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  343. // CHECK:STDOUT: %I.WithSelf.DoIt.type.66b: type = fn_type @I.WithSelf.DoIt, @I.WithSelf(%T) [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: %.f37: type = fn_type_with_self_type %I.WithSelf.DoIt.type.66b, %T [symbolic]
  347. // CHECK:STDOUT: %impl.elem0: %.f37 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  348. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.DoIt(%T) [symbolic]
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  352. // CHECK:STDOUT: <elided>
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: !definition:
  355. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc8_9.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  356. // 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)]
  357. // 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)]
  358. // 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)]
  359. // 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)]
  360. // 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)]
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: fn() {
  363. // CHECK:STDOUT: !entry:
  364. // CHECK:STDOUT: %T.ref: %I.type = name_ref T, %T.loc8_9.2 [symbolic = %T.loc8_9.1 (constants.%T)]
  365. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ref [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  366. // CHECK:STDOUT: %.loc10_4.1: type = converted %T.ref, %T.as_type [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  367. // CHECK:STDOUT: %DoIt.ref: %I.assoc_type = name_ref DoIt, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  368. // 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)]
  369. // 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)]
  370. // CHECK:STDOUT: %I.WithSelf.DoIt.call: init %empty_tuple.type = call %specific_impl_fn.loc10_4.1()
  371. // CHECK:STDOUT: <elided>
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT: }
  374. // CHECK:STDOUT:
  375. // CHECK:STDOUT: specific @Use(constants.%T) {
  376. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: --- assoc_fn_using_self.carbon
  380. // CHECK:STDOUT:
  381. // CHECK:STDOUT: constants {
  382. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  383. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  384. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Make.decl [concrete]
  385. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  386. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  387. // CHECK:STDOUT: %.ff7: Core.Form = init_form %T.binding.as_type [symbolic]
  388. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %T.binding.as_type [symbolic]
  389. // CHECK:STDOUT: %I.WithSelf.Make.type.f20: type = fn_type @I.WithSelf.Make, @I.WithSelf(%T) [symbolic]
  390. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  391. // CHECK:STDOUT: %.8e2: type = fn_type_with_self_type %I.WithSelf.Make.type.f20, %T [symbolic]
  392. // CHECK:STDOUT: %impl.elem0: %.8e2 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  393. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Make(%T) [symbolic]
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  397. // CHECK:STDOUT: <elided>
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: !definition:
  400. // CHECK:STDOUT: <elided>
  401. // 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)]
  402. // 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)]
  403. // 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)]
  404. // 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)]
  405. // 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)]
  406. // CHECK:STDOUT:
  407. // CHECK:STDOUT: fn() -> out %return.param: @Use.%T.binding.as_type (%T.binding.as_type) {
  408. // CHECK:STDOUT: !entry:
  409. // CHECK:STDOUT: %T.ref.loc10: %I.type = name_ref T, %T.loc8_9.2 [symbolic = %T.loc8_9.1 (constants.%T)]
  410. // CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  411. // CHECK:STDOUT: %.loc10_11.1: type = converted %T.ref.loc10, %T.as_type.loc10 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  412. // CHECK:STDOUT: %Make.ref: %I.assoc_type = name_ref Make, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  413. // 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)]
  414. // 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)]
  415. // CHECK:STDOUT: <elided>
  416. // CHECK:STDOUT: %I.WithSelf.Make.call: init @Use.%T.binding.as_type (%T.binding.as_type) to %.loc8_18.1 = call %specific_impl_fn.loc10_11.1()
  417. // CHECK:STDOUT: return %I.WithSelf.Make.call to %return.param
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: specific @Use(constants.%T) {
  422. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  423. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  424. // CHECK:STDOUT: %.loc8_18.2 => constants.%.ff7
  425. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT:
  428. // CHECK:STDOUT: --- access_assoc_method.carbon
  429. // CHECK:STDOUT:
  430. // CHECK:STDOUT: constants {
  431. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  432. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  433. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Copy.decl [concrete]
  434. // CHECK:STDOUT: %pattern_type.9d9: type = pattern_type %I.type [concrete]
  435. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  436. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  437. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %T.binding.as_type [symbolic]
  438. // CHECK:STDOUT: %.ff7: Core.Form = init_form %T.binding.as_type [symbolic]
  439. // CHECK:STDOUT: %Use.type: type = fn_type @Use [concrete]
  440. // CHECK:STDOUT: %Use: %Use.type = struct_value () [concrete]
  441. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.binding.as_type [symbolic]
  442. // CHECK:STDOUT: %I.WithSelf.Copy.type.035: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T) [symbolic]
  443. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  444. // CHECK:STDOUT: %.fa6: type = fn_type_with_self_type %I.WithSelf.Copy.type.035, %T [symbolic]
  445. // CHECK:STDOUT: %impl.elem0: %.fa6 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  446. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Copy(%T) [symbolic]
  447. // CHECK:STDOUT: }
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: file {
  450. // CHECK:STDOUT: %Use.decl: %Use.type = fn_decl @Use [concrete = constants.%Use] {
  451. // CHECK:STDOUT: %T.patt: %pattern_type.9d9 = symbolic_binding_pattern T, 0 [concrete]
  452. // CHECK:STDOUT: %x.param_patt: @Use.%pattern_type (%pattern_type.422) = value_param_pattern [concrete]
  453. // CHECK:STDOUT: %x.patt: @Use.%pattern_type (%pattern_type.422) = at_binding_pattern x, %x.param_patt [concrete]
  454. // CHECK:STDOUT: %return.param_patt: @Use.%pattern_type (%pattern_type.422) = out_param_pattern [concrete]
  455. // CHECK:STDOUT: %return.patt: @Use.%pattern_type (%pattern_type.422) = return_slot_pattern %return.param_patt, %.loc9_24.3 [concrete]
  456. // CHECK:STDOUT: } {
  457. // CHECK:STDOUT: %T.ref.loc9_24: %I.type = name_ref T, %T.loc9_9.2 [symbolic = %T.loc9_9.1 (constants.%T)]
  458. // 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)]
  459. // 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)]
  460. // CHECK:STDOUT: %.loc9_24.4: Core.Form = init_form %.loc9_24.3 [symbolic = %.loc9_24.2 (constants.%.ff7)]
  461. // CHECK:STDOUT: %.loc9_12: type = splice_block %I.ref [concrete = constants.%I.type] {
  462. // CHECK:STDOUT: <elided>
  463. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: %T.loc9_9.2: %I.type = symbolic_binding T, 0 [symbolic = %T.loc9_9.1 (constants.%T)]
  466. // CHECK:STDOUT: %x.param: @Use.%T.binding.as_type (%T.binding.as_type) = value_param call_param0
  467. // CHECK:STDOUT: %.loc9_18.1: type = splice_block %.loc9_18.2 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)] {
  468. // CHECK:STDOUT: %T.ref.loc9_18: %I.type = name_ref T, %T.loc9_9.2 [symbolic = %T.loc9_9.1 (constants.%T)]
  469. // 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)]
  470. // 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)]
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT: %x: @Use.%T.binding.as_type (%T.binding.as_type) = value_binding x, %x.param
  473. // CHECK:STDOUT: %return.param: ref @Use.%T.binding.as_type (%T.binding.as_type) = out_param call_param1
  474. // CHECK:STDOUT: %return: ref @Use.%T.binding.as_type (%T.binding.as_type) = return_slot %return.param
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: generic fn @Use(%T.loc9_9.2: %I.type) {
  479. // CHECK:STDOUT: %T.loc9_9.1: %I.type = symbolic_binding T, 0 [symbolic = %T.loc9_9.1 (constants.%T)]
  480. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.loc9_9.1 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  481. // CHECK:STDOUT: %pattern_type: type = pattern_type %T.binding.as_type [symbolic = %pattern_type (constants.%pattern_type.422)]
  482. // CHECK:STDOUT: %.loc9_24.2: Core.Form = init_form %T.binding.as_type [symbolic = %.loc9_24.2 (constants.%.ff7)]
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: !definition:
  485. // CHECK:STDOUT: %require_complete: <witness> = require_complete_type %T.binding.as_type [symbolic = %require_complete (constants.%require_complete)]
  486. // 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)]
  487. // CHECK:STDOUT: %.loc10: type = fn_type_with_self_type %I.WithSelf.Copy.type, %T.loc9_9.1 [symbolic = %.loc10 (constants.%.fa6)]
  488. // 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)]
  489. // 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)]
  490. // 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)]
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: fn(%x.param: @Use.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @Use.%T.binding.as_type (%T.binding.as_type) {
  493. // CHECK:STDOUT: !entry:
  494. // CHECK:STDOUT: %x.ref: @Use.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  495. // CHECK:STDOUT: %Copy.ref: %I.assoc_type = name_ref Copy, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  496. // 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)]
  497. // CHECK:STDOUT: %bound_method.loc10_11: <bound method> = bound_method %x.ref, %impl.elem0.loc10_11.1
  498. // 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)]
  499. // CHECK:STDOUT: %bound_method.loc10_17: <bound method> = bound_method %x.ref, %specific_impl_fn.loc10_11.1
  500. // CHECK:STDOUT: %.loc9_24.1: ref @Use.%T.binding.as_type (%T.binding.as_type) = splice_block %return.param {}
  501. // CHECK:STDOUT: %I.WithSelf.Copy.call: init @Use.%T.binding.as_type (%T.binding.as_type) to %.loc9_24.1 = call %bound_method.loc10_17(%x.ref)
  502. // CHECK:STDOUT: return %I.WithSelf.Copy.call to %return.param
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT: }
  505. // CHECK:STDOUT:
  506. // CHECK:STDOUT: specific @Use(constants.%T) {
  507. // CHECK:STDOUT: %T.loc9_9.1 => constants.%T
  508. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  509. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  510. // CHECK:STDOUT: %.loc9_24.2 => constants.%.ff7
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: --- access_selfless_method.carbon
  514. // CHECK:STDOUT:
  515. // CHECK:STDOUT: constants {
  516. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  517. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  518. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  519. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Hello.decl [concrete]
  520. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  521. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  522. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %T.binding.as_type [symbolic]
  523. // CHECK:STDOUT: %I.WithSelf.Hello.type.3eb: type = fn_type @I.WithSelf.Hello, @I.WithSelf(%T) [symbolic]
  524. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  525. // CHECK:STDOUT: %.8de: type = fn_type_with_self_type %I.WithSelf.Hello.type.3eb, %T [symbolic]
  526. // CHECK:STDOUT: %impl.elem0: %.8de = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  527. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Hello(%T) [symbolic]
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: generic fn @Use(%T.loc8_9.2: %I.type) {
  531. // CHECK:STDOUT: <elided>
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: !definition:
  534. // CHECK:STDOUT: <elided>
  535. // 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)]
  536. // CHECK:STDOUT: %.loc10: type = fn_type_with_self_type %I.WithSelf.Hello.type, %T.loc8_9.1 [symbolic = %.loc10 (constants.%.8de)]
  537. // 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)]
  538. // 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)]
  539. // 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)]
  540. // CHECK:STDOUT:
  541. // CHECK:STDOUT: fn(%x.param: @Use.%T.binding.as_type (%T.binding.as_type)) {
  542. // CHECK:STDOUT: !entry:
  543. // CHECK:STDOUT: %x.ref: @Use.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  544. // CHECK:STDOUT: %Hello.ref: %I.assoc_type = name_ref Hello, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  545. // 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)]
  546. // 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)]
  547. // CHECK:STDOUT: %I.WithSelf.Hello.call: init %empty_tuple.type = call %specific_impl_fn.loc10_4.1()
  548. // CHECK:STDOUT: <elided>
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: specific @Use(constants.%T) {
  553. // CHECK:STDOUT: %T.loc8_9.1 => constants.%T
  554. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  555. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  556. // CHECK:STDOUT: }
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: --- access_assoc_method_indirect.carbon
  559. // CHECK:STDOUT:
  560. // CHECK:STDOUT: constants {
  561. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  562. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type @I [concrete]
  563. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.WithSelf.%I.WithSelf.Copy.decl [concrete]
  564. // CHECK:STDOUT: %T: %I.type = symbolic_binding T, 0 [symbolic]
  565. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  566. // CHECK:STDOUT: %pattern_type.422: type = pattern_type %T.binding.as_type [symbolic]
  567. // CHECK:STDOUT: %.ff7: Core.Form = init_form %T.binding.as_type [symbolic]
  568. // CHECK:STDOUT: %I.WithSelf.Copy.type.035: type = fn_type @I.WithSelf.Copy, @I.WithSelf(%T) [symbolic]
  569. // CHECK:STDOUT: %I.lookup_impl_witness: <witness> = lookup_impl_witness %T, @I [symbolic]
  570. // CHECK:STDOUT: %.fa6: type = fn_type_with_self_type %I.WithSelf.Copy.type.035, %T [symbolic]
  571. // CHECK:STDOUT: %impl.elem0: %.fa6 = impl_witness_access %I.lookup_impl_witness, element0 [symbolic]
  572. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @I.WithSelf.Copy(%T) [symbolic]
  573. // CHECK:STDOUT: }
  574. // CHECK:STDOUT:
  575. // CHECK:STDOUT: generic fn @UseIndirect(%T.loc8_17.2: %I.type) {
  576. // CHECK:STDOUT: <elided>
  577. // CHECK:STDOUT:
  578. // CHECK:STDOUT: !definition:
  579. // CHECK:STDOUT: <elided>
  580. // 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)]
  581. // 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)]
  582. // 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)]
  583. // 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)]
  584. // 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)]
  585. // CHECK:STDOUT:
  586. // CHECK:STDOUT: fn(%x.param: @UseIndirect.%T.binding.as_type (%T.binding.as_type)) -> out %return.param: @UseIndirect.%T.binding.as_type (%T.binding.as_type) {
  587. // CHECK:STDOUT: !entry:
  588. // CHECK:STDOUT: %x.ref: @UseIndirect.%T.binding.as_type (%T.binding.as_type) = name_ref x, %x
  589. // CHECK:STDOUT: %T.ref.loc10: %I.type = name_ref T, %T.loc8_17.2 [symbolic = %T.loc8_17.1 (constants.%T)]
  590. // CHECK:STDOUT: %T.as_type.loc10: type = facet_access_type %T.ref.loc10 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  591. // CHECK:STDOUT: %.loc10_14.1: type = converted %T.ref.loc10, %T.as_type.loc10 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  592. // CHECK:STDOUT: %Copy.ref: %I.assoc_type = name_ref Copy, @I.WithSelf.%assoc0 [concrete = constants.%assoc0]
  593. // 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)]
  594. // CHECK:STDOUT: %bound_method.loc10_11: <bound method> = bound_method %x.ref, %impl.elem0.loc10_14.1
  595. // 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)]
  596. // CHECK:STDOUT: %bound_method.loc10_21: <bound method> = bound_method %x.ref, %specific_impl_fn.loc10_14.1
  597. // CHECK:STDOUT: <elided>
  598. // CHECK:STDOUT: %I.WithSelf.Copy.call: init @UseIndirect.%T.binding.as_type (%T.binding.as_type) to %.loc8_32.1 = call %bound_method.loc10_21(%x.ref)
  599. // CHECK:STDOUT: return %I.WithSelf.Copy.call to %return.param
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: specific @UseIndirect(constants.%T) {
  604. // CHECK:STDOUT: %T.loc8_17.1 => constants.%T
  605. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  606. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.422
  607. // CHECK:STDOUT: %.loc8_32.2 => constants.%.ff7
  608. // CHECK:STDOUT: }
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: --- access_constant_in_self_facet.carbon
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: constants {
  613. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  614. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic]
  615. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete]
  616. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete]
  617. // CHECK:STDOUT: %.Self.091: %A.type = symbolic_binding .Self [symbolic_self]
  618. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  619. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.091 [symbolic_self]
  620. // CHECK:STDOUT: %A.lookup_impl_witness.6a5: <witness> = lookup_impl_witness %.Self.091, @A [symbolic_self]
  621. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %A.lookup_impl_witness.6a5, element0 [symbolic_self]
  622. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  623. // CHECK:STDOUT: %A_where.type: type = facet_type <@A where %impl.elem0 = %empty_tuple.type> [concrete]
  624. // CHECK:STDOUT: %pattern_type.dc8: type = pattern_type %A_where.type [concrete]
  625. // CHECK:STDOUT: %AA: %A_where.type = symbolic_binding AA, 0 [symbolic]
  626. // CHECK:STDOUT: %AA.binding.as_type: type = symbolic_binding_type AA, 0, %AA [symbolic]
  627. // CHECK:STDOUT: %A.lookup_impl_witness.6c3: <witness> = lookup_impl_witness %AA, @A [symbolic]
  628. // CHECK:STDOUT: %A.facet: %A.type = facet_value %AA.binding.as_type, (%A.lookup_impl_witness.6c3) [symbolic]
  629. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  630. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  631. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  632. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: file {
  636. // CHECK:STDOUT: %A.decl: type = interface_decl @A [concrete = constants.%A.type] {} {}
  637. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  638. // CHECK:STDOUT: %AA.patt: %pattern_type.dc8 = symbolic_binding_pattern AA, 0 [concrete]
  639. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  640. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc6_33 [concrete]
  641. // CHECK:STDOUT: } {
  642. // CHECK:STDOUT: %AA.ref: %A_where.type = name_ref AA, %AA.loc6_8.2 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  643. // CHECK:STDOUT: %AA.as_type: type = facet_access_type %AA.ref [symbolic = %AA.binding.as_type (constants.%AA.binding.as_type)]
  644. // CHECK:STDOUT: %.loc6_33.1: type = converted %AA.ref, %AA.as_type [symbolic = %AA.binding.as_type (constants.%AA.binding.as_type)]
  645. // CHECK:STDOUT: %X.ref.loc6_33: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  646. // CHECK:STDOUT: %impl.elem0.loc6_33: type = impl_witness_access constants.%A.lookup_impl_witness.6c3, element0 [concrete = constants.%empty_tuple.type]
  647. // CHECK:STDOUT: %.loc6_33.2: Core.Form = init_form %impl.elem0.loc6_33 [concrete = constants.%.262]
  648. // CHECK:STDOUT: %.loc6_13.1: type = splice_block %.loc6_13.2 [concrete = constants.%A_where.type] {
  649. // CHECK:STDOUT: <elided>
  650. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  651. // CHECK:STDOUT: <elided>
  652. // CHECK:STDOUT: %.Self.ref: %A.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.091]
  653. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  654. // CHECK:STDOUT: %.loc6_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  655. // CHECK:STDOUT: %X.ref.loc6_19: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  656. // CHECK:STDOUT: %impl.elem0.loc6_19: type = impl_witness_access constants.%A.lookup_impl_witness.6a5, element0 [symbolic_self = constants.%impl.elem0]
  657. // CHECK:STDOUT: %.loc6_25.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  658. // CHECK:STDOUT: %.loc6_25.2: type = converted %.loc6_25.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  659. // CHECK:STDOUT: %.loc6_13.2: type = where_expr %.Self.2 [concrete = constants.%A_where.type] {
  660. // CHECK:STDOUT: requirement_base_facet_type constants.%A.type
  661. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc6_19, %.loc6_25.2
  662. // CHECK:STDOUT: }
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT: %AA.loc6_8.2: %A_where.type = symbolic_binding AA, 0 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  665. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  666. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  667. // CHECK:STDOUT: }
  668. // CHECK:STDOUT: }
  669. // CHECK:STDOUT:
  670. // CHECK:STDOUT: interface @A {
  671. // CHECK:STDOUT: %Self: %A.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  672. // CHECK:STDOUT: %A.WithSelf.decl = interface_with_self_decl @A [concrete]
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: !with Self:
  675. // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] {
  676. // CHECK:STDOUT: %assoc0: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete = constants.%assoc0]
  677. // CHECK:STDOUT: }
  678. // CHECK:STDOUT:
  679. // CHECK:STDOUT: !members:
  680. // CHECK:STDOUT: .Self = %Self
  681. // CHECK:STDOUT: .X = @X.%assoc0
  682. // CHECK:STDOUT: witness = (@A.WithSelf.%X)
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: !requires:
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: generic fn @F(%AA.loc6_8.2: %A_where.type) {
  688. // CHECK:STDOUT: %AA.loc6_8.1: %A_where.type = symbolic_binding AA, 0 [symbolic = %AA.loc6_8.1 (constants.%AA)]
  689. // CHECK:STDOUT: %AA.binding.as_type: type = symbolic_binding_type AA, 0, %AA.loc6_8.1 [symbolic = %AA.binding.as_type (constants.%AA.binding.as_type)]
  690. // CHECK:STDOUT:
  691. // CHECK:STDOUT: !definition:
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  694. // CHECK:STDOUT: !entry:
  695. // CHECK:STDOUT: %.loc7_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  696. // CHECK:STDOUT: %.loc7_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  697. // CHECK:STDOUT: %.loc7_12: init %empty_tuple.type = converted %.loc7_11.1, %.loc7_11.2 [concrete = constants.%empty_tuple]
  698. // CHECK:STDOUT: return %.loc7_12
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: specific @A.WithSelf(constants.%Self) {
  703. // CHECK:STDOUT: !definition:
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: specific @A.WithSelf(constants.%.Self.091) {
  707. // CHECK:STDOUT: !definition:
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: specific @A.WithSelf(constants.%AA) {
  711. // CHECK:STDOUT: !definition:
  712. // CHECK:STDOUT: }
  713. // CHECK:STDOUT:
  714. // CHECK:STDOUT: specific @A.WithSelf(constants.%A.facet) {
  715. // CHECK:STDOUT: !definition:
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: specific @F(constants.%AA) {
  719. // CHECK:STDOUT: %AA.loc6_8.1 => constants.%AA
  720. // CHECK:STDOUT: %AA.binding.as_type => constants.%AA.binding.as_type
  721. // CHECK:STDOUT: }
  722. // CHECK:STDOUT:
  723. // CHECK:STDOUT: --- access_constant_in_self_facet_with_multiple_interfaces.carbon
  724. // CHECK:STDOUT:
  725. // CHECK:STDOUT: constants {
  726. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  727. // CHECK:STDOUT: %A.assoc_type: type = assoc_entity_type @A [concrete]
  728. // CHECK:STDOUT: %assoc0.df7: %A.assoc_type = assoc_entity element0, @A.WithSelf.%X [concrete]
  729. // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete]
  730. // CHECK:STDOUT: %B.assoc_type: type = assoc_entity_type @B [concrete]
  731. // CHECK:STDOUT: %assoc0.6fa: %B.assoc_type = assoc_entity element0, @B.WithSelf.%Y [concrete]
  732. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  733. // CHECK:STDOUT: %BitAndWith.type.b10: type = facet_type <@BitAndWith, @BitAndWith(type)> [concrete]
  734. // CHECK:STDOUT: %BitAndWith.impl_witness: <witness> = impl_witness imports.%BitAndWith.impl_witness_table [concrete]
  735. // CHECK:STDOUT: %BitAndWith.facet: %BitAndWith.type.b10 = facet_value type, (%BitAndWith.impl_witness) [concrete]
  736. // CHECK:STDOUT: %BitAndWith.WithSelf.Op.type.4bd: type = fn_type @BitAndWith.WithSelf.Op, @BitAndWith.WithSelf(type, %BitAndWith.facet) [concrete]
  737. // CHECK:STDOUT: %.d15: type = fn_type_with_self_type %BitAndWith.WithSelf.Op.type.4bd, %BitAndWith.facet [concrete]
  738. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.type: type = fn_type @type.as.BitAndWith.impl.Op [concrete]
  739. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op: %type.as.BitAndWith.impl.Op.type = struct_value () [concrete]
  740. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.bound: <bound method> = bound_method %A.type, %type.as.BitAndWith.impl.Op [concrete]
  741. // CHECK:STDOUT: %facet_type.9bb: type = facet_type <@A & @B> [concrete]
  742. // CHECK:STDOUT: %.Self.e7e: %facet_type.9bb = symbolic_binding .Self [symbolic_self]
  743. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self.e7e [symbolic_self]
  744. // CHECK:STDOUT: %A.lookup_impl_witness.6b3: <witness> = lookup_impl_witness %.Self.e7e, @A [symbolic_self]
  745. // CHECK:STDOUT: %impl.elem0.eb8: type = impl_witness_access %A.lookup_impl_witness.6b3, element0 [symbolic_self]
  746. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  747. // CHECK:STDOUT: %B.lookup_impl_witness.d4f: <witness> = lookup_impl_witness %.Self.e7e, @B [symbolic_self]
  748. // CHECK:STDOUT: %impl.elem0.11d: type = impl_witness_access %B.lookup_impl_witness.d4f, element0 [symbolic_self]
  749. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  750. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  751. // 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]
  752. // CHECK:STDOUT: %pattern_type.77e: type = pattern_type %facet_type.82c [concrete]
  753. // CHECK:STDOUT: %AB: %facet_type.82c = symbolic_binding AB, 0 [symbolic]
  754. // CHECK:STDOUT: %AB.binding.as_type: type = symbolic_binding_type AB, 0, %AB [symbolic]
  755. // CHECK:STDOUT: %A.lookup_impl_witness.1b9: <witness> = lookup_impl_witness %AB, @A [symbolic]
  756. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  757. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  758. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  759. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  760. // CHECK:STDOUT: %B.lookup_impl_witness.97b: <witness> = lookup_impl_witness %AB, @B [symbolic]
  761. // CHECK:STDOUT: %.469: Core.Form = init_form %empty_struct_type [concrete]
  762. // CHECK:STDOUT: %pattern_type.a96: type = pattern_type %empty_struct_type [concrete]
  763. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  764. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: imports {
  768. // 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]
  769. // CHECK:STDOUT: %BitAndWith.impl_witness_table = impl_witness_table (%Core.import_ref.8d3), @type.as.BitAndWith.impl [concrete]
  770. // CHECK:STDOUT: }
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: file {
  773. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  774. // CHECK:STDOUT: %AB.patt: %pattern_type.77e = symbolic_binding_pattern AB, 0 [concrete]
  775. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  776. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc14_49 [concrete]
  777. // CHECK:STDOUT: } {
  778. // CHECK:STDOUT: %AB.ref: %facet_type.82c = name_ref AB, %AB.loc14_8.2 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  779. // CHECK:STDOUT: %AB.as_type: type = facet_access_type %AB.ref [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  780. // CHECK:STDOUT: %.loc14_49.1: type = converted %AB.ref, %AB.as_type [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  781. // CHECK:STDOUT: %X.ref.loc14_49: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  782. // CHECK:STDOUT: %impl.elem0.loc14_49: type = impl_witness_access constants.%A.lookup_impl_witness.1b9, element0 [concrete = constants.%empty_tuple.type]
  783. // CHECK:STDOUT: %.loc14_49.2: Core.Form = init_form %impl.elem0.loc14_49 [concrete = constants.%.262]
  784. // CHECK:STDOUT: %.loc14_17.1: type = splice_block %.loc14_17.2 [concrete = constants.%facet_type.82c] {
  785. // CHECK:STDOUT: <elided>
  786. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  787. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type]
  788. // CHECK:STDOUT: %impl.elem0.loc14_13: %.d15 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
  789. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %A.ref, %impl.elem0.loc14_13 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
  790. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%A.ref, %B.ref) [concrete = constants.%facet_type.9bb]
  791. // CHECK:STDOUT: %.loc14_13.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type.9bb]
  792. // CHECK:STDOUT: %.loc14_13.2: type = converted %type.as.BitAndWith.impl.Op.call, %.loc14_13.1 [concrete = constants.%facet_type.9bb]
  793. // CHECK:STDOUT: <elided>
  794. // CHECK:STDOUT: %.Self.ref.loc14_23: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  795. // CHECK:STDOUT: %.Self.as_type.loc14_23: type = facet_access_type %.Self.ref.loc14_23 [symbolic_self = constants.%.Self.binding.as_type]
  796. // CHECK:STDOUT: %.loc14_23: type = converted %.Self.ref.loc14_23, %.Self.as_type.loc14_23 [symbolic_self = constants.%.Self.binding.as_type]
  797. // CHECK:STDOUT: %X.ref.loc14_23: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  798. // CHECK:STDOUT: %impl.elem0.loc14_23: type = impl_witness_access constants.%A.lookup_impl_witness.6b3, element0 [symbolic_self = constants.%impl.elem0.eb8]
  799. // CHECK:STDOUT: %.loc14_29.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  800. // CHECK:STDOUT: %.loc14_29.2: type = converted %.loc14_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  801. // CHECK:STDOUT: %.Self.ref.loc14_35: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  802. // CHECK:STDOUT: %.Self.as_type.loc14_35: type = facet_access_type %.Self.ref.loc14_35 [symbolic_self = constants.%.Self.binding.as_type]
  803. // CHECK:STDOUT: %.loc14_35: type = converted %.Self.ref.loc14_35, %.Self.as_type.loc14_35 [symbolic_self = constants.%.Self.binding.as_type]
  804. // CHECK:STDOUT: %Y.ref: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  805. // CHECK:STDOUT: %impl.elem0.loc14_35: type = impl_witness_access constants.%B.lookup_impl_witness.d4f, element0 [symbolic_self = constants.%impl.elem0.11d]
  806. // CHECK:STDOUT: %.loc14_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  807. // CHECK:STDOUT: %.loc14_41.2: type = converted %.loc14_41.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  808. // CHECK:STDOUT: %.loc14_17.2: type = where_expr %.Self.2 [concrete = constants.%facet_type.82c] {
  809. // CHECK:STDOUT: requirement_base_facet_type constants.%facet_type.9bb
  810. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc14_23, %.loc14_29.2
  811. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc14_35, %.loc14_41.2
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: %AB.loc14_8.2: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  815. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  816. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  817. // CHECK:STDOUT: }
  818. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  819. // CHECK:STDOUT: %AB.patt: %pattern_type.77e = symbolic_binding_pattern AB, 0 [concrete]
  820. // CHECK:STDOUT: %return.param_patt: %pattern_type.a96 = out_param_pattern [concrete]
  821. // CHECK:STDOUT: %return.patt: %pattern_type.a96 = return_slot_pattern %return.param_patt, %impl.elem0.loc18_49 [concrete]
  822. // CHECK:STDOUT: } {
  823. // CHECK:STDOUT: %AB.ref: %facet_type.82c = name_ref AB, %AB.loc18_8.2 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  824. // CHECK:STDOUT: %AB.as_type: type = facet_access_type %AB.ref [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  825. // CHECK:STDOUT: %.loc18_49.1: type = converted %AB.ref, %AB.as_type [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  826. // CHECK:STDOUT: %Y.ref.loc18_49: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  827. // CHECK:STDOUT: %impl.elem0.loc18_49: type = impl_witness_access constants.%B.lookup_impl_witness.97b, element0 [concrete = constants.%empty_struct_type]
  828. // CHECK:STDOUT: %.loc18_49.2: Core.Form = init_form %impl.elem0.loc18_49 [concrete = constants.%.469]
  829. // CHECK:STDOUT: %.loc18_17.1: type = splice_block %.loc18_17.2 [concrete = constants.%facet_type.82c] {
  830. // CHECK:STDOUT: <elided>
  831. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [concrete = constants.%A.type]
  832. // CHECK:STDOUT: %B.ref: type = name_ref B, file.%B.decl [concrete = constants.%B.type]
  833. // CHECK:STDOUT: %impl.elem0.loc18_13: %.d15 = impl_witness_access constants.%BitAndWith.impl_witness, element0 [concrete = constants.%type.as.BitAndWith.impl.Op]
  834. // CHECK:STDOUT: %bound_method: <bound method> = bound_method %A.ref, %impl.elem0.loc18_13 [concrete = constants.%type.as.BitAndWith.impl.Op.bound]
  835. // CHECK:STDOUT: %type.as.BitAndWith.impl.Op.call: init type = call %bound_method(%A.ref, %B.ref) [concrete = constants.%facet_type.9bb]
  836. // CHECK:STDOUT: %.loc18_13.1: type = value_of_initializer %type.as.BitAndWith.impl.Op.call [concrete = constants.%facet_type.9bb]
  837. // CHECK:STDOUT: %.loc18_13.2: type = converted %type.as.BitAndWith.impl.Op.call, %.loc18_13.1 [concrete = constants.%facet_type.9bb]
  838. // CHECK:STDOUT: <elided>
  839. // CHECK:STDOUT: %.Self.ref.loc18_23: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  840. // CHECK:STDOUT: %.Self.as_type.loc18_23: type = facet_access_type %.Self.ref.loc18_23 [symbolic_self = constants.%.Self.binding.as_type]
  841. // CHECK:STDOUT: %.loc18_23: type = converted %.Self.ref.loc18_23, %.Self.as_type.loc18_23 [symbolic_self = constants.%.Self.binding.as_type]
  842. // CHECK:STDOUT: %X.ref: %A.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0.df7]
  843. // CHECK:STDOUT: %impl.elem0.loc18_23: type = impl_witness_access constants.%A.lookup_impl_witness.6b3, element0 [symbolic_self = constants.%impl.elem0.eb8]
  844. // CHECK:STDOUT: %.loc18_29.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  845. // CHECK:STDOUT: %.loc18_29.2: type = converted %.loc18_29.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  846. // CHECK:STDOUT: %.Self.ref.loc18_35: %facet_type.9bb = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.e7e]
  847. // CHECK:STDOUT: %.Self.as_type.loc18_35: type = facet_access_type %.Self.ref.loc18_35 [symbolic_self = constants.%.Self.binding.as_type]
  848. // CHECK:STDOUT: %.loc18_35: type = converted %.Self.ref.loc18_35, %.Self.as_type.loc18_35 [symbolic_self = constants.%.Self.binding.as_type]
  849. // CHECK:STDOUT: %Y.ref.loc18_35: %B.assoc_type = name_ref Y, @Y.%assoc0 [concrete = constants.%assoc0.6fa]
  850. // CHECK:STDOUT: %impl.elem0.loc18_35: type = impl_witness_access constants.%B.lookup_impl_witness.d4f, element0 [symbolic_self = constants.%impl.elem0.11d]
  851. // CHECK:STDOUT: %.loc18_41.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  852. // CHECK:STDOUT: %.loc18_41.2: type = converted %.loc18_41.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  853. // CHECK:STDOUT: %.loc18_17.2: type = where_expr %.Self.2 [concrete = constants.%facet_type.82c] {
  854. // CHECK:STDOUT: requirement_base_facet_type constants.%facet_type.9bb
  855. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18_23, %.loc18_29.2
  856. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc18_35, %.loc18_41.2
  857. // CHECK:STDOUT: }
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT: %AB.loc18_8.2: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  860. // CHECK:STDOUT: %return.param: ref %empty_struct_type = out_param call_param0
  861. // CHECK:STDOUT: %return: ref %empty_struct_type = return_slot %return.param
  862. // CHECK:STDOUT: }
  863. // CHECK:STDOUT: }
  864. // CHECK:STDOUT:
  865. // CHECK:STDOUT: generic fn @F(%AB.loc14_8.2: %facet_type.82c) {
  866. // CHECK:STDOUT: %AB.loc14_8.1: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc14_8.1 (constants.%AB)]
  867. // CHECK:STDOUT: %AB.binding.as_type: type = symbolic_binding_type AB, 0, %AB.loc14_8.1 [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  868. // CHECK:STDOUT:
  869. // CHECK:STDOUT: !definition:
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  872. // CHECK:STDOUT: !entry:
  873. // CHECK:STDOUT: %.loc15_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  874. // CHECK:STDOUT: %.loc15_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  875. // CHECK:STDOUT: %.loc15_12: init %empty_tuple.type = converted %.loc15_11.1, %.loc15_11.2 [concrete = constants.%empty_tuple]
  876. // CHECK:STDOUT: return %.loc15_12
  877. // CHECK:STDOUT: }
  878. // CHECK:STDOUT: }
  879. // CHECK:STDOUT:
  880. // CHECK:STDOUT: generic fn @G(%AB.loc18_8.2: %facet_type.82c) {
  881. // CHECK:STDOUT: %AB.loc18_8.1: %facet_type.82c = symbolic_binding AB, 0 [symbolic = %AB.loc18_8.1 (constants.%AB)]
  882. // CHECK:STDOUT: %AB.binding.as_type: type = symbolic_binding_type AB, 0, %AB.loc18_8.1 [symbolic = %AB.binding.as_type (constants.%AB.binding.as_type)]
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: !definition:
  885. // CHECK:STDOUT:
  886. // CHECK:STDOUT: fn() -> out %return.param: %empty_struct_type {
  887. // CHECK:STDOUT: !entry:
  888. // CHECK:STDOUT: %.loc19_11.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  889. // CHECK:STDOUT: %.loc19_11.2: init %empty_struct_type = struct_init () [concrete = constants.%empty_struct]
  890. // CHECK:STDOUT: %.loc19_12: init %empty_struct_type = converted %.loc19_11.1, %.loc19_11.2 [concrete = constants.%empty_struct]
  891. // CHECK:STDOUT: return %.loc19_12
  892. // CHECK:STDOUT: }
  893. // CHECK:STDOUT: }
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: specific @F(constants.%AB) {
  896. // CHECK:STDOUT: %AB.loc14_8.1 => constants.%AB
  897. // CHECK:STDOUT: %AB.binding.as_type => constants.%AB.binding.as_type
  898. // CHECK:STDOUT: }
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: specific @G(constants.%AB) {
  901. // CHECK:STDOUT: %AB.loc18_8.1 => constants.%AB
  902. // CHECK:STDOUT: %AB.binding.as_type => constants.%AB.binding.as_type
  903. // CHECK:STDOUT: }
  904. // CHECK:STDOUT: