require.carbon 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912
  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/named_constraint/require.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/named_constraint/require.carbon
  12. // --- fail_todo_extend.carbon
  13. library "[[@TEST_NAME]]";
  14. interface Y {
  15. fn YY();
  16. }
  17. //@dump-sem-ir-begin
  18. constraint Z {
  19. extend require impls Y;
  20. }
  21. //@dump-sem-ir-end
  22. fn F(T:! Z) {
  23. // CHECK:STDERR: fail_todo_extend.carbon:[[@LINE+4]]:3: error: member name `YY` not found [MemberNameNotFound]
  24. // CHECK:STDERR: T.YY();
  25. // CHECK:STDERR: ^~~~
  26. // CHECK:STDERR:
  27. T.YY();
  28. T.(Y.YY)();
  29. }
  30. // --- implicit_self_impls.carbon
  31. library "[[@TEST_NAME]]";
  32. interface Y {
  33. fn YY();
  34. }
  35. //@dump-sem-ir-begin
  36. constraint Z {
  37. require impls Y;
  38. }
  39. //@dump-sem-ir-end
  40. fn F(T:! Z) {
  41. T.(Y.YY)();
  42. }
  43. // --- explicit_self_impls.carbon
  44. library "[[@TEST_NAME]]";
  45. interface Y {
  46. fn YY();
  47. }
  48. //@dump-sem-ir-begin
  49. constraint Z {
  50. require Self impls Y;
  51. }
  52. //@dump-sem-ir-end
  53. fn F(T:! Z) {
  54. T.(Y.YY)();
  55. }
  56. // --- fail_implicit_self_no_extend_name_lookup_fails.carbon
  57. library "[[@TEST_NAME]]";
  58. interface Y {
  59. fn YY();
  60. }
  61. constraint Z {
  62. require impls Y;
  63. }
  64. fn F(T:! Z) {
  65. // This should fail name lookup since Z does not extend Y.
  66. //
  67. // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found [MemberNameNotFound]
  68. // CHECK:STDERR: T.YY();
  69. // CHECK:STDERR: ^~~~
  70. // CHECK:STDERR:
  71. T.YY();
  72. }
  73. // --- fail_explicit_self_no_extend_name_lookup_fails.carbon
  74. library "[[@TEST_NAME]]";
  75. interface Y {
  76. fn YY();
  77. }
  78. constraint Z {
  79. require Self impls Y;
  80. }
  81. fn F(T:! Z) {
  82. // This should fail name lookup since Z does not extend Y.
  83. //
  84. // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found [MemberNameNotFound]
  85. // CHECK:STDERR: T.YY();
  86. // CHECK:STDERR: ^~~~
  87. // CHECK:STDERR:
  88. T.YY();
  89. }
  90. // --- explicit_self_specific_impls.carbon
  91. library "[[@TEST_NAME]]";
  92. interface Y {}
  93. class C(T:! type);
  94. //@dump-sem-ir-begin
  95. constraint Z {
  96. require C(Self) impls Y;
  97. }
  98. //@dump-sem-ir-end
  99. // --- require_impls_where.carbon
  100. library "[[@TEST_NAME]]";
  101. interface Y { let Y1:! type; }
  102. //@dump-sem-ir-begin
  103. constraint Z {
  104. require impls Y where .Y1 = ();
  105. }
  106. //@dump-sem-ir-end
  107. // --- fail_require_impls_incomplete_constraint.carbon
  108. library "[[@TEST_NAME]]";
  109. constraint Y;
  110. //@dump-sem-ir-begin
  111. constraint Z {
  112. // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `Y` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  113. // CHECK:STDERR: require impls Y;
  114. // CHECK:STDERR: ^
  115. // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  116. // CHECK:STDERR: constraint Y;
  117. // CHECK:STDERR: ^~~~~~~~~~~~~
  118. // CHECK:STDERR:
  119. require impls Y;
  120. }
  121. //@dump-sem-ir-end
  122. // --- fail_require_impls_incomplete_self.carbon
  123. library "[[@TEST_NAME]]";
  124. //@dump-sem-ir-begin
  125. constraint Z {
  126. // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE+7]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  127. // CHECK:STDERR: require impls Z;
  128. // CHECK:STDERR: ^
  129. // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE-4]]:1: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition]
  130. // CHECK:STDERR: constraint Z {
  131. // CHECK:STDERR: ^~~~~~~~~~~~~~
  132. // CHECK:STDERR:
  133. require impls Z;
  134. }
  135. //@dump-sem-ir-end
  136. // --- fail_require_impls_incomplete_self_specific.carbon
  137. library "[[@TEST_NAME]]";
  138. //@dump-sem-ir-begin
  139. constraint Z(T:! type) {
  140. // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE+7]]:19: error: facet type `Z(Self)` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  141. // CHECK:STDERR: require T impls Z(Self);
  142. // CHECK:STDERR: ^~~~~~~
  143. // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE-4]]:1: note: constraint is currently being defined [NamedConstraintIncompleteWithinDefinition]
  144. // CHECK:STDERR: constraint Z(T:! type) {
  145. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  146. // CHECK:STDERR:
  147. require T impls Z(Self);
  148. }
  149. //@dump-sem-ir-end
  150. // --- fail_require_impls_without_self.carbon
  151. library "[[@TEST_NAME]]";
  152. interface Y {
  153. let Y1:! type;
  154. }
  155. //@dump-sem-ir-begin
  156. constraint Z(T:! type) {
  157. // Either the type `T` or the facet type `Y` must mention `Self` in a way that
  158. // it would appear in the type structure used for impl lookup (so inside a
  159. // `where` does not count). But they don't.
  160. //
  161. // CHECK:STDERR: fail_require_impls_without_self.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic parameter for each `interface` or `constraint` [RequireImplsMissingSelf]
  162. // CHECK:STDERR: require T impls Y where .Y1 = Self;
  163. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  164. // CHECK:STDERR:
  165. require T impls Y where .Y1 = Self;
  166. }
  167. //@dump-sem-ir-end
  168. // --- fail_require_impls_without_self_in_one_interface.carbon
  169. library "[[@TEST_NAME]]";
  170. interface Y(T:! type) {}
  171. constraint Z(T:! type) {
  172. // Self is in one interface but not the other.
  173. //
  174. // CHECK:STDERR: fail_require_impls_without_self_in_one_interface.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic parameter for each `interface` or `constraint` [RequireImplsMissingSelf]
  175. // CHECK:STDERR: require T impls Y(Self) & Y({});
  176. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  177. // CHECK:STDERR:
  178. require T impls Y(Self) & Y({});
  179. }
  180. // --- fail_self_impls_self.carbon
  181. library "[[@TEST_NAME]]";
  182. constraint Z(T:! type) {
  183. // CHECK:STDERR: fail_self_impls_self.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType]
  184. // CHECK:STDERR: require impls Self;
  185. // CHECK:STDERR: ^~~~
  186. // CHECK:STDERR:
  187. require impls Self;
  188. }
  189. // --- fail_impls_type.carbon
  190. library "[[@TEST_NAME]]";
  191. class C(T:! type) {}
  192. constraint Z(T:! type) {
  193. // CHECK:STDERR: fail_impls_type.carbon:[[@LINE+4]]:19: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType]
  194. // CHECK:STDERR: require T impls C(Self);
  195. // CHECK:STDERR: ^~~~~~~
  196. // CHECK:STDERR:
  197. require T impls C(Self);
  198. }
  199. // --- fail_non_type_impls.carbon
  200. library "[[@TEST_NAME]]";
  201. interface Y {}
  202. constraint Z(T:! type) {
  203. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+7]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
  204. // CHECK:STDERR: require 1 impls Y;
  205. // CHECK:STDERR: ^
  206. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  207. // CHECK:STDERR: require 1 impls Y;
  208. // CHECK:STDERR: ^
  209. // CHECK:STDERR:
  210. require 1 impls Y;
  211. }
  212. // --- fail_impls_non_type.carbon
  213. library "[[@TEST_NAME]]";
  214. interface Y {}
  215. constraint Z(T:! type) {
  216. // CHECK:STDERR: fail_impls_non_type.carbon:[[@LINE+4]]:17: error: `require` declaration constrained by a non-facet type; expected an `interface` or `constraint` name after `impls` [RequireImplsMissingFacetType]
  217. // CHECK:STDERR: require impls 1;
  218. // CHECK:STDERR: ^
  219. // CHECK:STDERR:
  220. require impls 1;
  221. }
  222. // --- require_self_in_requirement.carbon
  223. library "[[@TEST_NAME]]";
  224. interface Y {
  225. let Y1:! type;
  226. }
  227. //@dump-sem-ir-begin
  228. constraint Z {
  229. // Self can appear in a requirement.
  230. require impls Y where .Y1 = Self;
  231. }
  232. //@dump-sem-ir-end
  233. // --- require_self.carbon
  234. library "[[@TEST_NAME]]";
  235. interface Z(T:! type) {}
  236. constraint N {
  237. require impls Z(Self);
  238. }
  239. impl () as Z(()) {}
  240. fn F() {
  241. () as N;
  242. }
  243. // --- fail_require_different_self.carbon
  244. library "[[@TEST_NAME]]";
  245. interface Z(T:! type) {}
  246. constraint N {
  247. require impls Z(Self);
  248. }
  249. impl () as Z({}) {}
  250. fn F() {
  251. // N requires () impls Z(Self) which is Z(()) for this query, but it impls
  252. // Z({}).
  253. //
  254. // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  255. // CHECK:STDERR: () as N;
  256. // CHECK:STDERR: ^~~~~~~
  257. // CHECK:STDERR:
  258. () as N;
  259. }
  260. // --- fail_require_different_parameter.carbon
  261. library "[[@TEST_NAME]]";
  262. interface Z(T:! type) {}
  263. constraint N {
  264. require impls Z({});
  265. }
  266. impl () as Z(()) {}
  267. fn F() {
  268. // N requires () impls Z({}) but it impls Z(()).
  269. //
  270. // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  271. // CHECK:STDERR: () as N;
  272. // CHECK:STDERR: ^~~~~~~
  273. // CHECK:STDERR:
  274. () as N;
  275. }
  276. // --- require_different_type_impls.carbon
  277. library "[[@TEST_NAME]]";
  278. interface Z(T:! type) {}
  279. constraint N {
  280. require {} impls Z(Self);
  281. }
  282. impl {} as Z(()) {}
  283. fn F() {
  284. () as N;
  285. }
  286. // --- fail_require_different_type_impls_different_parameter.carbon
  287. library "[[@TEST_NAME]]";
  288. interface Z(T:! type) {}
  289. constraint N {
  290. require {} impls Z(Self);
  291. }
  292. impl {} as Z({}) {}
  293. fn F() {
  294. // N requires {} impls Z(Self) which is Z(()) for this query, but it impls
  295. // Z({}).
  296. //
  297. // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  298. // CHECK:STDERR: () as N;
  299. // CHECK:STDERR: ^~~~~~~
  300. // CHECK:STDERR:
  301. () as N;
  302. }
  303. // --- require_with_rewrite_constraint.carbon
  304. library "[[@TEST_NAME]]";
  305. interface Z(T:! type) {
  306. let X:! type;
  307. }
  308. constraint N {
  309. require {} impls Z(Self) where .X = Self;
  310. }
  311. // Will satisfy `() as N`.
  312. impl {} as Z(()) where .X = () {}
  313. fn F() {
  314. () as N;
  315. }
  316. // --- todo_fail_require_with_mismatching_rewrite_constraint.carbon
  317. library "[[@TEST_NAME]]";
  318. interface Z(T:! type) {
  319. let X:! type;
  320. }
  321. constraint N {
  322. require {} impls Z(Self) where .X = Self;
  323. }
  324. // Will not satisfy `() as N` as the rewrite does not match.
  325. impl {} as Z(()) where .X = {} {}
  326. fn F() {
  327. // TODO: Should fail, but we're currently checking the requirements of `N`
  328. // rather than of the identified facet type of `N` (which would include the
  329. // require decl's requirements).
  330. () as N;
  331. }
  332. // CHECK:STDOUT: --- fail_todo_extend.carbon
  333. // CHECK:STDOUT:
  334. // CHECK:STDOUT: constants {
  335. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  336. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  337. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  338. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  339. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  340. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT:
  343. // CHECK:STDOUT: imports {
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT:
  346. // CHECK:STDOUT: file {
  347. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  348. // CHECK:STDOUT: }
  349. // CHECK:STDOUT:
  350. // CHECK:STDOUT: constraint @Z {
  351. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  352. // CHECK:STDOUT: %Z.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.Self.binding.as_type.impls.Y.type.require [concrete] {
  353. // CHECK:STDOUT: require %Self.as_type impls %Y.ref
  354. // CHECK:STDOUT: } {
  355. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  356. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  357. // CHECK:STDOUT: }
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: !members:
  360. // CHECK:STDOUT: .Self = %Self
  361. // CHECK:STDOUT: .Y = <poisoned>
  362. // CHECK:STDOUT:
  363. // CHECK:STDOUT: !requires:
  364. // CHECK:STDOUT: @Z.Self.binding.as_type.impls.Y.type.require {
  365. // CHECK:STDOUT: require @Z.Self.binding.as_type.impls.Y.type.require.%Self.as_type impls @Z.Self.binding.as_type.impls.Y.type.require.%Y.ref
  366. // CHECK:STDOUT: }
  367. // CHECK:STDOUT: }
  368. // CHECK:STDOUT:
  369. // CHECK:STDOUT: generic require @Z.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  370. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  371. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  372. // CHECK:STDOUT: }
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  375. // CHECK:STDOUT: %Self => constants.%Self.550
  376. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  377. // CHECK:STDOUT: }
  378. // CHECK:STDOUT:
  379. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  380. // CHECK:STDOUT: %Self => constants.%T
  381. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  382. // CHECK:STDOUT: }
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: --- implicit_self_impls.carbon
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: constants {
  387. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  388. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  389. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  390. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  391. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  392. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: imports {
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: file {
  399. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  400. // CHECK:STDOUT: }
  401. // CHECK:STDOUT:
  402. // CHECK:STDOUT: constraint @Z {
  403. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  404. // CHECK:STDOUT: %Z.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.Self.binding.as_type.impls.Y.type.require [concrete] {
  405. // CHECK:STDOUT: require %Self.as_type impls %Y.ref
  406. // CHECK:STDOUT: } {
  407. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  408. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  409. // CHECK:STDOUT: }
  410. // CHECK:STDOUT:
  411. // CHECK:STDOUT: !members:
  412. // CHECK:STDOUT: .Self = %Self
  413. // CHECK:STDOUT: .Y = <poisoned>
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: !requires:
  416. // CHECK:STDOUT: @Z.Self.binding.as_type.impls.Y.type.require {
  417. // CHECK:STDOUT: require @Z.Self.binding.as_type.impls.Y.type.require.%Self.as_type impls @Z.Self.binding.as_type.impls.Y.type.require.%Y.ref
  418. // CHECK:STDOUT: }
  419. // CHECK:STDOUT: }
  420. // CHECK:STDOUT:
  421. // CHECK:STDOUT: generic require @Z.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  422. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  423. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT:
  426. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  427. // CHECK:STDOUT: %Self => constants.%Self.550
  428. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  429. // CHECK:STDOUT: }
  430. // CHECK:STDOUT:
  431. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  432. // CHECK:STDOUT: %Self => constants.%T
  433. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  434. // CHECK:STDOUT: }
  435. // CHECK:STDOUT:
  436. // CHECK:STDOUT: --- explicit_self_impls.carbon
  437. // CHECK:STDOUT:
  438. // CHECK:STDOUT: constants {
  439. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  440. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  441. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  442. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  443. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  444. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  445. // CHECK:STDOUT: }
  446. // CHECK:STDOUT:
  447. // CHECK:STDOUT: imports {
  448. // CHECK:STDOUT: }
  449. // CHECK:STDOUT:
  450. // CHECK:STDOUT: file {
  451. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  452. // CHECK:STDOUT: }
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: constraint @Z {
  455. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  456. // CHECK:STDOUT: %Z.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.Self.binding.as_type.impls.Y.type.require [concrete] {
  457. // CHECK:STDOUT: require %.loc9 impls %Y.ref
  458. // CHECK:STDOUT: } {
  459. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  460. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  461. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  462. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: !members:
  466. // CHECK:STDOUT: .Self = %Self
  467. // CHECK:STDOUT: .Y = <poisoned>
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: !requires:
  470. // CHECK:STDOUT: @Z.Self.binding.as_type.impls.Y.type.require {
  471. // CHECK:STDOUT: require @Z.Self.binding.as_type.impls.Y.type.require.%.loc9 impls @Z.Self.binding.as_type.impls.Y.type.require.%Y.ref
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT: }
  474. // CHECK:STDOUT:
  475. // CHECK:STDOUT: generic require @Z.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  476. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  477. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  481. // CHECK:STDOUT: %Self => constants.%Self.550
  482. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  483. // CHECK:STDOUT: }
  484. // CHECK:STDOUT:
  485. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  486. // CHECK:STDOUT: %Self => constants.%T
  487. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  488. // CHECK:STDOUT: }
  489. // CHECK:STDOUT:
  490. // CHECK:STDOUT: --- explicit_self_specific_impls.carbon
  491. // CHECK:STDOUT:
  492. // CHECK:STDOUT: constants {
  493. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  494. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  495. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  496. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  497. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  498. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  499. // CHECK:STDOUT: %C.237: type = class_type @C, @C(%Self.binding.as_type) [symbolic]
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: imports {
  503. // CHECK:STDOUT: }
  504. // CHECK:STDOUT:
  505. // CHECK:STDOUT: file {
  506. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: constraint @Z {
  510. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  511. // CHECK:STDOUT: %Z.C.impls.Y.type.require.decl = require_decl @Z.C.impls.Y.type.require [concrete] {
  512. // CHECK:STDOUT: require %C.loc9_17.1 impls %Y.ref
  513. // CHECK:STDOUT: } {
  514. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  515. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  516. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  517. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  518. // CHECK:STDOUT: %C.loc9_17.1: type = class_type @C, @C(constants.%Self.binding.as_type) [symbolic = %C.loc9_17.2 (constants.%C.237)]
  519. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: !members:
  523. // CHECK:STDOUT: .Self = %Self
  524. // CHECK:STDOUT: .C = <poisoned>
  525. // CHECK:STDOUT: .Y = <poisoned>
  526. // CHECK:STDOUT:
  527. // CHECK:STDOUT: !requires:
  528. // CHECK:STDOUT: @Z.C.impls.Y.type.require {
  529. // CHECK:STDOUT: require @Z.C.impls.Y.type.require.%C.loc9_17.1 impls @Z.C.impls.Y.type.require.%Y.ref
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT: }
  532. // CHECK:STDOUT:
  533. // CHECK:STDOUT: generic require @Z.C.impls.Y.type.require(@Z.%Self: %Z.type) {
  534. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  535. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  536. // CHECK:STDOUT: %C.loc9_17.2: type = class_type @C, @C(%Self.binding.as_type) [symbolic = %C.loc9_17.2 (constants.%C.237)]
  537. // CHECK:STDOUT: }
  538. // CHECK:STDOUT:
  539. // CHECK:STDOUT: specific @Z.C.impls.Y.type.require(constants.%Self.550) {
  540. // CHECK:STDOUT: %Self => constants.%Self.550
  541. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  542. // CHECK:STDOUT: %C.loc9_17.2 => constants.%C.237
  543. // CHECK:STDOUT: }
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: --- require_impls_where.carbon
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: constants {
  548. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  549. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  550. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.%Y1 [concrete]
  551. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  552. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  553. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  554. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  555. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  556. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  557. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  558. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  559. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  560. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %empty_tuple.type> [concrete]
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: imports {
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: file {
  567. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: constraint @Z {
  571. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  572. // CHECK:STDOUT: %Z.Self.binding.as_type.impls.Y_where.type.require.decl = require_decl @Z.Self.binding.as_type.impls.Y_where.type.require [concrete] {
  573. // CHECK:STDOUT: require %Self.as_type impls %.loc7_19
  574. // CHECK:STDOUT: } {
  575. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  576. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  577. // CHECK:STDOUT: <elided>
  578. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  579. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  580. // CHECK:STDOUT: %.loc7_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  581. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  582. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  583. // CHECK:STDOUT: %.loc7_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  584. // CHECK:STDOUT: %.loc7_32.2: type = converted %.loc7_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  585. // CHECK:STDOUT: %.loc7_19: type = where_expr %.Self [concrete = constants.%Y_where.type] {
  586. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  587. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc7_32.2
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: !members:
  592. // CHECK:STDOUT: .Self = %Self
  593. // CHECK:STDOUT: .Y = <poisoned>
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: !requires:
  596. // CHECK:STDOUT: @Z.Self.binding.as_type.impls.Y_where.type.require {
  597. // CHECK:STDOUT: require @Z.Self.binding.as_type.impls.Y_where.type.require.%Self.as_type impls @Z.Self.binding.as_type.impls.Y_where.type.require.%.loc7_19
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: generic require @Z.Self.binding.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  602. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  603. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  604. // CHECK:STDOUT: }
  605. // CHECK:STDOUT:
  606. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y_where.type.require(constants.%Self.550) {
  607. // CHECK:STDOUT: %Self => constants.%Self.550
  608. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT:
  611. // CHECK:STDOUT: --- fail_require_impls_incomplete_constraint.carbon
  612. // CHECK:STDOUT:
  613. // CHECK:STDOUT: constants {
  614. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  615. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic]
  616. // CHECK:STDOUT: }
  617. // CHECK:STDOUT:
  618. // CHECK:STDOUT: imports {
  619. // CHECK:STDOUT: }
  620. // CHECK:STDOUT:
  621. // CHECK:STDOUT: file {
  622. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: constraint @Z {
  626. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  627. // CHECK:STDOUT:
  628. // CHECK:STDOUT: !members:
  629. // CHECK:STDOUT: .Self = %Self
  630. // CHECK:STDOUT: .Y = <poisoned>
  631. // CHECK:STDOUT:
  632. // CHECK:STDOUT: !requires:
  633. // CHECK:STDOUT: }
  634. // CHECK:STDOUT:
  635. // CHECK:STDOUT: --- fail_require_impls_incomplete_self.carbon
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: constants {
  638. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  639. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic]
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT:
  642. // CHECK:STDOUT: imports {
  643. // CHECK:STDOUT: }
  644. // CHECK:STDOUT:
  645. // CHECK:STDOUT: file {
  646. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  647. // CHECK:STDOUT: }
  648. // CHECK:STDOUT:
  649. // CHECK:STDOUT: constraint @Z {
  650. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: !members:
  653. // CHECK:STDOUT: .Self = %Self
  654. // CHECK:STDOUT: .Z = <poisoned>
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: !requires:
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: --- fail_require_impls_incomplete_self_specific.carbon
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: constants {
  662. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  663. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  664. // CHECK:STDOUT: %Z.type.7a8: type = generic_named_constaint_type @Z [concrete]
  665. // CHECK:STDOUT: %empty_struct: %Z.type.7a8 = struct_value () [concrete]
  666. // CHECK:STDOUT: %Z.type.d682d6.1: type = facet_type <@Z, @Z(%T)> [symbolic]
  667. // CHECK:STDOUT: %Self: %Z.type.d682d6.1 = symbolic_binding Self, 1 [symbolic]
  668. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 1, %Self [symbolic]
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: imports {
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: file {
  675. // CHECK:STDOUT: %Z.decl: %Z.type.7a8 = constraint_decl @Z [concrete = constants.%empty_struct] {
  676. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  677. // CHECK:STDOUT: } {
  678. // CHECK:STDOUT: <elided>
  679. // CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT: }
  682. // CHECK:STDOUT:
  683. // CHECK:STDOUT: generic constraint @Z(%T.loc4_14.2: type) {
  684. // CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T)]
  685. // CHECK:STDOUT:
  686. // CHECK:STDOUT: !definition:
  687. // CHECK:STDOUT: %Z.type: type = facet_type <@Z, @Z(%T.loc4_14.1)> [symbolic = %Z.type (constants.%Z.type.d682d6.1)]
  688. // CHECK:STDOUT: %Self.loc4_24.2: @Z.%Z.type (%Z.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_24.2 (constants.%Self)]
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: constraint {
  691. // CHECK:STDOUT: %Self.loc4_24.1: @Z.%Z.type (%Z.type.d682d6.1) = symbolic_binding Self, 1 [symbolic = %Self.loc4_24.2 (constants.%Self)]
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: !members:
  694. // CHECK:STDOUT: .Self = %Self.loc4_24.1
  695. // CHECK:STDOUT: .T = <poisoned>
  696. // CHECK:STDOUT: .Z = <poisoned>
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: !requires:
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT:
  702. // CHECK:STDOUT: specific @Z(constants.%T) {
  703. // CHECK:STDOUT: %T.loc4_14.1 => constants.%T
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: specific @Z(constants.%Self.binding.as_type) {
  707. // CHECK:STDOUT: %T.loc4_14.1 => constants.%Self.binding.as_type
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: --- fail_require_impls_without_self.carbon
  711. // CHECK:STDOUT:
  712. // CHECK:STDOUT: constants {
  713. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  714. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  715. // CHECK:STDOUT: %Z.type.7a8: type = generic_named_constaint_type @Z [concrete]
  716. // CHECK:STDOUT: %empty_struct: %Z.type.7a8 = struct_value () [concrete]
  717. // CHECK:STDOUT: %Z.type.d68: type = facet_type <@Z, @Z(%T)> [symbolic]
  718. // CHECK:STDOUT: %Self.31c: %Z.type.d68 = symbolic_binding Self, 1 [symbolic]
  719. // CHECK:STDOUT: }
  720. // CHECK:STDOUT:
  721. // CHECK:STDOUT: imports {
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: file {
  725. // CHECK:STDOUT: %Z.decl: %Z.type.7a8 = constraint_decl @Z [concrete = constants.%empty_struct] {
  726. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  727. // CHECK:STDOUT: } {
  728. // CHECK:STDOUT: <elided>
  729. // CHECK:STDOUT: %T.loc8_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_14.1 (constants.%T)]
  730. // CHECK:STDOUT: }
  731. // CHECK:STDOUT: }
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: generic constraint @Z(%T.loc8_14.2: type) {
  734. // CHECK:STDOUT: %T.loc8_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_14.1 (constants.%T)]
  735. // CHECK:STDOUT:
  736. // CHECK:STDOUT: !definition:
  737. // CHECK:STDOUT: %Z.type: type = facet_type <@Z, @Z(%T.loc8_14.1)> [symbolic = %Z.type (constants.%Z.type.d68)]
  738. // CHECK:STDOUT: %Self.loc8_24.2: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  739. // CHECK:STDOUT:
  740. // CHECK:STDOUT: constraint {
  741. // CHECK:STDOUT: %Self.loc8_24.1: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  742. // CHECK:STDOUT:
  743. // CHECK:STDOUT: !members:
  744. // CHECK:STDOUT: .Self = %Self.loc8_24.1
  745. // CHECK:STDOUT: .T = <poisoned>
  746. // CHECK:STDOUT: .Y = <poisoned>
  747. // CHECK:STDOUT:
  748. // CHECK:STDOUT: !requires:
  749. // CHECK:STDOUT: }
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT:
  752. // CHECK:STDOUT: specific @Z(constants.%T) {
  753. // CHECK:STDOUT: %T.loc8_14.1 => constants.%T
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: --- require_self_in_requirement.carbon
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: constants {
  759. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  760. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  761. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.%Y1 [concrete]
  762. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  763. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  764. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  765. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  766. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  767. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  768. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  769. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %Self.binding.as_type> [symbolic]
  770. // CHECK:STDOUT: }
  771. // CHECK:STDOUT:
  772. // CHECK:STDOUT: imports {
  773. // CHECK:STDOUT: }
  774. // CHECK:STDOUT:
  775. // CHECK:STDOUT: file {
  776. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  777. // CHECK:STDOUT: }
  778. // CHECK:STDOUT:
  779. // CHECK:STDOUT: constraint @Z {
  780. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  781. // CHECK:STDOUT: %Z.Self.binding.as_type.impls.Y_where.type.require.decl = require_decl @Z.Self.binding.as_type.impls.Y_where.type.require [concrete] {
  782. // CHECK:STDOUT: require %Self.as_type.loc10_11 impls %.loc10_19
  783. // CHECK:STDOUT: } {
  784. // CHECK:STDOUT: %Self.as_type.loc10_11: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  785. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  786. // CHECK:STDOUT: <elided>
  787. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  788. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  789. // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  790. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  791. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  792. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  793. // CHECK:STDOUT: %Self.as_type.loc10_31: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  794. // CHECK:STDOUT: %.loc10_31: type = converted %Self.ref, %Self.as_type.loc10_31 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  795. // CHECK:STDOUT: %.loc10_19: type = where_expr %.Self [symbolic = %Y_where.type (constants.%Y_where.type)] {
  796. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  797. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_31
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT: }
  800. // CHECK:STDOUT:
  801. // CHECK:STDOUT: !members:
  802. // CHECK:STDOUT: .Self = %Self
  803. // CHECK:STDOUT: .Y = <poisoned>
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: !requires:
  806. // CHECK:STDOUT: @Z.Self.binding.as_type.impls.Y_where.type.require {
  807. // CHECK:STDOUT: require @Z.Self.binding.as_type.impls.Y_where.type.require.%Self.as_type.loc10_11 impls @Z.Self.binding.as_type.impls.Y_where.type.require.%.loc10_19
  808. // CHECK:STDOUT: }
  809. // CHECK:STDOUT: }
  810. // CHECK:STDOUT:
  811. // CHECK:STDOUT: generic require @Z.Self.binding.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  812. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  813. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  814. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where constants.%impl.elem0 = %Self.binding.as_type> [symbolic = %Y_where.type (constants.%Y_where.type)]
  815. // CHECK:STDOUT: }
  816. // CHECK:STDOUT:
  817. // CHECK:STDOUT: specific @Z.Self.binding.as_type.impls.Y_where.type.require(constants.%Self.550) {
  818. // CHECK:STDOUT: %Self => constants.%Self.550
  819. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  820. // CHECK:STDOUT: %Y_where.type => constants.%Y_where.type
  821. // CHECK:STDOUT: }
  822. // CHECK:STDOUT: