require.carbon 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563
  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. // --- 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, t: T) {
  23. //@dump-sem-ir-begin
  24. T.YY();
  25. T.(Y.YY)();
  26. t.YY();
  27. //@dump-sem-ir-end
  28. }
  29. // --- extend_with_self.carbon
  30. library "[[@TEST_NAME]]";
  31. interface Y(T:! type) {
  32. fn YY();
  33. }
  34. //@dump-sem-ir-begin
  35. constraint Z {
  36. extend require impls Y(Self);
  37. }
  38. //@dump-sem-ir-end
  39. fn F(T:! Z, t: T) {
  40. //@dump-sem-ir-begin
  41. T.YY();
  42. T.(Y(T).YY)();
  43. t.YY();
  44. //@dump-sem-ir-end
  45. }
  46. // --- implicit_self_impls.carbon
  47. library "[[@TEST_NAME]]";
  48. interface Y {
  49. fn YY();
  50. }
  51. //@dump-sem-ir-begin
  52. constraint Z {
  53. require impls Y;
  54. }
  55. //@dump-sem-ir-end
  56. fn F(T:! Z) {
  57. T.(Y.YY)();
  58. }
  59. // --- explicit_self_impls.carbon
  60. library "[[@TEST_NAME]]";
  61. interface Y {
  62. fn YY();
  63. }
  64. //@dump-sem-ir-begin
  65. constraint Z {
  66. require Self impls Y;
  67. }
  68. //@dump-sem-ir-end
  69. fn F(T:! Z) {
  70. T.(Y.YY)();
  71. }
  72. // --- fail_implicit_self_no_extend_name_lookup_fails.carbon
  73. library "[[@TEST_NAME]]";
  74. interface Y {
  75. fn YY();
  76. }
  77. constraint Z {
  78. require impls Y;
  79. }
  80. fn F(T:! Z) {
  81. // This should fail name lookup since Z does not extend Y.
  82. //
  83. // CHECK:STDERR: fail_implicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope]
  84. // CHECK:STDERR: T.YY();
  85. // CHECK:STDERR: ^~~~
  86. // CHECK:STDERR:
  87. T.YY();
  88. }
  89. // --- fail_explicit_self_no_extend_name_lookup_fails.carbon
  90. library "[[@TEST_NAME]]";
  91. interface Y {
  92. fn YY();
  93. }
  94. constraint Z {
  95. require Self impls Y;
  96. }
  97. fn F(T:! Z) {
  98. // This should fail name lookup since Z does not extend Y.
  99. //
  100. // CHECK:STDERR: fail_explicit_self_no_extend_name_lookup_fails.carbon:[[@LINE+4]]:3: error: member name `YY` not found in `Z` [MemberNameNotFoundInSpecificScope]
  101. // CHECK:STDERR: T.YY();
  102. // CHECK:STDERR: ^~~~
  103. // CHECK:STDERR:
  104. T.YY();
  105. }
  106. // --- explicit_self_specific_impls.carbon
  107. library "[[@TEST_NAME]]";
  108. interface Y {}
  109. class C(T:! type);
  110. //@dump-sem-ir-begin
  111. constraint Z {
  112. require C(Self) impls Y;
  113. }
  114. //@dump-sem-ir-end
  115. // --- require_impls_where.carbon
  116. library "[[@TEST_NAME]]";
  117. interface Y { let Y1:! type; }
  118. //@dump-sem-ir-begin
  119. constraint Z {
  120. require impls Y where .Y1 = ();
  121. }
  122. //@dump-sem-ir-end
  123. // --- fail_require_impls_incomplete_constraint.carbon
  124. library "[[@TEST_NAME]]";
  125. constraint Y;
  126. //@dump-sem-ir-begin
  127. constraint Z {
  128. // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `Y` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  129. // CHECK:STDERR: require impls Y;
  130. // CHECK:STDERR: ^
  131. // CHECK:STDERR: fail_require_impls_incomplete_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  132. // CHECK:STDERR: constraint Y;
  133. // CHECK:STDERR: ^~~~~~~~~~~~~
  134. // CHECK:STDERR:
  135. require impls Y;
  136. }
  137. //@dump-sem-ir-end
  138. // --- fail_require_impls_incomplete_self.carbon
  139. library "[[@TEST_NAME]]";
  140. constraint Z {
  141. // CHECK:STDERR: fail_require_impls_incomplete_self.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  142. // CHECK:STDERR: require impls Z;
  143. // CHECK:STDERR: ^
  144. // CHECK:STDERR:
  145. require impls Z;
  146. }
  147. // --- fail_require_impls_incomplete_self_through_alias.carbon
  148. library "[[@TEST_NAME]]";
  149. constraint Z;
  150. alias Y = Z;
  151. constraint Z {
  152. // CHECK:STDERR: fail_require_impls_incomplete_self_through_alias.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  153. // CHECK:STDERR: require impls Y;
  154. // CHECK:STDERR: ^
  155. // CHECK:STDERR:
  156. require impls Y;
  157. }
  158. // --- fail_require_impls_incomplete_self_forward_declared.carbon
  159. library "[[@TEST_NAME]]";
  160. constraint Z;
  161. constraint Z {
  162. // CHECK:STDERR: fail_require_impls_incomplete_self_forward_declared.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  163. // CHECK:STDERR: require impls Z;
  164. // CHECK:STDERR: ^
  165. // CHECK:STDERR:
  166. require impls Z;
  167. }
  168. // --- fail_require_impls_incomplete_self_in_period_self_impls.carbon
  169. library "[[@TEST_NAME]]";
  170. constraint Z {
  171. // CHECK:STDERR: fail_require_impls_incomplete_self_in_period_self_impls.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  172. // CHECK:STDERR: require impls type where .Self impls Z;
  173. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  174. // CHECK:STDERR:
  175. require impls type where .Self impls Z;
  176. }
  177. // --- fail_require_impls_incomplete_self_in_class_impls.carbon
  178. library "[[@TEST_NAME]]";
  179. class C(T:! type);
  180. constraint Z {
  181. // CHECK:STDERR: fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+4]]:17: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  182. // CHECK:STDERR: require impls type where C(.Self) impls Z;
  183. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  184. // CHECK:STDERR:
  185. require impls type where C(.Self) impls Z;
  186. }
  187. // --- fail_require_impls_incomplete_indirect.carbon
  188. library "[[@TEST_NAME]]";
  189. constraint Z;
  190. constraint Y {
  191. // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE+7]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  192. // CHECK:STDERR: require impls Z;
  193. // CHECK:STDERR: ^
  194. // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  195. // CHECK:STDERR: constraint Z;
  196. // CHECK:STDERR: ^~~~~~~~~~~~~
  197. // CHECK:STDERR:
  198. require impls Z;
  199. }
  200. constraint Z {
  201. require impls Y;
  202. }
  203. // --- fail_require_impls_incomplete_self_specific.carbon
  204. library "[[@TEST_NAME]]";
  205. constraint Z(T:! type) {
  206. // CHECK:STDERR: fail_require_impls_incomplete_self_specific.carbon:[[@LINE+4]]:19: error: facet type in `require` declaration refers to the named constraint `Z` from within its definition [RequireImplsReferenceCycle]
  207. // CHECK:STDERR: require T impls Z(Self);
  208. // CHECK:STDERR: ^~~~~~~
  209. // CHECK:STDERR:
  210. require T impls Z(Self);
  211. }
  212. // --- fail_require_impls_without_self.carbon
  213. library "[[@TEST_NAME]]";
  214. interface Y {
  215. let Y1:! type;
  216. }
  217. //@dump-sem-ir-begin
  218. constraint Z(T:! type) {
  219. // Either the type `T` or the facet type `Y` must mention `Self` in a way that
  220. // it would appear in the type structure used for impl lookup (so inside a
  221. // `where` does not count). But they don't.
  222. //
  223. // 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 argument for each required interface, but found interface `Y` without a `Self` argument [RequireImplsMissingSelf]
  224. // CHECK:STDERR: require T impls Y where .Y1 = Self;
  225. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  226. // CHECK:STDERR:
  227. require T impls Y where .Y1 = Self;
  228. }
  229. //@dump-sem-ir-end
  230. // --- fail_require_impls_without_self_in_one_interface.carbon
  231. library "[[@TEST_NAME]]";
  232. interface Y(T:! type) {}
  233. constraint Z(T:! type) {
  234. // Self is in one interface but not the other.
  235. //
  236. // 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 argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf]
  237. // CHECK:STDERR: require T impls Y(Self) & Y({});
  238. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  239. // CHECK:STDERR:
  240. require T impls Y(Self) & Y({});
  241. }
  242. // --- fail_require_impls_without_self_in_multiple_interfaces.carbon
  243. library "[[@TEST_NAME]]";
  244. interface Y(T:! type) {}
  245. constraint Z(T:! type) {
  246. // Self does not appear in either interface, we should get an error for each.
  247. //
  248. // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+8]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y(())` without a `Self` argument [RequireImplsMissingSelf]
  249. // CHECK:STDERR: require T impls Y(()) & Y({});
  250. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  251. // CHECK:STDERR:
  252. // CHECK:STDERR: fail_require_impls_without_self_in_multiple_interfaces.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Y({})` without a `Self` argument [RequireImplsMissingSelf]
  253. // CHECK:STDERR: require T impls Y(()) & Y({});
  254. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  255. // CHECK:STDERR:
  256. require T impls Y(()) & Y({});
  257. }
  258. // --- fail_self_impls_self.carbon
  259. library "[[@TEST_NAME]]";
  260. constraint Z(T:! type) {
  261. // 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]
  262. // CHECK:STDERR: require impls Self;
  263. // CHECK:STDERR: ^~~~
  264. // CHECK:STDERR:
  265. require impls Self;
  266. }
  267. // --- fail_impls_type.carbon
  268. library "[[@TEST_NAME]]";
  269. class C(T:! type) {}
  270. constraint Z(T:! type) {
  271. // 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]
  272. // CHECK:STDERR: require T impls C(Self);
  273. // CHECK:STDERR: ^~~~~~~
  274. // CHECK:STDERR:
  275. require T impls C(Self);
  276. }
  277. // --- fail_non_type_impls.carbon
  278. library "[[@TEST_NAME]]";
  279. interface Y {}
  280. constraint Z(T:! type) {
  281. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+7]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
  282. // CHECK:STDERR: require 1 impls Y;
  283. // CHECK:STDERR: ^
  284. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
  285. // CHECK:STDERR: require 1 impls Y;
  286. // CHECK:STDERR: ^
  287. // CHECK:STDERR:
  288. require 1 impls Y;
  289. }
  290. // --- fail_impls_non_type.carbon
  291. library "[[@TEST_NAME]]";
  292. interface Y {}
  293. constraint Z(T:! type) {
  294. // 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]
  295. // CHECK:STDERR: require impls 1;
  296. // CHECK:STDERR: ^
  297. // CHECK:STDERR:
  298. require impls 1;
  299. }
  300. // --- require_self_in_requirement.carbon
  301. library "[[@TEST_NAME]]";
  302. interface Y {
  303. let Y1:! type;
  304. }
  305. //@dump-sem-ir-begin
  306. constraint Z {
  307. // Self can appear in a requirement.
  308. require impls Y where .Y1 = Self;
  309. }
  310. //@dump-sem-ir-end
  311. // --- require_self.carbon
  312. library "[[@TEST_NAME]]";
  313. interface Z(T:! type) {}
  314. constraint N {
  315. require impls Z(Self);
  316. }
  317. impl () as Z(()) {}
  318. fn F() {
  319. () as N;
  320. }
  321. // --- fail_require_different_self.carbon
  322. library "[[@TEST_NAME]]";
  323. interface Z(T:! type) {}
  324. constraint N {
  325. require impls Z(Self);
  326. }
  327. impl () as Z({}) {}
  328. fn F() {
  329. // N requires () impls Z(Self) which is Z(()) for this query, but it impls
  330. // Z({}).
  331. //
  332. // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  333. // CHECK:STDERR: () as N;
  334. // CHECK:STDERR: ^~~~~~~
  335. // CHECK:STDERR:
  336. () as N;
  337. }
  338. // --- fail_require_different_parameter.carbon
  339. library "[[@TEST_NAME]]";
  340. interface Z(T:! type) {}
  341. constraint N {
  342. require impls Z({});
  343. }
  344. impl () as Z(()) {}
  345. fn F() {
  346. // N requires () impls Z({}) but it impls Z(()).
  347. //
  348. // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  349. // CHECK:STDERR: () as N;
  350. // CHECK:STDERR: ^~~~~~~
  351. // CHECK:STDERR:
  352. () as N;
  353. }
  354. // --- require_different_type_impls.carbon
  355. library "[[@TEST_NAME]]";
  356. interface Z(T:! type) {}
  357. constraint N {
  358. require {} impls Z(Self);
  359. }
  360. impl {} as Z(()) {}
  361. fn F() {
  362. () as N;
  363. }
  364. // --- require_different_type_impls_nested_constraint.carbon
  365. library "[[@TEST_NAME]]";
  366. interface Z(T:! type) {}
  367. constraint M(T:! type) {
  368. extend require impls Z(T);
  369. }
  370. constraint N {
  371. require {} impls M(Self);
  372. }
  373. impl {} as Z(()) {}
  374. fn F() {
  375. () as N;
  376. }
  377. // --- fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon
  378. library "[[@TEST_NAME]]";
  379. interface Z(T:! type) {}
  380. constraint M(T:! type) {
  381. extend require impls Z(Self);
  382. }
  383. constraint N {
  384. // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up
  385. // without any interface specific referencing the `Self` of `N`.
  386. //
  387. // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but found interface `Z({})` without a `Self` argument [RequireImplsMissingSelf]
  388. // CHECK:STDERR: require {} impls M(Self);
  389. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  390. // CHECK:STDERR:
  391. require {} impls M(Self);
  392. }
  393. // --- fail_require_different_type_impls_nested_constraint_empty.carbon
  394. library "[[@TEST_NAME]]";
  395. constraint M(T:! type) {}
  396. constraint N {
  397. // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up
  398. // without any interface specific referencing the `Self` of `N`.
  399. //
  400. // CHECK:STDERR: fail_require_different_type_impls_nested_constraint_empty.carbon:[[@LINE+4]]:3: error: no `Self` reference found in `require` declaration; `Self` must appear in the self-type or as a generic argument for each required interface, but no interfaces were found [RequireImplsMissingSelfEmptyFacetType]
  401. // CHECK:STDERR: require {} impls M(Self);
  402. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  403. // CHECK:STDERR:
  404. require {} impls M(Self);
  405. }
  406. // --- fail_require_different_type_impls_different_parameter.carbon
  407. library "[[@TEST_NAME]]";
  408. interface Z(T:! type) {}
  409. constraint N {
  410. require {} impls Z(Self);
  411. }
  412. impl {} as Z({}) {}
  413. fn F() {
  414. // N requires {} impls Z(Self) which is Z(()) for this query, but it impls
  415. // Z({}).
  416. //
  417. // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  418. // CHECK:STDERR: () as N;
  419. // CHECK:STDERR: ^~~~~~~
  420. // CHECK:STDERR:
  421. () as N;
  422. }
  423. // --- require_with_rewrite_constraint.carbon
  424. library "[[@TEST_NAME]]";
  425. interface Z(T:! type) {
  426. let X:! type;
  427. }
  428. constraint N {
  429. require {} impls Z(Self) where .X = Self;
  430. }
  431. // Will satisfy `() as N`.
  432. impl {} as Z(()) where .X = () {}
  433. fn F() {
  434. () as N;
  435. }
  436. // --- require_with_rewrite_constraint_period_self.carbon
  437. library "[[@TEST_NAME]]";
  438. interface Z(T:! type) {
  439. let X:! type;
  440. }
  441. constraint N(T:! type) {
  442. require T impls Z(Self) where .X = .Self;
  443. }
  444. // Will satisfy `() as N({})`.
  445. impl {} as Z(()) where .X = {} {}
  446. fn F() {
  447. () as N({});
  448. }
  449. // --- todo_fail_require_with_mismatching_rewrite_constraint.carbon
  450. library "[[@TEST_NAME]]";
  451. interface Z(T:! type) {
  452. let X:! type;
  453. }
  454. constraint N {
  455. require {} impls Z(Self) where .X = Self;
  456. }
  457. // Will not satisfy `() as N` as the rewrite does not match.
  458. impl {} as Z(()) where .X = {} {}
  459. fn F() {
  460. // TODO: Should fail, but we're currently checking the requirements of `N`
  461. // rather than of the identified facet type of `N` (which would include the
  462. // require decl's requirements).
  463. () as N;
  464. }
  465. // --- todo_fail_require_with_mismatching_rewrite_constraint_period_self.carbon
  466. library "[[@TEST_NAME]]";
  467. interface Z(T:! type) {
  468. let X:! type;
  469. }
  470. constraint N(T:! type) {
  471. require T impls Z(Self) where .X = .Self;
  472. }
  473. // Will not satisfy `() as N({})` as the rewrite does not match.
  474. impl {} as Z(()) where .X = () {}
  475. fn F() {
  476. // TODO: Should fail, but we're currently checking the requirements of `N`
  477. // rather than of the identified facet type of `N` (which would include the
  478. // require decl's requirements).
  479. () as N({});
  480. }
  481. // --- fail_require_with_period_self_impls_not_satisfied.carbon
  482. library "[[@TEST_NAME]]";
  483. interface Z {}
  484. interface Y(T:! type) {}
  485. class C(T:! type);
  486. constraint N {
  487. require impls Z where .Self impls Y(.Self);
  488. }
  489. fn F(_:! N) {}
  490. fn G(T:! Z) {
  491. // CHECK:STDERR: fail_require_with_period_self_impls_not_satisfied.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet]
  492. // CHECK:STDERR: T as N;
  493. // CHECK:STDERR: ^~~~~~
  494. // CHECK:STDERR:
  495. T as N;
  496. }
  497. // --- require_with_period_self_impls.carbon
  498. library "[[@TEST_NAME]]";
  499. interface Z {}
  500. interface Y(T:! type) {}
  501. class C(T:! type);
  502. //@dump-sem-ir-begin
  503. constraint N {
  504. require impls Z where .Self impls Y(.Self);
  505. }
  506. //@dump-sem-ir-end
  507. fn F(_:! N) {}
  508. fn G(T:! Z & Y(.Self)) {
  509. T as N;
  510. }
  511. // --- fail_require_with_specific_period_self_not_satisfied.carbon
  512. library "[[@TEST_NAME]]";
  513. interface Z {}
  514. interface Y(T:! type) {}
  515. class C(T:! type);
  516. constraint N {
  517. require impls Z where C(.Self) impls Y(.Self);
  518. }
  519. fn F(_:! N) {}
  520. fn G(T:! Z) {
  521. // CHECK:STDERR: fail_require_with_specific_period_self_not_satisfied.carbon:[[@LINE+4]]:3: error: cannot convert type `T` that implements `Z` into type implementing `N` [ConversionFailureFacetToFacet]
  522. // CHECK:STDERR: T as N;
  523. // CHECK:STDERR: ^~~~~~
  524. // CHECK:STDERR:
  525. T as N;
  526. }
  527. // --- require_with_specific_period_self.carbon
  528. library "[[@TEST_NAME]]";
  529. interface Z {}
  530. interface Y(T:! type) {}
  531. class C(T:! type);
  532. //@dump-sem-ir-begin
  533. constraint N {
  534. require impls Z where C(.Self) impls Y(.Self);
  535. }
  536. //@dump-sem-ir-end
  537. fn F(_:! N) {}
  538. fn G(T:! Z) {
  539. impl C(T) as Y(T) {}
  540. T as N;
  541. }
  542. // CHECK:STDOUT: --- extend.carbon
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: constants {
  545. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  546. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  547. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  548. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [concrete]
  549. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  550. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  551. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  552. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  553. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  554. // CHECK:STDOUT: %pattern_type.86a: type = pattern_type %T.as_type [symbolic]
  555. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T, @Y [symbolic]
  556. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %T.as_type, (%Y.lookup_impl_witness) [symbolic]
  557. // CHECK:STDOUT: %Y.WithSelf.YY.type.df2: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%Y.facet) [symbolic]
  558. // CHECK:STDOUT: %.a84: type = fn_type_with_self_type %Y.WithSelf.YY.type.df2, %Y.facet [symbolic]
  559. // CHECK:STDOUT: %impl.elem0: %.a84 = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic]
  560. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Y.WithSelf.YY(%Y.facet) [symbolic]
  561. // CHECK:STDOUT: }
  562. // CHECK:STDOUT:
  563. // CHECK:STDOUT: file {
  564. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  565. // CHECK:STDOUT: }
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: constraint @Z {
  568. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  569. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  570. // CHECK:STDOUT:
  571. // CHECK:STDOUT: !with Self:
  572. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y.type.require [concrete] {
  573. // CHECK:STDOUT: require %Self.as_type.loc9_18.1 impls %Y.ref
  574. // CHECK:STDOUT: } {
  575. // CHECK:STDOUT: %Self.as_type.loc9_18.1: type = facet_access_type @Z.%Self [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  576. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  577. // CHECK:STDOUT: }
  578. // CHECK:STDOUT: %.loc9: type = specific_constant @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.ref, @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) [concrete = constants.%Y.type]
  579. // CHECK:STDOUT:
  580. // CHECK:STDOUT: !members:
  581. // CHECK:STDOUT: .Self = %Self
  582. // CHECK:STDOUT: .Y = <poisoned>
  583. // CHECK:STDOUT: .Y = <poisoned>
  584. // CHECK:STDOUT: .YY = <poisoned>
  585. // CHECK:STDOUT: extend @Z.WithSelf.%.loc9
  586. // CHECK:STDOUT:
  587. // CHECK:STDOUT: !requires:
  588. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y.type.require {
  589. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y.type.require.%Self.as_type.loc9_18.1 impls @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.ref
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  594. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  595. // CHECK:STDOUT: %Self.as_type.loc9_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: generic fn @F(%T.loc13_7.2: %Z.type) {
  599. // CHECK:STDOUT: <elided>
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: !definition:
  602. // CHECK:STDOUT: <elided>
  603. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_7.1, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
  604. // CHECK:STDOUT: %Y.facet.loc15: %Y.type = facet_value %T.as_type.loc13_16.1, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  605. // CHECK:STDOUT: %Y.WithSelf.YY.type: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%Y.facet.loc15) [symbolic = %Y.WithSelf.YY.type (constants.%Y.WithSelf.YY.type.df2)]
  606. // CHECK:STDOUT: %.loc15_4.2: type = fn_type_with_self_type %Y.WithSelf.YY.type, %Y.facet.loc15 [symbolic = %.loc15_4.2 (constants.%.a84)]
  607. // CHECK:STDOUT: %impl.elem0.loc15_4.2: @F.%.loc15_4.2 (%.a84) = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  608. // CHECK:STDOUT: %specific_impl_fn.loc15_4.2: <specific function> = specific_impl_function %impl.elem0.loc15_4.2, @Y.WithSelf.YY(%Y.facet.loc15) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  609. // CHECK:STDOUT:
  610. // CHECK:STDOUT: fn(%t.param: @F.%T.as_type.loc13_16.1 (%T.as_type)) {
  611. // CHECK:STDOUT: !entry:
  612. // CHECK:STDOUT: %T.ref.loc15: %Z.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T)]
  613. // CHECK:STDOUT: %T.as_type.loc15: type = facet_access_type %T.ref.loc15 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  614. // CHECK:STDOUT: %.loc15_4.1: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  615. // CHECK:STDOUT: %YY.ref.loc15: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  616. // CHECK:STDOUT: %impl.elem0.loc15_4.1: @F.%.loc15_4.2 (%.a84) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  617. // CHECK:STDOUT: %specific_impl_fn.loc15_4.1: <specific function> = specific_impl_function %impl.elem0.loc15_4.1, @Y.WithSelf.YY(constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  618. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc15: init %empty_tuple.type = call %specific_impl_fn.loc15_4.1()
  619. // CHECK:STDOUT: %T.ref.loc16: %Z.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T)]
  620. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  621. // CHECK:STDOUT: %YY.ref.loc16: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  622. // CHECK:STDOUT: %T.as_type.loc16: type = facet_access_type %T.ref.loc16 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  623. // CHECK:STDOUT: %Y.facet.loc16: %Y.type = facet_value %T.as_type.loc16, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  624. // CHECK:STDOUT: %.loc16: %Y.type = converted %T.ref.loc16, %Y.facet.loc16 [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  625. // CHECK:STDOUT: %impl.elem0.loc16: @F.%.loc15_4.2 (%.a84) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  626. // CHECK:STDOUT: %specific_impl_fn.loc16: <specific function> = specific_impl_function %impl.elem0.loc16, @Y.WithSelf.YY(constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  627. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc16: init %empty_tuple.type = call %specific_impl_fn.loc16()
  628. // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc13_16.1 (%T.as_type) = name_ref t, %t
  629. // CHECK:STDOUT: %YY.ref.loc18: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  630. // CHECK:STDOUT: %impl.elem0.loc18: @F.%.loc15_4.2 (%.a84) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  631. // CHECK:STDOUT: %specific_impl_fn.loc18: <specific function> = specific_impl_function %impl.elem0.loc18, @Y.WithSelf.YY(constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  632. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc18: init %empty_tuple.type = call %specific_impl_fn.loc18()
  633. // CHECK:STDOUT: <elided>
  634. // CHECK:STDOUT: }
  635. // CHECK:STDOUT: }
  636. // CHECK:STDOUT:
  637. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  638. // CHECK:STDOUT: !definition:
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT:
  641. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) {
  642. // CHECK:STDOUT: %Self => constants.%Self.550
  643. // CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%Self.as_type
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: specific @F(constants.%T) {
  647. // CHECK:STDOUT: %T.loc13_7.1 => constants.%T
  648. // CHECK:STDOUT: %T.as_type.loc13_16.1 => constants.%T.as_type
  649. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.86a
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  653. // CHECK:STDOUT: !definition:
  654. // CHECK:STDOUT: }
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) {
  657. // CHECK:STDOUT: %Self => constants.%T
  658. // CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%T.as_type
  659. // CHECK:STDOUT: }
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: --- extend_with_self.carbon
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: constants {
  664. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  665. // CHECK:STDOUT: %Y.type.82b: type = generic_interface_type @Y [concrete]
  666. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  667. // CHECK:STDOUT: %Y.generic: %Y.type.82b = struct_value () [concrete]
  668. // CHECK:STDOUT: %Y.type.a16: type = facet_type <@Y, @Y(%T.67d)> [symbolic]
  669. // CHECK:STDOUT: %Self.6f4: %Y.type.a16 = symbolic_binding Self, 1 [symbolic]
  670. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  671. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  672. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  673. // CHECK:STDOUT: %Y.type.bf0: type = facet_type <@Y, @Y(%Self.as_type)> [symbolic]
  674. // CHECK:STDOUT: %require_complete.aa4: <witness> = require_complete_type %Y.type.bf0 [symbolic]
  675. // CHECK:STDOUT: %T.f45: %Z.type = symbolic_binding T, 0 [symbolic]
  676. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.f45 [symbolic]
  677. // CHECK:STDOUT: %pattern_type.86a: type = pattern_type %T.as_type [symbolic]
  678. // CHECK:STDOUT: %Y.type.229: type = facet_type <@Y, @Y(%T.as_type)> [symbolic]
  679. // CHECK:STDOUT: %require_complete.db1: <witness> = require_complete_type %Y.type.229 [symbolic]
  680. // CHECK:STDOUT: %Y.assoc_type.44d: type = assoc_entity_type @Y, @Y(%T.as_type) [symbolic]
  681. // CHECK:STDOUT: %assoc0.e5b: %Y.assoc_type.44d = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [symbolic]
  682. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.f45, @Y, @Y(%T.as_type) [symbolic]
  683. // CHECK:STDOUT: %Y.facet: %Y.type.229 = facet_value %T.as_type, (%Y.lookup_impl_witness) [symbolic]
  684. // CHECK:STDOUT: %Y.WithSelf.YY.type.4a6: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%T.as_type, %Y.facet) [symbolic]
  685. // CHECK:STDOUT: %.52c: type = fn_type_with_self_type %Y.WithSelf.YY.type.4a6, %Y.facet [symbolic]
  686. // CHECK:STDOUT: %impl.elem0: %.52c = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic]
  687. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Y.WithSelf.YY(%T.as_type, %Y.facet) [symbolic]
  688. // CHECK:STDOUT: }
  689. // CHECK:STDOUT:
  690. // CHECK:STDOUT: file {
  691. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  692. // CHECK:STDOUT: }
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: constraint @Z {
  695. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  696. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: !with Self:
  699. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y.type.require [concrete] {
  700. // CHECK:STDOUT: require %Self.as_type.loc9_18.1 impls %Y.type.loc9_30.1
  701. // CHECK:STDOUT: } {
  702. // CHECK:STDOUT: %Self.as_type.loc9_18.1: type = facet_access_type @Z.%Self [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  703. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  704. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  705. // CHECK:STDOUT: %Self.as_type.loc9_30: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  706. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type.loc9_30 [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  707. // CHECK:STDOUT: %Y.type.loc9_30.1: type = facet_type <@Y, @Y(constants.%Self.as_type)> [symbolic = %Y.type.loc9_30.2 (constants.%Y.type.bf0)]
  708. // CHECK:STDOUT: }
  709. // CHECK:STDOUT: %.loc9: type = specific_constant @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.type.loc9_30.1, @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) [symbolic = %Y.type (constants.%Y.type.bf0)]
  710. // CHECK:STDOUT:
  711. // CHECK:STDOUT: !members:
  712. // CHECK:STDOUT: .Self = %Self
  713. // CHECK:STDOUT: .Y = <poisoned>
  714. // CHECK:STDOUT: .Y = <poisoned>
  715. // CHECK:STDOUT: .YY = <poisoned>
  716. // CHECK:STDOUT: extend @Z.WithSelf.%.loc9
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: !requires:
  719. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y.type.require {
  720. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y.type.require.%Self.as_type.loc9_18.1 impls @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.type.loc9_30.1
  721. // CHECK:STDOUT: }
  722. // CHECK:STDOUT: }
  723. // CHECK:STDOUT:
  724. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  725. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  726. // CHECK:STDOUT: %Self.as_type.loc9_18.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_18.2 (constants.%Self.as_type)]
  727. // CHECK:STDOUT: %Y.type.loc9_30.2: type = facet_type <@Y, @Y(%Self.as_type.loc9_18.2)> [symbolic = %Y.type.loc9_30.2 (constants.%Y.type.bf0)]
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: generic fn @F(%T.loc13_7.2: %Z.type) {
  731. // CHECK:STDOUT: <elided>
  732. // CHECK:STDOUT:
  733. // CHECK:STDOUT: !definition:
  734. // CHECK:STDOUT: <elided>
  735. // CHECK:STDOUT: %Y.type.loc15: type = facet_type <@Y, @Y(%T.as_type.loc13_16.1)> [symbolic = %Y.type.loc15 (constants.%Y.type.229)]
  736. // CHECK:STDOUT: %require_complete.loc15: <witness> = require_complete_type %Y.type.loc15 [symbolic = %require_complete.loc15 (constants.%require_complete.db1)]
  737. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y, @Y(%T.as_type.loc13_16.1) [symbolic = %Y.assoc_type (constants.%Y.assoc_type.44d)]
  738. // CHECK:STDOUT: %assoc0: @F.%Y.assoc_type (%Y.assoc_type.44d) = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [symbolic = %assoc0 (constants.%assoc0.e5b)]
  739. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_7.1, @Y, @Y(%T.as_type.loc13_16.1) [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
  740. // CHECK:STDOUT: %Y.facet.loc15: @F.%Y.type.loc15 (%Y.type.229) = facet_value %T.as_type.loc13_16.1, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  741. // CHECK:STDOUT: %Y.WithSelf.YY.type: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%T.as_type.loc13_16.1, %Y.facet.loc15) [symbolic = %Y.WithSelf.YY.type (constants.%Y.WithSelf.YY.type.4a6)]
  742. // CHECK:STDOUT: %.loc15_4.3: type = fn_type_with_self_type %Y.WithSelf.YY.type, %Y.facet.loc15 [symbolic = %.loc15_4.3 (constants.%.52c)]
  743. // CHECK:STDOUT: %impl.elem0.loc15_4.2: @F.%.loc15_4.3 (%.52c) = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  744. // CHECK:STDOUT: %specific_impl_fn.loc15_4.2: <specific function> = specific_impl_function %impl.elem0.loc15_4.2, @Y.WithSelf.YY(%T.as_type.loc13_16.1, %Y.facet.loc15) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  745. // CHECK:STDOUT:
  746. // CHECK:STDOUT: fn(%t.param: @F.%T.as_type.loc13_16.1 (%T.as_type)) {
  747. // CHECK:STDOUT: !entry:
  748. // CHECK:STDOUT: %T.ref.loc15: %Z.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T.f45)]
  749. // CHECK:STDOUT: %T.as_type.loc15: type = facet_access_type %T.ref.loc15 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  750. // CHECK:STDOUT: %.loc15_4.1: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  751. // CHECK:STDOUT: %.loc15_4.2: @F.%Y.assoc_type (%Y.assoc_type.44d) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.as_type, constants.%T.f45) [symbolic = %assoc0 (constants.%assoc0.e5b)]
  752. // CHECK:STDOUT: %YY.ref.loc15: @F.%Y.assoc_type (%Y.assoc_type.44d) = name_ref YY, %.loc15_4.2 [symbolic = %assoc0 (constants.%assoc0.e5b)]
  753. // CHECK:STDOUT: %impl.elem0.loc15_4.1: @F.%.loc15_4.3 (%.52c) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  754. // CHECK:STDOUT: %specific_impl_fn.loc15_4.1: <specific function> = specific_impl_function %impl.elem0.loc15_4.1, @Y.WithSelf.YY(constants.%T.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  755. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc15: init %empty_tuple.type = call %specific_impl_fn.loc15_4.1()
  756. // CHECK:STDOUT: %T.ref.loc16_3: %Z.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T.f45)]
  757. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  758. // CHECK:STDOUT: %T.ref.loc16_8: %Z.type = name_ref T, %T.loc13_7.2 [symbolic = %T.loc13_7.1 (constants.%T.f45)]
  759. // CHECK:STDOUT: %T.as_type.loc16_9: type = facet_access_type %T.ref.loc16_8 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  760. // CHECK:STDOUT: %.loc16_9: type = converted %T.ref.loc16_8, %T.as_type.loc16_9 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  761. // CHECK:STDOUT: %Y.type.loc16: type = facet_type <@Y, @Y(constants.%T.as_type)> [symbolic = %Y.type.loc15 (constants.%Y.type.229)]
  762. // CHECK:STDOUT: %.loc16_10: @F.%Y.assoc_type (%Y.assoc_type.44d) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.as_type, constants.%Self.6f4) [symbolic = %assoc0 (constants.%assoc0.e5b)]
  763. // CHECK:STDOUT: %YY.ref.loc16: @F.%Y.assoc_type (%Y.assoc_type.44d) = name_ref YY, %.loc16_10 [symbolic = %assoc0 (constants.%assoc0.e5b)]
  764. // CHECK:STDOUT: %T.as_type.loc16_4: type = facet_access_type %T.ref.loc16_3 [symbolic = %T.as_type.loc13_16.1 (constants.%T.as_type)]
  765. // CHECK:STDOUT: %Y.facet.loc16: @F.%Y.type.loc15 (%Y.type.229) = facet_value %T.as_type.loc16_4, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  766. // CHECK:STDOUT: %.loc16_4: @F.%Y.type.loc15 (%Y.type.229) = converted %T.ref.loc16_3, %Y.facet.loc16 [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  767. // CHECK:STDOUT: %impl.elem0.loc16: @F.%.loc15_4.3 (%.52c) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  768. // CHECK:STDOUT: %specific_impl_fn.loc16: <specific function> = specific_impl_function %impl.elem0.loc16, @Y.WithSelf.YY(constants.%T.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  769. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc16: init %empty_tuple.type = call %specific_impl_fn.loc16()
  770. // CHECK:STDOUT: %t.ref: @F.%T.as_type.loc13_16.1 (%T.as_type) = name_ref t, %t
  771. // CHECK:STDOUT: %.loc18: @F.%Y.assoc_type (%Y.assoc_type.44d) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.as_type, constants.%T.f45) [symbolic = %assoc0 (constants.%assoc0.e5b)]
  772. // CHECK:STDOUT: %YY.ref.loc18: @F.%Y.assoc_type (%Y.assoc_type.44d) = name_ref YY, %.loc18 [symbolic = %assoc0 (constants.%assoc0.e5b)]
  773. // CHECK:STDOUT: %impl.elem0.loc18: @F.%.loc15_4.3 (%.52c) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  774. // CHECK:STDOUT: %specific_impl_fn.loc18: <specific function> = specific_impl_function %impl.elem0.loc18, @Y.WithSelf.YY(constants.%T.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  775. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc18: init %empty_tuple.type = call %specific_impl_fn.loc18()
  776. // CHECK:STDOUT: <elided>
  777. // CHECK:STDOUT: }
  778. // CHECK:STDOUT: }
  779. // CHECK:STDOUT:
  780. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  781. // CHECK:STDOUT: !definition:
  782. // CHECK:STDOUT: %Self => constants.%Self.550
  783. // CHECK:STDOUT: %Self.as_type => constants.%Self.as_type
  784. // CHECK:STDOUT: %Y.type => constants.%Y.type.bf0
  785. // CHECK:STDOUT: %require_complete => constants.%require_complete.aa4
  786. // CHECK:STDOUT: }
  787. // CHECK:STDOUT:
  788. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) {
  789. // CHECK:STDOUT: %Self => constants.%Self.550
  790. // CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%Self.as_type
  791. // CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.bf0
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT:
  794. // CHECK:STDOUT: specific @F(constants.%T.f45) {
  795. // CHECK:STDOUT: %T.loc13_7.1 => constants.%T.f45
  796. // CHECK:STDOUT: %T.as_type.loc13_16.1 => constants.%T.as_type
  797. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.86a
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T.f45) {
  801. // CHECK:STDOUT: !definition:
  802. // CHECK:STDOUT: %Self => constants.%T.f45
  803. // CHECK:STDOUT: %Self.as_type => constants.%T.as_type
  804. // CHECK:STDOUT: %Y.type => constants.%Y.type.229
  805. // CHECK:STDOUT: %require_complete => constants.%require_complete.db1
  806. // CHECK:STDOUT: }
  807. // CHECK:STDOUT:
  808. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T.f45) {
  809. // CHECK:STDOUT: %Self => constants.%T.f45
  810. // CHECK:STDOUT: %Self.as_type.loc9_18.2 => constants.%T.as_type
  811. // CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.229
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: --- implicit_self_impls.carbon
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: constants {
  817. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  818. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  819. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  820. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  821. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  822. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: file {
  826. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: constraint @Z {
  830. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  831. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: !with Self:
  834. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y.type.require [concrete] {
  835. // CHECK:STDOUT: require %Self.as_type.loc9_11.1 impls %Y.ref
  836. // CHECK:STDOUT: } {
  837. // CHECK:STDOUT: %Self.as_type.loc9_11.1: type = facet_access_type @Z.%Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)]
  838. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  839. // CHECK:STDOUT: }
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: !members:
  842. // CHECK:STDOUT: .Self = %Self
  843. // CHECK:STDOUT: .Y = <poisoned>
  844. // CHECK:STDOUT: .Y = <poisoned>
  845. // CHECK:STDOUT:
  846. // CHECK:STDOUT: !requires:
  847. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y.type.require {
  848. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y.type.require.%Self.as_type.loc9_11.1 impls @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.ref
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT: }
  851. // CHECK:STDOUT:
  852. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  853. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  854. // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)]
  855. // CHECK:STDOUT: }
  856. // CHECK:STDOUT:
  857. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  858. // CHECK:STDOUT: !definition:
  859. // CHECK:STDOUT: }
  860. // CHECK:STDOUT:
  861. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) {
  862. // CHECK:STDOUT: %Self => constants.%Self.550
  863. // CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%Self.as_type
  864. // CHECK:STDOUT: }
  865. // CHECK:STDOUT:
  866. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  867. // CHECK:STDOUT: !definition:
  868. // CHECK:STDOUT: }
  869. // CHECK:STDOUT:
  870. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) {
  871. // CHECK:STDOUT: %Self => constants.%T
  872. // CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%T.as_type
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: --- explicit_self_impls.carbon
  876. // CHECK:STDOUT:
  877. // CHECK:STDOUT: constants {
  878. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  879. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  880. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  881. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  882. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  883. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T [symbolic]
  884. // CHECK:STDOUT: }
  885. // CHECK:STDOUT:
  886. // CHECK:STDOUT: file {
  887. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: constraint @Z {
  891. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  892. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  893. // CHECK:STDOUT:
  894. // CHECK:STDOUT: !with Self:
  895. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y.type.require [concrete] {
  896. // CHECK:STDOUT: require %.loc9 impls %Y.ref
  897. // CHECK:STDOUT: } {
  898. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  899. // CHECK:STDOUT: %Self.as_type.loc9_11.1: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)]
  900. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type.loc9_11.1 [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)]
  901. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  902. // CHECK:STDOUT: }
  903. // CHECK:STDOUT:
  904. // CHECK:STDOUT: !members:
  905. // CHECK:STDOUT: .Self = %Self
  906. // CHECK:STDOUT: .Y = <poisoned>
  907. // CHECK:STDOUT: .Y = <poisoned>
  908. // CHECK:STDOUT:
  909. // CHECK:STDOUT: !requires:
  910. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y.type.require {
  911. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y.type.require.%.loc9 impls @Z.WithSelf.Self.as_type.impls.Y.type.require.%Y.ref
  912. // CHECK:STDOUT: }
  913. // CHECK:STDOUT: }
  914. // CHECK:STDOUT:
  915. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  916. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  917. // CHECK:STDOUT: %Self.as_type.loc9_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_11.2 (constants.%Self.as_type)]
  918. // CHECK:STDOUT: }
  919. // CHECK:STDOUT:
  920. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  921. // CHECK:STDOUT: !definition:
  922. // CHECK:STDOUT: }
  923. // CHECK:STDOUT:
  924. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.550) {
  925. // CHECK:STDOUT: %Self => constants.%Self.550
  926. // CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%Self.as_type
  927. // CHECK:STDOUT: }
  928. // CHECK:STDOUT:
  929. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  930. // CHECK:STDOUT: !definition:
  931. // CHECK:STDOUT: }
  932. // CHECK:STDOUT:
  933. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y.type.require(constants.%T) {
  934. // CHECK:STDOUT: %Self => constants.%T
  935. // CHECK:STDOUT: %Self.as_type.loc9_11.2 => constants.%T.as_type
  936. // CHECK:STDOUT: }
  937. // CHECK:STDOUT:
  938. // CHECK:STDOUT: --- explicit_self_specific_impls.carbon
  939. // CHECK:STDOUT:
  940. // CHECK:STDOUT: constants {
  941. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  942. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  943. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  944. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  945. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  946. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  947. // CHECK:STDOUT: %C.6c0: type = class_type @C, @C(%Self.as_type) [symbolic]
  948. // CHECK:STDOUT: }
  949. // CHECK:STDOUT:
  950. // CHECK:STDOUT: file {
  951. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  952. // CHECK:STDOUT: }
  953. // CHECK:STDOUT:
  954. // CHECK:STDOUT: constraint @Z {
  955. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  956. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  957. // CHECK:STDOUT:
  958. // CHECK:STDOUT: !with Self:
  959. // CHECK:STDOUT: %Z.WithSelf.C.impls.Y.type.require.decl = require_decl @Z.WithSelf.C.impls.Y.type.require [concrete] {
  960. // CHECK:STDOUT: require %C.loc9_17.1 impls %Y.ref
  961. // CHECK:STDOUT: } {
  962. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  963. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  964. // CHECK:STDOUT: %Self.as_type.loc9_17.1: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc9_17.2 (constants.%Self.as_type)]
  965. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type.loc9_17.1 [symbolic = %Self.as_type.loc9_17.2 (constants.%Self.as_type)]
  966. // CHECK:STDOUT: %C.loc9_17.1: type = class_type @C, @C(constants.%Self.as_type) [symbolic = %C.loc9_17.2 (constants.%C.6c0)]
  967. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  968. // CHECK:STDOUT: }
  969. // CHECK:STDOUT:
  970. // CHECK:STDOUT: !members:
  971. // CHECK:STDOUT: .Self = %Self
  972. // CHECK:STDOUT: .C = <poisoned>
  973. // CHECK:STDOUT: .Y = <poisoned>
  974. // CHECK:STDOUT: .C = <poisoned>
  975. // CHECK:STDOUT: .Y = <poisoned>
  976. // CHECK:STDOUT:
  977. // CHECK:STDOUT: !requires:
  978. // CHECK:STDOUT: @Z.WithSelf.C.impls.Y.type.require {
  979. // CHECK:STDOUT: require @Z.WithSelf.C.impls.Y.type.require.%C.loc9_17.1 impls @Z.WithSelf.C.impls.Y.type.require.%Y.ref
  980. // CHECK:STDOUT: }
  981. // CHECK:STDOUT: }
  982. // CHECK:STDOUT:
  983. // CHECK:STDOUT: generic require @Z.WithSelf.C.impls.Y.type.require(@Z.%Self: %Z.type) {
  984. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  985. // CHECK:STDOUT: %Self.as_type.loc9_17.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc9_17.2 (constants.%Self.as_type)]
  986. // CHECK:STDOUT: %C.loc9_17.2: type = class_type @C, @C(%Self.as_type.loc9_17.2) [symbolic = %C.loc9_17.2 (constants.%C.6c0)]
  987. // CHECK:STDOUT: }
  988. // CHECK:STDOUT:
  989. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  990. // CHECK:STDOUT:
  991. // CHECK:STDOUT: specific @Z.WithSelf.C.impls.Y.type.require(constants.%Self.550) {
  992. // CHECK:STDOUT: %Self => constants.%Self.550
  993. // CHECK:STDOUT: %Self.as_type.loc9_17.2 => constants.%Self.as_type
  994. // CHECK:STDOUT: %C.loc9_17.2 => constants.%C.6c0
  995. // CHECK:STDOUT: }
  996. // CHECK:STDOUT:
  997. // CHECK:STDOUT: --- require_impls_where.carbon
  998. // CHECK:STDOUT:
  999. // CHECK:STDOUT: constants {
  1000. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  1001. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  1002. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y1 [concrete]
  1003. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1004. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  1005. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  1006. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  1007. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1008. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  1009. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  1010. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  1011. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  1012. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %empty_tuple.type> [concrete]
  1013. // CHECK:STDOUT: }
  1014. // CHECK:STDOUT:
  1015. // CHECK:STDOUT: file {
  1016. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  1017. // CHECK:STDOUT: }
  1018. // CHECK:STDOUT:
  1019. // CHECK:STDOUT: constraint @Z {
  1020. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  1021. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1022. // CHECK:STDOUT:
  1023. // CHECK:STDOUT: !with Self:
  1024. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y_where.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y_where.type.require [concrete] {
  1025. // CHECK:STDOUT: require %Self.as_type.loc7_11.1 impls %.loc7_19
  1026. // CHECK:STDOUT: } {
  1027. // CHECK:STDOUT: %Self.as_type.loc7_11.1: type = facet_access_type @Z.%Self [symbolic = %Self.as_type.loc7_11.2 (constants.%Self.as_type)]
  1028. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  1029. // CHECK:STDOUT: <elided>
  1030. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1031. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1032. // CHECK:STDOUT: %.loc7_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1033. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  1034. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1035. // CHECK:STDOUT: %.loc7_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  1036. // CHECK:STDOUT: %.loc7_32.2: type = converted %.loc7_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  1037. // CHECK:STDOUT: %.loc7_19: type = where_expr %.Self [concrete = constants.%Y_where.type] {
  1038. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  1039. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc7_32.2
  1040. // CHECK:STDOUT: }
  1041. // CHECK:STDOUT: }
  1042. // CHECK:STDOUT:
  1043. // CHECK:STDOUT: !members:
  1044. // CHECK:STDOUT: .Self = %Self
  1045. // CHECK:STDOUT: .Y = <poisoned>
  1046. // CHECK:STDOUT: .Y = <poisoned>
  1047. // CHECK:STDOUT:
  1048. // CHECK:STDOUT: !requires:
  1049. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y_where.type.require {
  1050. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y_where.type.require.%Self.as_type.loc7_11.1 impls @Z.WithSelf.Self.as_type.impls.Y_where.type.require.%.loc7_19
  1051. // CHECK:STDOUT: }
  1052. // CHECK:STDOUT: }
  1053. // CHECK:STDOUT:
  1054. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  1055. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  1056. // CHECK:STDOUT: %Self.as_type.loc7_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc7_11.2 (constants.%Self.as_type)]
  1057. // CHECK:STDOUT: }
  1058. // CHECK:STDOUT:
  1059. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  1060. // CHECK:STDOUT:
  1061. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y_where.type.require(constants.%Self.550) {
  1062. // CHECK:STDOUT: %Self => constants.%Self.550
  1063. // CHECK:STDOUT: %Self.as_type.loc7_11.2 => constants.%Self.as_type
  1064. // CHECK:STDOUT: }
  1065. // CHECK:STDOUT:
  1066. // CHECK:STDOUT: --- fail_require_impls_incomplete_constraint.carbon
  1067. // CHECK:STDOUT:
  1068. // CHECK:STDOUT: constants {
  1069. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1070. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic]
  1071. // CHECK:STDOUT: }
  1072. // CHECK:STDOUT:
  1073. // CHECK:STDOUT: file {
  1074. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  1075. // CHECK:STDOUT: }
  1076. // CHECK:STDOUT:
  1077. // CHECK:STDOUT: constraint @Z {
  1078. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  1079. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1080. // CHECK:STDOUT:
  1081. // CHECK:STDOUT: !members:
  1082. // CHECK:STDOUT: .Self = %Self
  1083. // CHECK:STDOUT: .Y = <poisoned>
  1084. // CHECK:STDOUT: .Y = <poisoned>
  1085. // CHECK:STDOUT:
  1086. // CHECK:STDOUT: !requires:
  1087. // CHECK:STDOUT: }
  1088. // CHECK:STDOUT:
  1089. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) {}
  1090. // CHECK:STDOUT:
  1091. // CHECK:STDOUT: --- fail_require_impls_without_self.carbon
  1092. // CHECK:STDOUT:
  1093. // CHECK:STDOUT: constants {
  1094. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  1095. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  1096. // CHECK:STDOUT: %Z.type.7a8: type = generic_named_constaint_type @Z [concrete]
  1097. // CHECK:STDOUT: %empty_struct: %Z.type.7a8 = struct_value () [concrete]
  1098. // CHECK:STDOUT: %Z.type.d68: type = facet_type <@Z, @Z(%T)> [symbolic]
  1099. // CHECK:STDOUT: %Self.31c: %Z.type.d68 = symbolic_binding Self, 1 [symbolic]
  1100. // CHECK:STDOUT: }
  1101. // CHECK:STDOUT:
  1102. // CHECK:STDOUT: file {
  1103. // CHECK:STDOUT: %Z.decl: %Z.type.7a8 = constraint_decl @Z [concrete = constants.%empty_struct] {
  1104. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  1105. // CHECK:STDOUT: } {
  1106. // CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.2 [concrete = type] {
  1107. // CHECK:STDOUT: <elided>
  1108. // CHECK:STDOUT: %.loc8_18.2: type = type_literal type [concrete = type]
  1109. // CHECK:STDOUT: }
  1110. // CHECK:STDOUT: %T.loc8_15.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.1 (constants.%T)]
  1111. // CHECK:STDOUT: }
  1112. // CHECK:STDOUT: }
  1113. // CHECK:STDOUT:
  1114. // CHECK:STDOUT: generic constraint @Z(%T.loc8_15.2: type) {
  1115. // CHECK:STDOUT: %T.loc8_15.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_15.1 (constants.%T)]
  1116. // CHECK:STDOUT:
  1117. // CHECK:STDOUT: !definition:
  1118. // CHECK:STDOUT: %Z.type: type = facet_type <@Z, @Z(%T.loc8_15.1)> [symbolic = %Z.type (constants.%Z.type.d68)]
  1119. // CHECK:STDOUT: %Self.loc8_24.2: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  1120. // CHECK:STDOUT:
  1121. // CHECK:STDOUT: constraint {
  1122. // CHECK:STDOUT: %Self.loc8_24.1: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  1123. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1124. // CHECK:STDOUT:
  1125. // CHECK:STDOUT: !members:
  1126. // CHECK:STDOUT: .Self = %Self.loc8_24.1
  1127. // CHECK:STDOUT: .T = <poisoned>
  1128. // CHECK:STDOUT: .Y = <poisoned>
  1129. // CHECK:STDOUT: .T = <poisoned>
  1130. // CHECK:STDOUT: .Y = <poisoned>
  1131. // CHECK:STDOUT:
  1132. // CHECK:STDOUT: !requires:
  1133. // CHECK:STDOUT: }
  1134. // CHECK:STDOUT: }
  1135. // CHECK:STDOUT:
  1136. // CHECK:STDOUT: specific @Z(constants.%T) {
  1137. // CHECK:STDOUT: %T.loc8_15.1 => constants.%T
  1138. // CHECK:STDOUT: }
  1139. // CHECK:STDOUT:
  1140. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T, constants.%Self.31c) {}
  1141. // CHECK:STDOUT:
  1142. // CHECK:STDOUT: --- require_self_in_requirement.carbon
  1143. // CHECK:STDOUT:
  1144. // CHECK:STDOUT: constants {
  1145. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  1146. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  1147. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y1 [concrete]
  1148. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1149. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  1150. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  1151. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  1152. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  1153. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  1154. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  1155. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %Self.as_type> [symbolic]
  1156. // CHECK:STDOUT: }
  1157. // CHECK:STDOUT:
  1158. // CHECK:STDOUT: file {
  1159. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  1160. // CHECK:STDOUT: }
  1161. // CHECK:STDOUT:
  1162. // CHECK:STDOUT: constraint @Z {
  1163. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  1164. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1165. // CHECK:STDOUT:
  1166. // CHECK:STDOUT: !with Self:
  1167. // CHECK:STDOUT: %Z.WithSelf.Self.as_type.impls.Y_where.type.require.decl = require_decl @Z.WithSelf.Self.as_type.impls.Y_where.type.require [concrete] {
  1168. // CHECK:STDOUT: require %Self.as_type.loc10_11.1 impls %.loc10_19
  1169. // CHECK:STDOUT: } {
  1170. // CHECK:STDOUT: %Self.as_type.loc10_11.1: type = facet_access_type @Z.%Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1171. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  1172. // CHECK:STDOUT: <elided>
  1173. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1174. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  1175. // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  1176. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  1177. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1178. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  1179. // CHECK:STDOUT: %Self.as_type.loc10_31: type = facet_access_type %Self.ref [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1180. // CHECK:STDOUT: %.loc10_31: type = converted %Self.ref, %Self.as_type.loc10_31 [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1181. // CHECK:STDOUT: %.loc10_19: type = where_expr %.Self [symbolic = %Y_where.type (constants.%Y_where.type)] {
  1182. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  1183. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_31
  1184. // CHECK:STDOUT: }
  1185. // CHECK:STDOUT: }
  1186. // CHECK:STDOUT:
  1187. // CHECK:STDOUT: !members:
  1188. // CHECK:STDOUT: .Self = %Self
  1189. // CHECK:STDOUT: .Y = <poisoned>
  1190. // CHECK:STDOUT: .Y = <poisoned>
  1191. // CHECK:STDOUT:
  1192. // CHECK:STDOUT: !requires:
  1193. // CHECK:STDOUT: @Z.WithSelf.Self.as_type.impls.Y_where.type.require {
  1194. // CHECK:STDOUT: require @Z.WithSelf.Self.as_type.impls.Y_where.type.require.%Self.as_type.loc10_11.1 impls @Z.WithSelf.Self.as_type.impls.Y_where.type.require.%.loc10_19
  1195. // CHECK:STDOUT: }
  1196. // CHECK:STDOUT: }
  1197. // CHECK:STDOUT:
  1198. // CHECK:STDOUT: generic require @Z.WithSelf.Self.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  1199. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  1200. // CHECK:STDOUT: %Self.as_type.loc10_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1201. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where constants.%impl.elem0 = %Self.as_type.loc10_11.2> [symbolic = %Y_where.type (constants.%Y_where.type)]
  1202. // CHECK:STDOUT: }
  1203. // CHECK:STDOUT:
  1204. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  1205. // CHECK:STDOUT:
  1206. // CHECK:STDOUT: specific @Z.WithSelf.Self.as_type.impls.Y_where.type.require(constants.%Self.550) {
  1207. // CHECK:STDOUT: %Self => constants.%Self.550
  1208. // CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%Self.as_type
  1209. // CHECK:STDOUT: %Y_where.type => constants.%Y_where.type
  1210. // CHECK:STDOUT: }
  1211. // CHECK:STDOUT:
  1212. // CHECK:STDOUT: --- require_with_period_self_impls.carbon
  1213. // CHECK:STDOUT:
  1214. // CHECK:STDOUT: constants {
  1215. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1216. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  1217. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  1218. // CHECK:STDOUT: %Y.type.82b: type = generic_interface_type @Y [concrete]
  1219. // CHECK:STDOUT: %Y.generic: %Y.type.82b = struct_value () [concrete]
  1220. // CHECK:STDOUT: %N.type: type = facet_type <@N> [concrete]
  1221. // CHECK:STDOUT: %Self.550: %N.type = symbolic_binding Self, 0 [symbolic]
  1222. // CHECK:STDOUT: %Self.as_type.92a: type = facet_access_type %Self.550 [symbolic]
  1223. // CHECK:STDOUT: %.Self.aac: %Z.type = symbolic_binding .Self [symbolic_self]
  1224. // CHECK:STDOUT: %.Self.as_type.2e2: type = facet_access_type %.Self.aac [symbolic_self]
  1225. // CHECK:STDOUT: %Y.type.9b9: type = facet_type <@Y, @Y(%.Self.as_type.2e2)> [symbolic_self]
  1226. // CHECK:STDOUT: %Z_where.type.3f0: type = facet_type <@Z where .Self impls @Y, @Y(%.Self.as_type.2e2)> [symbolic_self]
  1227. // CHECK:STDOUT: %Z_where.type.862: type = facet_type <@Z where .Self impls @Y, @Y(%Self.as_type.92a)> [symbolic]
  1228. // CHECK:STDOUT: %.Self.as_type.246: type = facet_access_type %.Self.c39 [symbolic_self]
  1229. // CHECK:STDOUT: %facet_type: type = facet_type <@Z & @Y, @Y(%.Self.as_type.246)> [symbolic_self]
  1230. // CHECK:STDOUT: %T.11b: %facet_type = symbolic_binding T, 0 [symbolic]
  1231. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.11b [symbolic]
  1232. // CHECK:STDOUT: %Z_where.type.7fe: type = facet_type <@Z where .Self impls @Y, @Y(%T.as_type)> [symbolic]
  1233. // CHECK:STDOUT: }
  1234. // CHECK:STDOUT:
  1235. // CHECK:STDOUT: file {
  1236. // CHECK:STDOUT: %N.decl: type = constraint_decl @N [concrete = constants.%N.type] {} {}
  1237. // CHECK:STDOUT: }
  1238. // CHECK:STDOUT:
  1239. // CHECK:STDOUT: constraint @N {
  1240. // CHECK:STDOUT: %Self: %N.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  1241. // CHECK:STDOUT: %N.WithSelf.decl = constraint_with_self_decl @N [concrete]
  1242. // CHECK:STDOUT:
  1243. // CHECK:STDOUT: !with Self:
  1244. // CHECK:STDOUT: %N.WithSelf.Self.as_type.impls.Z_where.type.require.decl = require_decl @N.WithSelf.Self.as_type.impls.Z_where.type.require [concrete] {
  1245. // CHECK:STDOUT: require %Self.as_type.loc10_11.1 impls %Z_where.type.loc10_19.1
  1246. // CHECK:STDOUT: } {
  1247. // CHECK:STDOUT: %Self.as_type.loc10_11.1: type = facet_access_type @N.%Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type.92a)]
  1248. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  1249. // CHECK:STDOUT: <elided>
  1250. // CHECK:STDOUT: %.Self.ref.loc10_25: %Z.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.aac]
  1251. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  1252. // CHECK:STDOUT: %.Self.ref.loc10_39: %Z.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.aac]
  1253. // CHECK:STDOUT: %.Self.as_type.loc10_44: type = facet_access_type %.Self.ref.loc10_39 [symbolic_self = constants.%.Self.as_type.2e2]
  1254. // CHECK:STDOUT: %.loc10_44: type = converted %.Self.ref.loc10_39, %.Self.as_type.loc10_44 [symbolic_self = constants.%.Self.as_type.2e2]
  1255. // CHECK:STDOUT: %Y.type: type = facet_type <@Y, @Y(constants.%.Self.as_type.2e2)> [symbolic_self = constants.%Y.type.9b9]
  1256. // CHECK:STDOUT: %.Self.as_type.loc10_25: type = facet_access_type %.Self.ref.loc10_25 [symbolic_self = constants.%.Self.as_type.2e2]
  1257. // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref.loc10_25, %.Self.as_type.loc10_25 [symbolic_self = constants.%.Self.as_type.2e2]
  1258. // CHECK:STDOUT: %.loc10_19: type = where_expr %.Self [symbolic_self = constants.%Z_where.type.3f0] {
  1259. // CHECK:STDOUT: requirement_base_facet_type constants.%Z.type
  1260. // CHECK:STDOUT: requirement_impls %.loc10_25, %Y.type
  1261. // CHECK:STDOUT: }
  1262. // CHECK:STDOUT: %Z_where.type.loc10_19.1: type = facet_type <@Z where .Self impls @Y, @Y(constants.%Self.as_type.92a)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.862)]
  1263. // CHECK:STDOUT: }
  1264. // CHECK:STDOUT:
  1265. // CHECK:STDOUT: !members:
  1266. // CHECK:STDOUT: .Self = %Self
  1267. // CHECK:STDOUT: .Z = <poisoned>
  1268. // CHECK:STDOUT: .Y = <poisoned>
  1269. // CHECK:STDOUT: .Z = <poisoned>
  1270. // CHECK:STDOUT: .Y = <poisoned>
  1271. // CHECK:STDOUT:
  1272. // CHECK:STDOUT: !requires:
  1273. // CHECK:STDOUT: @N.WithSelf.Self.as_type.impls.Z_where.type.require {
  1274. // CHECK:STDOUT: require @N.WithSelf.Self.as_type.impls.Z_where.type.require.%Self.as_type.loc10_11.1 impls @N.WithSelf.Self.as_type.impls.Z_where.type.require.%Z_where.type.loc10_19.1
  1275. // CHECK:STDOUT: }
  1276. // CHECK:STDOUT: }
  1277. // CHECK:STDOUT:
  1278. // CHECK:STDOUT: generic require @N.WithSelf.Self.as_type.impls.Z_where.type.require(@N.%Self: %N.type) {
  1279. // CHECK:STDOUT: %Self: %N.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  1280. // CHECK:STDOUT: %Self.as_type.loc10_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type.92a)]
  1281. // CHECK:STDOUT: %Z_where.type.loc10_19.2: type = facet_type <@Z where .Self impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.862)]
  1282. // CHECK:STDOUT: }
  1283. // CHECK:STDOUT:
  1284. // CHECK:STDOUT: specific @N.WithSelf(constants.%Self.550) {
  1285. // CHECK:STDOUT: !definition:
  1286. // CHECK:STDOUT: }
  1287. // CHECK:STDOUT:
  1288. // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%Self.550) {
  1289. // CHECK:STDOUT: %Self => constants.%Self.550
  1290. // CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%Self.as_type.92a
  1291. // CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.862
  1292. // CHECK:STDOUT: }
  1293. // CHECK:STDOUT:
  1294. // CHECK:STDOUT: specific @N.WithSelf(constants.%T.11b) {
  1295. // CHECK:STDOUT: !definition:
  1296. // CHECK:STDOUT: }
  1297. // CHECK:STDOUT:
  1298. // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.11b) {
  1299. // CHECK:STDOUT: %Self => constants.%T.11b
  1300. // CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%T.as_type
  1301. // CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.7fe
  1302. // CHECK:STDOUT: }
  1303. // CHECK:STDOUT:
  1304. // CHECK:STDOUT: --- require_with_specific_period_self.carbon
  1305. // CHECK:STDOUT:
  1306. // CHECK:STDOUT: constants {
  1307. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1308. // CHECK:STDOUT: %Y.type.82b: type = generic_interface_type @Y [concrete]
  1309. // CHECK:STDOUT: %Y.generic: %Y.type.82b = struct_value () [concrete]
  1310. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  1311. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  1312. // CHECK:STDOUT: %N.type: type = facet_type <@N> [concrete]
  1313. // CHECK:STDOUT: %Self.550: %N.type = symbolic_binding Self, 0 [symbolic]
  1314. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.550 [symbolic]
  1315. // CHECK:STDOUT: %.Self.aac: %Z.type = symbolic_binding .Self [symbolic_self]
  1316. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.aac [symbolic_self]
  1317. // CHECK:STDOUT: %C.f27: type = class_type @C, @C(%.Self.as_type) [symbolic_self]
  1318. // CHECK:STDOUT: %Y.type.9b9: type = facet_type <@Y, @Y(%.Self.as_type)> [symbolic_self]
  1319. // CHECK:STDOUT: %Z_where.type.a6d533.1: type = facet_type <@Z where %C.f27 impls @Y, @Y(%.Self.as_type)> [symbolic_self]
  1320. // CHECK:STDOUT: %C.6c0: type = class_type @C, @C(%Self.as_type) [symbolic]
  1321. // CHECK:STDOUT: %Z_where.type.a6d533.2: type = facet_type <@Z where %C.6c0 impls @Y, @Y(%Self.as_type)> [symbolic]
  1322. // CHECK:STDOUT: %T.ea3: %Z.type = symbolic_binding T, 0 [symbolic]
  1323. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.ea3 [symbolic]
  1324. // CHECK:STDOUT: %C.dd2: type = class_type @C, @C(%T.as_type) [symbolic]
  1325. // CHECK:STDOUT: %Z_where.type.a6d533.3: type = facet_type <@Z where %C.dd2 impls @Y, @Y(%T.as_type)> [symbolic]
  1326. // CHECK:STDOUT: }
  1327. // CHECK:STDOUT:
  1328. // CHECK:STDOUT: file {
  1329. // CHECK:STDOUT: %N.decl: type = constraint_decl @N [concrete = constants.%N.type] {} {}
  1330. // CHECK:STDOUT: }
  1331. // CHECK:STDOUT:
  1332. // CHECK:STDOUT: constraint @N {
  1333. // CHECK:STDOUT: %Self: %N.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  1334. // CHECK:STDOUT: %N.WithSelf.decl = constraint_with_self_decl @N [concrete]
  1335. // CHECK:STDOUT:
  1336. // CHECK:STDOUT: !with Self:
  1337. // CHECK:STDOUT: %N.WithSelf.Self.as_type.impls.Z_where.type.require.decl = require_decl @N.WithSelf.Self.as_type.impls.Z_where.type.require [concrete] {
  1338. // CHECK:STDOUT: require %Self.as_type.loc10_11.1 impls %Z_where.type.loc10_19.1
  1339. // CHECK:STDOUT: } {
  1340. // CHECK:STDOUT: %Self.as_type.loc10_11.1: type = facet_access_type @N.%Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1341. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  1342. // CHECK:STDOUT: <elided>
  1343. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  1344. // CHECK:STDOUT: %.Self.ref.loc10_27: %Z.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.aac]
  1345. // CHECK:STDOUT: %.Self.as_type.loc10_32: type = facet_access_type %.Self.ref.loc10_27 [symbolic_self = constants.%.Self.as_type]
  1346. // CHECK:STDOUT: %.loc10_32: type = converted %.Self.ref.loc10_27, %.Self.as_type.loc10_32 [symbolic_self = constants.%.Self.as_type]
  1347. // CHECK:STDOUT: %C.loc10_32: type = class_type @C, @C(constants.%.Self.as_type) [symbolic_self = constants.%C.f27]
  1348. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  1349. // CHECK:STDOUT: %.Self.ref.loc10_42: %Z.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.aac]
  1350. // CHECK:STDOUT: %.Self.as_type.loc10_47: type = facet_access_type %.Self.ref.loc10_42 [symbolic_self = constants.%.Self.as_type]
  1351. // CHECK:STDOUT: %.loc10_47: type = converted %.Self.ref.loc10_42, %.Self.as_type.loc10_47 [symbolic_self = constants.%.Self.as_type]
  1352. // CHECK:STDOUT: %Y.type: type = facet_type <@Y, @Y(constants.%.Self.as_type)> [symbolic_self = constants.%Y.type.9b9]
  1353. // CHECK:STDOUT: %.loc10_19: type = where_expr %.Self [symbolic_self = constants.%Z_where.type.a6d533.1] {
  1354. // CHECK:STDOUT: requirement_base_facet_type constants.%Z.type
  1355. // CHECK:STDOUT: requirement_impls %C.loc10_32, %Y.type
  1356. // CHECK:STDOUT: }
  1357. // CHECK:STDOUT: %Z_where.type.loc10_19.1: type = facet_type <@Z where constants.%C.6c0 impls @Y, @Y(constants.%Self.as_type)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a6d533.2)]
  1358. // CHECK:STDOUT: }
  1359. // CHECK:STDOUT:
  1360. // CHECK:STDOUT: !members:
  1361. // CHECK:STDOUT: .Self = %Self
  1362. // CHECK:STDOUT: .Z = <poisoned>
  1363. // CHECK:STDOUT: .C = <poisoned>
  1364. // CHECK:STDOUT: .Y = <poisoned>
  1365. // CHECK:STDOUT: .Z = <poisoned>
  1366. // CHECK:STDOUT: .C = <poisoned>
  1367. // CHECK:STDOUT: .Y = <poisoned>
  1368. // CHECK:STDOUT:
  1369. // CHECK:STDOUT: !requires:
  1370. // CHECK:STDOUT: @N.WithSelf.Self.as_type.impls.Z_where.type.require {
  1371. // CHECK:STDOUT: require @N.WithSelf.Self.as_type.impls.Z_where.type.require.%Self.as_type.loc10_11.1 impls @N.WithSelf.Self.as_type.impls.Z_where.type.require.%Z_where.type.loc10_19.1
  1372. // CHECK:STDOUT: }
  1373. // CHECK:STDOUT: }
  1374. // CHECK:STDOUT:
  1375. // CHECK:STDOUT: generic require @N.WithSelf.Self.as_type.impls.Z_where.type.require(@N.%Self: %N.type) {
  1376. // CHECK:STDOUT: %Self: %N.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  1377. // CHECK:STDOUT: %Self.as_type.loc10_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc10_11.2 (constants.%Self.as_type)]
  1378. // CHECK:STDOUT: %C.loc10_19: type = class_type @C, @C(%Self.as_type.loc10_11.2) [symbolic = %C.loc10_19 (constants.%C.6c0)]
  1379. // CHECK:STDOUT: %Z_where.type.loc10_19.2: type = facet_type <@Z where %C.loc10_19 impls @Y, @Y(%Self.as_type.loc10_11.2)> [symbolic = %Z_where.type.loc10_19.2 (constants.%Z_where.type.a6d533.2)]
  1380. // CHECK:STDOUT: }
  1381. // CHECK:STDOUT:
  1382. // CHECK:STDOUT: specific @N.WithSelf(constants.%Self.550) {
  1383. // CHECK:STDOUT: !definition:
  1384. // CHECK:STDOUT: }
  1385. // CHECK:STDOUT:
  1386. // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%Self.550) {
  1387. // CHECK:STDOUT: %Self => constants.%Self.550
  1388. // CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%Self.as_type
  1389. // CHECK:STDOUT: %C.loc10_19 => constants.%C.6c0
  1390. // CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.a6d533.2
  1391. // CHECK:STDOUT: }
  1392. // CHECK:STDOUT:
  1393. // CHECK:STDOUT: specific @N.WithSelf(constants.%T.ea3) {
  1394. // CHECK:STDOUT: !definition:
  1395. // CHECK:STDOUT: }
  1396. // CHECK:STDOUT:
  1397. // CHECK:STDOUT: specific @N.WithSelf.Self.as_type.impls.Z_where.type.require(constants.%T.ea3) {
  1398. // CHECK:STDOUT: %Self => constants.%T.ea3
  1399. // CHECK:STDOUT: %Self.as_type.loc10_11.2 => constants.%T.as_type
  1400. // CHECK:STDOUT: %C.loc10_19 => constants.%C.dd2
  1401. // CHECK:STDOUT: %Z_where.type.loc10_19.2 => constants.%Z_where.type.a6d533.3
  1402. // CHECK:STDOUT: }
  1403. // CHECK:STDOUT: