require.carbon 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235
  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_forward_declared.carbon
  148. library "[[@TEST_NAME]]";
  149. constraint Z;
  150. constraint Z {
  151. // 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]
  152. // CHECK:STDERR: require impls Z;
  153. // CHECK:STDERR: ^
  154. // CHECK:STDERR:
  155. require impls Z;
  156. }
  157. // --- fail_require_impls_incomplete_self_in_period_self_impls.carbon
  158. library "[[@TEST_NAME]]";
  159. constraint Z {
  160. // 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]
  161. // CHECK:STDERR: require impls type where .Self impls Z;
  162. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~
  163. // CHECK:STDERR:
  164. require impls type where .Self impls Z;
  165. }
  166. // --- fail_require_impls_incomplete_self_in_class_impls.carbon
  167. library "[[@TEST_NAME]]";
  168. class C;
  169. constraint Z {
  170. // TODO: This should be a RequireImplsReferenceCycle error since `Z` is being
  171. // used inside `Z`.
  172. // CHECK:STDERR: fail_require_impls_incomplete_self_in_class_impls.carbon:[[@LINE+4]]:17: error: semantics TODO: `facet type has constraints that we don't handle yet` [SemanticsTodo]
  173. // CHECK:STDERR: require impls type where C impls Z;
  174. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  175. // CHECK:STDERR:
  176. require impls type where C impls Z;
  177. }
  178. // --- fail_require_impls_incomplete_indirect.carbon
  179. library "[[@TEST_NAME]]";
  180. constraint Z;
  181. constraint Y {
  182. // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE+7]]:17: error: facet type `Z` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  183. // CHECK:STDERR: require impls Z;
  184. // CHECK:STDERR: ^
  185. // CHECK:STDERR: fail_require_impls_incomplete_indirect.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  186. // CHECK:STDERR: constraint Z;
  187. // CHECK:STDERR: ^~~~~~~~~~~~~
  188. // CHECK:STDERR:
  189. require impls Z;
  190. }
  191. constraint Z {
  192. require impls Y;
  193. }
  194. // --- fail_require_impls_incomplete_self_specific.carbon
  195. library "[[@TEST_NAME]]";
  196. constraint Z(T:! type) {
  197. // 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]
  198. // CHECK:STDERR: require T impls Z(Self);
  199. // CHECK:STDERR: ^~~~~~~
  200. // CHECK:STDERR:
  201. require T impls Z(Self);
  202. }
  203. // --- fail_require_impls_without_self.carbon
  204. library "[[@TEST_NAME]]";
  205. interface Y {
  206. let Y1:! type;
  207. }
  208. //@dump-sem-ir-begin
  209. constraint Z(T:! type) {
  210. // Either the type `T` or the facet type `Y` must mention `Self` in a way that
  211. // it would appear in the type structure used for impl lookup (so inside a
  212. // `where` does not count). But they don't.
  213. //
  214. // 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]
  215. // CHECK:STDERR: require T impls Y where .Y1 = Self;
  216. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217. // CHECK:STDERR:
  218. require T impls Y where .Y1 = Self;
  219. }
  220. //@dump-sem-ir-end
  221. // --- fail_require_impls_without_self_in_one_interface.carbon
  222. library "[[@TEST_NAME]]";
  223. interface Y(T:! type) {}
  224. constraint Z(T:! type) {
  225. // Self is in one interface but not the other.
  226. //
  227. // 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]
  228. // CHECK:STDERR: require T impls Y(Self) & Y({});
  229. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  230. // CHECK:STDERR:
  231. require T impls Y(Self) & Y({});
  232. }
  233. // --- fail_require_impls_without_self_in_multiple_interfaces.carbon
  234. library "[[@TEST_NAME]]";
  235. interface Y(T:! type) {}
  236. constraint Z(T:! type) {
  237. // Self does not appear in either interface, we should get an error for each.
  238. //
  239. // 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]
  240. // CHECK:STDERR: require T impls Y(()) & Y({});
  241. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  242. // CHECK:STDERR:
  243. // 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]
  244. // CHECK:STDERR: require T impls Y(()) & Y({});
  245. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  246. // CHECK:STDERR:
  247. require T impls Y(()) & Y({});
  248. }
  249. // --- fail_self_impls_self.carbon
  250. library "[[@TEST_NAME]]";
  251. constraint Z(T:! type) {
  252. // 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]
  253. // CHECK:STDERR: require impls Self;
  254. // CHECK:STDERR: ^~~~
  255. // CHECK:STDERR:
  256. require impls Self;
  257. }
  258. // --- fail_impls_type.carbon
  259. library "[[@TEST_NAME]]";
  260. class C(T:! type) {}
  261. constraint Z(T:! type) {
  262. // 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]
  263. // CHECK:STDERR: require T impls C(Self);
  264. // CHECK:STDERR: ^~~~~~~
  265. // CHECK:STDERR:
  266. require T impls C(Self);
  267. }
  268. // --- fail_non_type_impls.carbon
  269. library "[[@TEST_NAME]]";
  270. interface Y {}
  271. constraint Z(T:! type) {
  272. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+7]]:11: error: cannot implicitly convert non-type value of type `Core.IntLiteral` to `type` [ConversionFailureNonTypeToFacet]
  273. // CHECK:STDERR: require 1 impls Y;
  274. // CHECK:STDERR: ^
  275. // CHECK:STDERR: fail_non_type_impls.carbon:[[@LINE+4]]:11: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
  276. // CHECK:STDERR: require 1 impls Y;
  277. // CHECK:STDERR: ^
  278. // CHECK:STDERR:
  279. require 1 impls Y;
  280. }
  281. // --- fail_impls_non_type.carbon
  282. library "[[@TEST_NAME]]";
  283. interface Y {}
  284. constraint Z(T:! type) {
  285. // 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]
  286. // CHECK:STDERR: require impls 1;
  287. // CHECK:STDERR: ^
  288. // CHECK:STDERR:
  289. require impls 1;
  290. }
  291. // --- require_self_in_requirement.carbon
  292. library "[[@TEST_NAME]]";
  293. interface Y {
  294. let Y1:! type;
  295. }
  296. //@dump-sem-ir-begin
  297. constraint Z {
  298. // Self can appear in a requirement.
  299. require impls Y where .Y1 = Self;
  300. }
  301. //@dump-sem-ir-end
  302. // --- require_self.carbon
  303. library "[[@TEST_NAME]]";
  304. interface Z(T:! type) {}
  305. constraint N {
  306. require impls Z(Self);
  307. }
  308. impl () as Z(()) {}
  309. fn F() {
  310. () as N;
  311. }
  312. // --- fail_require_different_self.carbon
  313. library "[[@TEST_NAME]]";
  314. interface Z(T:! type) {}
  315. constraint N {
  316. require impls Z(Self);
  317. }
  318. impl () as Z({}) {}
  319. fn F() {
  320. // N requires () impls Z(Self) which is Z(()) for this query, but it impls
  321. // Z({}).
  322. //
  323. // CHECK:STDERR: fail_require_different_self.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  324. // CHECK:STDERR: () as N;
  325. // CHECK:STDERR: ^~~~~~~
  326. // CHECK:STDERR:
  327. () as N;
  328. }
  329. // --- fail_require_different_parameter.carbon
  330. library "[[@TEST_NAME]]";
  331. interface Z(T:! type) {}
  332. constraint N {
  333. require impls Z({});
  334. }
  335. impl () as Z(()) {}
  336. fn F() {
  337. // N requires () impls Z({}) but it impls Z(()).
  338. //
  339. // CHECK:STDERR: fail_require_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  340. // CHECK:STDERR: () as N;
  341. // CHECK:STDERR: ^~~~~~~
  342. // CHECK:STDERR:
  343. () as N;
  344. }
  345. // --- require_different_type_impls.carbon
  346. library "[[@TEST_NAME]]";
  347. interface Z(T:! type) {}
  348. constraint N {
  349. require {} impls Z(Self);
  350. }
  351. impl {} as Z(()) {}
  352. fn F() {
  353. () as N;
  354. }
  355. // --- require_different_type_impls_nested_constraint.carbon
  356. library "[[@TEST_NAME]]";
  357. interface Z(T:! type) {}
  358. constraint M(T:! type) {
  359. extend require impls Z(T);
  360. }
  361. constraint N {
  362. require {} impls M(Self);
  363. }
  364. impl {} as Z(()) {}
  365. fn F() {
  366. () as N;
  367. }
  368. // --- fail_require_different_type_impls_nested_constraint_without_reference_to_outer_self.carbon
  369. library "[[@TEST_NAME]]";
  370. interface Z(T:! type) {}
  371. constraint M(T:! type) {
  372. extend require impls Z(Self);
  373. }
  374. constraint N {
  375. // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up
  376. // without any interface specific referencing the `Self` of `N`.
  377. //
  378. // 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]
  379. // CHECK:STDERR: require {} impls M(Self);
  380. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  381. // CHECK:STDERR:
  382. require {} impls M(Self);
  383. }
  384. // --- fail_require_different_type_impls_nested_constraint_empty.carbon
  385. library "[[@TEST_NAME]]";
  386. constraint M(T:! type) {}
  387. constraint N {
  388. // `M(T)` does not make use of the `T`, which is assigned `Self`, so we end up
  389. // without any interface specific referencing the `Self` of `N`.
  390. //
  391. // 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]
  392. // CHECK:STDERR: require {} impls M(Self);
  393. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~
  394. // CHECK:STDERR:
  395. require {} impls M(Self);
  396. }
  397. // --- fail_require_different_type_impls_different_parameter.carbon
  398. library "[[@TEST_NAME]]";
  399. interface Z(T:! type) {}
  400. constraint N {
  401. require {} impls Z(Self);
  402. }
  403. impl {} as Z({}) {}
  404. fn F() {
  405. // N requires {} impls Z(Self) which is Z(()) for this query, but it impls
  406. // Z({}).
  407. //
  408. // CHECK:STDERR: fail_require_different_type_impls_different_parameter.carbon:[[@LINE+4]]:3: error: cannot convert type `()` into type implementing `N` [ConversionFailureTypeToFacet]
  409. // CHECK:STDERR: () as N;
  410. // CHECK:STDERR: ^~~~~~~
  411. // CHECK:STDERR:
  412. () as N;
  413. }
  414. // --- require_with_rewrite_constraint.carbon
  415. library "[[@TEST_NAME]]";
  416. interface Z(T:! type) {
  417. let X:! type;
  418. }
  419. constraint N {
  420. require {} impls Z(Self) where .X = Self;
  421. }
  422. // Will satisfy `() as N`.
  423. impl {} as Z(()) where .X = () {}
  424. fn F() {
  425. () as N;
  426. }
  427. // --- todo_fail_require_with_mismatching_rewrite_constraint.carbon
  428. library "[[@TEST_NAME]]";
  429. interface Z(T:! type) {
  430. let X:! type;
  431. }
  432. constraint N {
  433. require {} impls Z(Self) where .X = Self;
  434. }
  435. // Will not satisfy `() as N` as the rewrite does not match.
  436. impl {} as Z(()) where .X = {} {}
  437. fn F() {
  438. // TODO: Should fail, but we're currently checking the requirements of `N`
  439. // rather than of the identified facet type of `N` (which would include the
  440. // require decl's requirements).
  441. () as N;
  442. }
  443. // CHECK:STDOUT: --- extend.carbon
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: constants {
  446. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  447. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  448. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  449. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [concrete]
  450. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  451. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  452. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  453. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  454. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  455. // CHECK:STDOUT: %pattern_type.349: type = pattern_type %T.binding.as_type [symbolic]
  456. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T, @Y [symbolic]
  457. // CHECK:STDOUT: %Y.facet: %Y.type = facet_value %T.binding.as_type, (%Y.lookup_impl_witness) [symbolic]
  458. // CHECK:STDOUT: %Y.WithSelf.YY.type.7ea: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%Y.facet) [symbolic]
  459. // CHECK:STDOUT: %.1b4: type = fn_type_with_self_type %Y.WithSelf.YY.type.7ea, %Y.facet [symbolic]
  460. // CHECK:STDOUT: %impl.elem0: %.1b4 = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic]
  461. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Y.WithSelf.YY(%Y.facet) [symbolic]
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: file {
  465. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  466. // CHECK:STDOUT: }
  467. // CHECK:STDOUT:
  468. // CHECK:STDOUT: constraint @Z {
  469. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  470. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  471. // CHECK:STDOUT:
  472. // CHECK:STDOUT: !with Self:
  473. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y.type.require [concrete] {
  474. // CHECK:STDOUT: require %Self.as_type impls %Y.ref
  475. // CHECK:STDOUT: } {
  476. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  477. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  478. // CHECK:STDOUT: }
  479. // CHECK:STDOUT: %.loc9: type = specific_constant @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.ref, @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) [concrete = constants.%Y.type]
  480. // CHECK:STDOUT:
  481. // CHECK:STDOUT: !members:
  482. // CHECK:STDOUT: .Self = %Self
  483. // CHECK:STDOUT: .Y = <poisoned>
  484. // CHECK:STDOUT: .Y = <poisoned>
  485. // CHECK:STDOUT: .YY = <poisoned>
  486. // CHECK:STDOUT: extend @Z.WithSelf.%.loc9
  487. // CHECK:STDOUT:
  488. // CHECK:STDOUT: !requires:
  489. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y.type.require {
  490. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Self.as_type impls @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.ref
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT:
  494. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  495. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  496. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  497. // CHECK:STDOUT: }
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: generic fn @F(%T.loc13_6.2: %Z.type) {
  500. // CHECK:STDOUT: <elided>
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: !definition:
  503. // CHECK:STDOUT: <elided>
  504. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_6.1, @Y [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
  505. // CHECK:STDOUT: %Y.facet.loc15: %Y.type = facet_value %T.binding.as_type, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  506. // 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.7ea)]
  507. // CHECK:STDOUT: %.loc15_4.2: type = fn_type_with_self_type %Y.WithSelf.YY.type, %Y.facet.loc15 [symbolic = %.loc15_4.2 (constants.%.1b4)]
  508. // CHECK:STDOUT: %impl.elem0.loc15_4.2: @F.%.loc15_4.2 (%.1b4) = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  509. // 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)]
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: fn(%t.param: @F.%T.binding.as_type (%T.binding.as_type)) {
  512. // CHECK:STDOUT: !entry:
  513. // CHECK:STDOUT: %T.ref.loc15: %Z.type = name_ref T, %T.loc13_6.2 [symbolic = %T.loc13_6.1 (constants.%T)]
  514. // CHECK:STDOUT: %T.as_type.loc15: type = facet_access_type %T.ref.loc15 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  515. // CHECK:STDOUT: %.loc15_4.1: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  516. // CHECK:STDOUT: %YY.ref.loc15: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  517. // CHECK:STDOUT: %impl.elem0.loc15_4.1: @F.%.loc15_4.2 (%.1b4) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  518. // 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)]
  519. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc15: init %empty_tuple.type = call %specific_impl_fn.loc15_4.1()
  520. // CHECK:STDOUT: %T.ref.loc16: %Z.type = name_ref T, %T.loc13_6.2 [symbolic = %T.loc13_6.1 (constants.%T)]
  521. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  522. // CHECK:STDOUT: %YY.ref.loc16: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  523. // CHECK:STDOUT: %T.as_type.loc16: type = facet_access_type %T.ref.loc16 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  524. // 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)]
  525. // CHECK:STDOUT: %.loc16: %Y.type = converted %T.ref.loc16, %Y.facet.loc16 [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  526. // CHECK:STDOUT: %impl.elem0.loc16: @F.%.loc15_4.2 (%.1b4) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  527. // 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)]
  528. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc16: init %empty_tuple.type = call %specific_impl_fn.loc16()
  529. // CHECK:STDOUT: %t.ref: @F.%T.binding.as_type (%T.binding.as_type) = name_ref t, %t
  530. // CHECK:STDOUT: %YY.ref.loc18: %Y.assoc_type = name_ref YY, @Y.WithSelf.%assoc0 [concrete = constants.%assoc0]
  531. // CHECK:STDOUT: %impl.elem0.loc18: @F.%.loc15_4.2 (%.1b4) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  532. // 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)]
  533. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc18: init %empty_tuple.type = call %specific_impl_fn.loc18()
  534. // CHECK:STDOUT: <elided>
  535. // CHECK:STDOUT: }
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  539. // CHECK:STDOUT: !definition:
  540. // CHECK:STDOUT: }
  541. // CHECK:STDOUT:
  542. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  543. // CHECK:STDOUT: %Self => constants.%Self.550
  544. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: specific @F(constants.%T) {
  548. // CHECK:STDOUT: %T.loc13_6.1 => constants.%T
  549. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  550. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.349
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  554. // CHECK:STDOUT: !definition:
  555. // CHECK:STDOUT: }
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  558. // CHECK:STDOUT: %Self => constants.%T
  559. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  560. // CHECK:STDOUT: }
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: --- extend_with_self.carbon
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: constants {
  565. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  566. // CHECK:STDOUT: %Y.type.82b: type = generic_interface_type @Y [concrete]
  567. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  568. // CHECK:STDOUT: %Y.generic: %Y.type.82b = struct_value () [concrete]
  569. // CHECK:STDOUT: %Y.type.a16: type = facet_type <@Y, @Y(%T.67d)> [symbolic]
  570. // CHECK:STDOUT: %Self.6f4: %Y.type.a16 = symbolic_binding Self, 1 [symbolic]
  571. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  572. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  573. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  574. // CHECK:STDOUT: %Y.type.83d: type = facet_type <@Y, @Y(%Self.binding.as_type)> [symbolic]
  575. // CHECK:STDOUT: %require_complete.057: <witness> = require_complete_type %Y.type.83d [symbolic]
  576. // CHECK:STDOUT: %T.f45: %Z.type = symbolic_binding T, 0 [symbolic]
  577. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T.f45 [symbolic]
  578. // CHECK:STDOUT: %pattern_type.349: type = pattern_type %T.binding.as_type [symbolic]
  579. // CHECK:STDOUT: %Y.type.55c: type = facet_type <@Y, @Y(%T.binding.as_type)> [symbolic]
  580. // CHECK:STDOUT: %require_complete.ec2: <witness> = require_complete_type %Y.type.55c [symbolic]
  581. // CHECK:STDOUT: %Y.assoc_type.eee: type = assoc_entity_type @Y, @Y(%T.binding.as_type) [symbolic]
  582. // CHECK:STDOUT: %assoc0.e42: %Y.assoc_type.eee = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [symbolic]
  583. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.f45, @Y, @Y(%T.binding.as_type) [symbolic]
  584. // CHECK:STDOUT: %Y.facet: %Y.type.55c = facet_value %T.binding.as_type, (%Y.lookup_impl_witness) [symbolic]
  585. // CHECK:STDOUT: %Y.WithSelf.YY.type.aeb: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%T.binding.as_type, %Y.facet) [symbolic]
  586. // CHECK:STDOUT: %.b61: type = fn_type_with_self_type %Y.WithSelf.YY.type.aeb, %Y.facet [symbolic]
  587. // CHECK:STDOUT: %impl.elem0: %.b61 = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic]
  588. // CHECK:STDOUT: %specific_impl_fn: <specific function> = specific_impl_function %impl.elem0, @Y.WithSelf.YY(%T.binding.as_type, %Y.facet) [symbolic]
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: file {
  592. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  593. // CHECK:STDOUT: }
  594. // CHECK:STDOUT:
  595. // CHECK:STDOUT: constraint @Z {
  596. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  597. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  598. // CHECK:STDOUT:
  599. // CHECK:STDOUT: !with Self:
  600. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y.type.require [concrete] {
  601. // CHECK:STDOUT: require %Self.as_type.loc9_18 impls %Y.type.loc9_30.1
  602. // CHECK:STDOUT: } {
  603. // CHECK:STDOUT: %Self.as_type.loc9_18: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  604. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  605. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  606. // CHECK:STDOUT: %Self.as_type.loc9_30: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  607. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type.loc9_30 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  608. // CHECK:STDOUT: %Y.type.loc9_30.1: type = facet_type <@Y, @Y(constants.%Self.binding.as_type)> [symbolic = %Y.type.loc9_30.2 (constants.%Y.type.83d)]
  609. // CHECK:STDOUT: }
  610. // CHECK:STDOUT: %.loc9: type = specific_constant @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.type.loc9_30.1, @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) [symbolic = %Y.type (constants.%Y.type.83d)]
  611. // CHECK:STDOUT:
  612. // CHECK:STDOUT: !members:
  613. // CHECK:STDOUT: .Self = %Self
  614. // CHECK:STDOUT: .Y = <poisoned>
  615. // CHECK:STDOUT: .Y = <poisoned>
  616. // CHECK:STDOUT: .YY = <poisoned>
  617. // CHECK:STDOUT: extend @Z.WithSelf.%.loc9
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: !requires:
  620. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y.type.require {
  621. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Self.as_type.loc9_18 impls @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.type.loc9_30.1
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  626. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  627. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  628. // CHECK:STDOUT: %Y.type.loc9_30.2: type = facet_type <@Y, @Y(%Self.binding.as_type)> [symbolic = %Y.type.loc9_30.2 (constants.%Y.type.83d)]
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT:
  631. // CHECK:STDOUT: generic fn @F(%T.loc13_6.2: %Z.type) {
  632. // CHECK:STDOUT: <elided>
  633. // CHECK:STDOUT:
  634. // CHECK:STDOUT: !definition:
  635. // CHECK:STDOUT: <elided>
  636. // CHECK:STDOUT: %Y.type.loc15: type = facet_type <@Y, @Y(%T.binding.as_type)> [symbolic = %Y.type.loc15 (constants.%Y.type.55c)]
  637. // CHECK:STDOUT: %require_complete.loc15: <witness> = require_complete_type %Y.type.loc15 [symbolic = %require_complete.loc15 (constants.%require_complete.ec2)]
  638. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y, @Y(%T.binding.as_type) [symbolic = %Y.assoc_type (constants.%Y.assoc_type.eee)]
  639. // CHECK:STDOUT: %assoc0: @F.%Y.assoc_type (%Y.assoc_type.eee) = assoc_entity element0, @Y.WithSelf.%Y.WithSelf.YY.decl [symbolic = %assoc0 (constants.%assoc0.e42)]
  640. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %T.loc13_6.1, @Y, @Y(%T.binding.as_type) [symbolic = %Y.lookup_impl_witness (constants.%Y.lookup_impl_witness)]
  641. // CHECK:STDOUT: %Y.facet.loc15: @F.%Y.type.loc15 (%Y.type.55c) = facet_value %T.binding.as_type, (%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  642. // CHECK:STDOUT: %Y.WithSelf.YY.type: type = fn_type @Y.WithSelf.YY, @Y.WithSelf(%T.binding.as_type, %Y.facet.loc15) [symbolic = %Y.WithSelf.YY.type (constants.%Y.WithSelf.YY.type.aeb)]
  643. // CHECK:STDOUT: %.loc15_4.3: type = fn_type_with_self_type %Y.WithSelf.YY.type, %Y.facet.loc15 [symbolic = %.loc15_4.3 (constants.%.b61)]
  644. // CHECK:STDOUT: %impl.elem0.loc15_4.2: @F.%.loc15_4.3 (%.b61) = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  645. // CHECK:STDOUT: %specific_impl_fn.loc15_4.2: <specific function> = specific_impl_function %impl.elem0.loc15_4.2, @Y.WithSelf.YY(%T.binding.as_type, %Y.facet.loc15) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: fn(%t.param: @F.%T.binding.as_type (%T.binding.as_type)) {
  648. // CHECK:STDOUT: !entry:
  649. // CHECK:STDOUT: %T.ref.loc15: %Z.type = name_ref T, %T.loc13_6.2 [symbolic = %T.loc13_6.1 (constants.%T.f45)]
  650. // CHECK:STDOUT: %T.as_type.loc15: type = facet_access_type %T.ref.loc15 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  651. // CHECK:STDOUT: %.loc15_4.1: type = converted %T.ref.loc15, %T.as_type.loc15 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  652. // CHECK:STDOUT: %.loc15_4.2: @F.%Y.assoc_type (%Y.assoc_type.eee) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.binding.as_type, constants.%T.f45) [symbolic = %assoc0 (constants.%assoc0.e42)]
  653. // CHECK:STDOUT: %YY.ref.loc15: @F.%Y.assoc_type (%Y.assoc_type.eee) = name_ref YY, %.loc15_4.2 [symbolic = %assoc0 (constants.%assoc0.e42)]
  654. // CHECK:STDOUT: %impl.elem0.loc15_4.1: @F.%.loc15_4.3 (%.b61) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  655. // CHECK:STDOUT: %specific_impl_fn.loc15_4.1: <specific function> = specific_impl_function %impl.elem0.loc15_4.1, @Y.WithSelf.YY(constants.%T.binding.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  656. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc15: init %empty_tuple.type = call %specific_impl_fn.loc15_4.1()
  657. // CHECK:STDOUT: %T.ref.loc16_3: %Z.type = name_ref T, %T.loc13_6.2 [symbolic = %T.loc13_6.1 (constants.%T.f45)]
  658. // CHECK:STDOUT: %Y.ref: %Y.type.82b = name_ref Y, file.%Y.decl [concrete = constants.%Y.generic]
  659. // CHECK:STDOUT: %T.ref.loc16_8: %Z.type = name_ref T, %T.loc13_6.2 [symbolic = %T.loc13_6.1 (constants.%T.f45)]
  660. // CHECK:STDOUT: %T.as_type.loc16_9: type = facet_access_type %T.ref.loc16_8 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  661. // CHECK:STDOUT: %.loc16_9: type = converted %T.ref.loc16_8, %T.as_type.loc16_9 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  662. // CHECK:STDOUT: %Y.type.loc16: type = facet_type <@Y, @Y(constants.%T.binding.as_type)> [symbolic = %Y.type.loc15 (constants.%Y.type.55c)]
  663. // CHECK:STDOUT: %.loc16_10: @F.%Y.assoc_type (%Y.assoc_type.eee) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.binding.as_type, constants.%Self.6f4) [symbolic = %assoc0 (constants.%assoc0.e42)]
  664. // CHECK:STDOUT: %YY.ref.loc16: @F.%Y.assoc_type (%Y.assoc_type.eee) = name_ref YY, %.loc16_10 [symbolic = %assoc0 (constants.%assoc0.e42)]
  665. // CHECK:STDOUT: %T.as_type.loc16_4: type = facet_access_type %T.ref.loc16_3 [symbolic = %T.binding.as_type (constants.%T.binding.as_type)]
  666. // CHECK:STDOUT: %Y.facet.loc16: @F.%Y.type.loc15 (%Y.type.55c) = facet_value %T.as_type.loc16_4, (constants.%Y.lookup_impl_witness) [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  667. // CHECK:STDOUT: %.loc16_4: @F.%Y.type.loc15 (%Y.type.55c) = converted %T.ref.loc16_3, %Y.facet.loc16 [symbolic = %Y.facet.loc15 (constants.%Y.facet)]
  668. // CHECK:STDOUT: %impl.elem0.loc16: @F.%.loc15_4.3 (%.b61) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  669. // CHECK:STDOUT: %specific_impl_fn.loc16: <specific function> = specific_impl_function %impl.elem0.loc16, @Y.WithSelf.YY(constants.%T.binding.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  670. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc16: init %empty_tuple.type = call %specific_impl_fn.loc16()
  671. // CHECK:STDOUT: %t.ref: @F.%T.binding.as_type (%T.binding.as_type) = name_ref t, %t
  672. // CHECK:STDOUT: %.loc18: @F.%Y.assoc_type (%Y.assoc_type.eee) = specific_constant @Y.WithSelf.%assoc0.loc4_10.1, @Y.WithSelf(constants.%T.binding.as_type, constants.%T.f45) [symbolic = %assoc0 (constants.%assoc0.e42)]
  673. // CHECK:STDOUT: %YY.ref.loc18: @F.%Y.assoc_type (%Y.assoc_type.eee) = name_ref YY, %.loc18 [symbolic = %assoc0 (constants.%assoc0.e42)]
  674. // CHECK:STDOUT: %impl.elem0.loc18: @F.%.loc15_4.3 (%.b61) = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic = %impl.elem0.loc15_4.2 (constants.%impl.elem0)]
  675. // CHECK:STDOUT: %specific_impl_fn.loc18: <specific function> = specific_impl_function %impl.elem0.loc18, @Y.WithSelf.YY(constants.%T.binding.as_type, constants.%Y.facet) [symbolic = %specific_impl_fn.loc15_4.2 (constants.%specific_impl_fn)]
  676. // CHECK:STDOUT: %Y.WithSelf.YY.call.loc18: init %empty_tuple.type = call %specific_impl_fn.loc18()
  677. // CHECK:STDOUT: <elided>
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT:
  681. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  682. // CHECK:STDOUT: !definition:
  683. // CHECK:STDOUT: %Self => constants.%Self.550
  684. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  685. // CHECK:STDOUT: %Y.type => constants.%Y.type.83d
  686. // CHECK:STDOUT: %require_complete => constants.%require_complete.057
  687. // CHECK:STDOUT: }
  688. // CHECK:STDOUT:
  689. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  690. // CHECK:STDOUT: %Self => constants.%Self.550
  691. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  692. // CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.83d
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: specific @F(constants.%T.f45) {
  696. // CHECK:STDOUT: %T.loc13_6.1 => constants.%T.f45
  697. // CHECK:STDOUT: %T.binding.as_type => constants.%T.binding.as_type
  698. // CHECK:STDOUT: %pattern_type => constants.%pattern_type.349
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T.f45) {
  702. // CHECK:STDOUT: !definition:
  703. // CHECK:STDOUT: %Self => constants.%T.f45
  704. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  705. // CHECK:STDOUT: %Y.type => constants.%Y.type.55c
  706. // CHECK:STDOUT: %require_complete => constants.%require_complete.ec2
  707. // CHECK:STDOUT: }
  708. // CHECK:STDOUT:
  709. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%T.f45) {
  710. // CHECK:STDOUT: %Self => constants.%T.f45
  711. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  712. // CHECK:STDOUT: %Y.type.loc9_30.2 => constants.%Y.type.55c
  713. // CHECK:STDOUT: }
  714. // CHECK:STDOUT:
  715. // CHECK:STDOUT: --- implicit_self_impls.carbon
  716. // CHECK:STDOUT:
  717. // CHECK:STDOUT: constants {
  718. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  719. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  720. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  721. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  722. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  723. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: file {
  727. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  728. // CHECK:STDOUT: }
  729. // CHECK:STDOUT:
  730. // CHECK:STDOUT: constraint @Z {
  731. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  732. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  733. // CHECK:STDOUT:
  734. // CHECK:STDOUT: !with Self:
  735. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y.type.require [concrete] {
  736. // CHECK:STDOUT: require %Self.as_type impls %Y.ref
  737. // CHECK:STDOUT: } {
  738. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  739. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: !members:
  743. // CHECK:STDOUT: .Self = %Self
  744. // CHECK:STDOUT: .Y = <poisoned>
  745. // CHECK:STDOUT: .Y = <poisoned>
  746. // CHECK:STDOUT:
  747. // CHECK:STDOUT: !requires:
  748. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y.type.require {
  749. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Self.as_type impls @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.ref
  750. // CHECK:STDOUT: }
  751. // CHECK:STDOUT: }
  752. // CHECK:STDOUT:
  753. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  754. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  755. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  756. // CHECK:STDOUT: }
  757. // CHECK:STDOUT:
  758. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  759. // CHECK:STDOUT: !definition:
  760. // CHECK:STDOUT: }
  761. // CHECK:STDOUT:
  762. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  763. // CHECK:STDOUT: %Self => constants.%Self.550
  764. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  765. // CHECK:STDOUT: }
  766. // CHECK:STDOUT:
  767. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  768. // CHECK:STDOUT: !definition:
  769. // CHECK:STDOUT: }
  770. // CHECK:STDOUT:
  771. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  772. // CHECK:STDOUT: %Self => constants.%T
  773. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  774. // CHECK:STDOUT: }
  775. // CHECK:STDOUT:
  776. // CHECK:STDOUT: --- explicit_self_impls.carbon
  777. // CHECK:STDOUT:
  778. // CHECK:STDOUT: constants {
  779. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  780. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  781. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  782. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  783. // CHECK:STDOUT: %T: %Z.type = symbolic_binding T, 0 [symbolic]
  784. // CHECK:STDOUT: %T.binding.as_type: type = symbolic_binding_type T, 0, %T [symbolic]
  785. // CHECK:STDOUT: }
  786. // CHECK:STDOUT:
  787. // CHECK:STDOUT: file {
  788. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  789. // CHECK:STDOUT: }
  790. // CHECK:STDOUT:
  791. // CHECK:STDOUT: constraint @Z {
  792. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  793. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  794. // CHECK:STDOUT:
  795. // CHECK:STDOUT: !with Self:
  796. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y.type.require [concrete] {
  797. // CHECK:STDOUT: require %.loc9 impls %Y.ref
  798. // CHECK:STDOUT: } {
  799. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  800. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  801. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  802. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  803. // CHECK:STDOUT: }
  804. // CHECK:STDOUT:
  805. // CHECK:STDOUT: !members:
  806. // CHECK:STDOUT: .Self = %Self
  807. // CHECK:STDOUT: .Y = <poisoned>
  808. // CHECK:STDOUT: .Y = <poisoned>
  809. // CHECK:STDOUT:
  810. // CHECK:STDOUT: !requires:
  811. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y.type.require {
  812. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%.loc9 impls @Z.WithSelf.Self.binding.as_type.impls.Y.type.require.%Y.ref
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(@Z.%Self: %Z.type) {
  817. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  818. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  819. // CHECK:STDOUT: }
  820. // CHECK:STDOUT:
  821. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {
  822. // CHECK:STDOUT: !definition:
  823. // CHECK:STDOUT: }
  824. // CHECK:STDOUT:
  825. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%Self.550) {
  826. // CHECK:STDOUT: %Self => constants.%Self.550
  827. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  828. // CHECK:STDOUT: }
  829. // CHECK:STDOUT:
  830. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T) {
  831. // CHECK:STDOUT: !definition:
  832. // CHECK:STDOUT: }
  833. // CHECK:STDOUT:
  834. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y.type.require(constants.%T) {
  835. // CHECK:STDOUT: %Self => constants.%T
  836. // CHECK:STDOUT: %Self.binding.as_type => constants.%T.binding.as_type
  837. // CHECK:STDOUT: }
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: --- explicit_self_specific_impls.carbon
  840. // CHECK:STDOUT:
  841. // CHECK:STDOUT: constants {
  842. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  843. // CHECK:STDOUT: %C.type: type = generic_class_type @C [concrete]
  844. // CHECK:STDOUT: %C.generic: %C.type = struct_value () [concrete]
  845. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  846. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  847. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  848. // CHECK:STDOUT: %C.237: type = class_type @C, @C(%Self.binding.as_type) [symbolic]
  849. // CHECK:STDOUT: }
  850. // CHECK:STDOUT:
  851. // CHECK:STDOUT: file {
  852. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  853. // CHECK:STDOUT: }
  854. // CHECK:STDOUT:
  855. // CHECK:STDOUT: constraint @Z {
  856. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  857. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  858. // CHECK:STDOUT:
  859. // CHECK:STDOUT: !with Self:
  860. // CHECK:STDOUT: %Z.WithSelf.C.impls.Y.type.require.decl = require_decl @Z.WithSelf.C.impls.Y.type.require [concrete] {
  861. // CHECK:STDOUT: require %C.loc9_17.1 impls %Y.ref
  862. // CHECK:STDOUT: } {
  863. // CHECK:STDOUT: %C.ref: %C.type = name_ref C, file.%C.decl [concrete = constants.%C.generic]
  864. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  865. // CHECK:STDOUT: %Self.as_type: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  866. // CHECK:STDOUT: %.loc9: type = converted %Self.ref, %Self.as_type [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  867. // CHECK:STDOUT: %C.loc9_17.1: type = class_type @C, @C(constants.%Self.binding.as_type) [symbolic = %C.loc9_17.2 (constants.%C.237)]
  868. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: !members:
  872. // CHECK:STDOUT: .Self = %Self
  873. // CHECK:STDOUT: .C = <poisoned>
  874. // CHECK:STDOUT: .Y = <poisoned>
  875. // CHECK:STDOUT: .C = <poisoned>
  876. // CHECK:STDOUT: .Y = <poisoned>
  877. // CHECK:STDOUT:
  878. // CHECK:STDOUT: !requires:
  879. // CHECK:STDOUT: @Z.WithSelf.C.impls.Y.type.require {
  880. // CHECK:STDOUT: require @Z.WithSelf.C.impls.Y.type.require.%C.loc9_17.1 impls @Z.WithSelf.C.impls.Y.type.require.%Y.ref
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT: }
  883. // CHECK:STDOUT:
  884. // CHECK:STDOUT: generic require @Z.WithSelf.C.impls.Y.type.require(@Z.%Self: %Z.type) {
  885. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  886. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  887. // CHECK:STDOUT: %C.loc9_17.2: type = class_type @C, @C(%Self.binding.as_type) [symbolic = %C.loc9_17.2 (constants.%C.237)]
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT:
  890. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  891. // CHECK:STDOUT:
  892. // CHECK:STDOUT: specific @Z.WithSelf.C.impls.Y.type.require(constants.%Self.550) {
  893. // CHECK:STDOUT: %Self => constants.%Self.550
  894. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  895. // CHECK:STDOUT: %C.loc9_17.2 => constants.%C.237
  896. // CHECK:STDOUT: }
  897. // CHECK:STDOUT:
  898. // CHECK:STDOUT: --- require_impls_where.carbon
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: constants {
  901. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  902. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  903. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y1 [concrete]
  904. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  905. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  906. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  907. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  908. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  909. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  910. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  911. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  912. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  913. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %empty_tuple.type> [concrete]
  914. // CHECK:STDOUT: }
  915. // CHECK:STDOUT:
  916. // CHECK:STDOUT: file {
  917. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  918. // CHECK:STDOUT: }
  919. // CHECK:STDOUT:
  920. // CHECK:STDOUT: constraint @Z {
  921. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  922. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  923. // CHECK:STDOUT:
  924. // CHECK:STDOUT: !with Self:
  925. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require [concrete] {
  926. // CHECK:STDOUT: require %Self.as_type impls %.loc7_19
  927. // CHECK:STDOUT: } {
  928. // CHECK:STDOUT: %Self.as_type: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  929. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  930. // CHECK:STDOUT: <elided>
  931. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  932. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  933. // CHECK:STDOUT: %.loc7_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  934. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  935. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  936. // CHECK:STDOUT: %.loc7_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  937. // CHECK:STDOUT: %.loc7_32.2: type = converted %.loc7_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  938. // CHECK:STDOUT: %.loc7_19: type = where_expr %.Self [concrete = constants.%Y_where.type] {
  939. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  940. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc7_32.2
  941. // CHECK:STDOUT: }
  942. // CHECK:STDOUT: }
  943. // CHECK:STDOUT:
  944. // CHECK:STDOUT: !members:
  945. // CHECK:STDOUT: .Self = %Self
  946. // CHECK:STDOUT: .Y = <poisoned>
  947. // CHECK:STDOUT: .Y = <poisoned>
  948. // CHECK:STDOUT:
  949. // CHECK:STDOUT: !requires:
  950. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require {
  951. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.%Self.as_type impls @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.%.loc7_19
  952. // CHECK:STDOUT: }
  953. // CHECK:STDOUT: }
  954. // CHECK:STDOUT:
  955. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  956. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  957. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  958. // CHECK:STDOUT: }
  959. // CHECK:STDOUT:
  960. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  961. // CHECK:STDOUT:
  962. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require(constants.%Self.550) {
  963. // CHECK:STDOUT: %Self => constants.%Self.550
  964. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  965. // CHECK:STDOUT: }
  966. // CHECK:STDOUT:
  967. // CHECK:STDOUT: --- fail_require_impls_incomplete_constraint.carbon
  968. // CHECK:STDOUT:
  969. // CHECK:STDOUT: constants {
  970. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  971. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic]
  972. // CHECK:STDOUT: }
  973. // CHECK:STDOUT:
  974. // CHECK:STDOUT: file {
  975. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  976. // CHECK:STDOUT: }
  977. // CHECK:STDOUT:
  978. // CHECK:STDOUT: constraint @Z {
  979. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  980. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  981. // CHECK:STDOUT:
  982. // CHECK:STDOUT: !members:
  983. // CHECK:STDOUT: .Self = %Self
  984. // CHECK:STDOUT: .Y = <poisoned>
  985. // CHECK:STDOUT: .Y = <poisoned>
  986. // CHECK:STDOUT:
  987. // CHECK:STDOUT: !requires:
  988. // CHECK:STDOUT: }
  989. // CHECK:STDOUT:
  990. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self) {}
  991. // CHECK:STDOUT:
  992. // CHECK:STDOUT: --- fail_require_impls_without_self.carbon
  993. // CHECK:STDOUT:
  994. // CHECK:STDOUT: constants {
  995. // CHECK:STDOUT: %T: type = symbolic_binding T, 0 [symbolic]
  996. // CHECK:STDOUT: %pattern_type: type = pattern_type type [concrete]
  997. // CHECK:STDOUT: %Z.type.7a8: type = generic_named_constaint_type @Z [concrete]
  998. // CHECK:STDOUT: %empty_struct: %Z.type.7a8 = struct_value () [concrete]
  999. // CHECK:STDOUT: %Z.type.d68: type = facet_type <@Z, @Z(%T)> [symbolic]
  1000. // CHECK:STDOUT: %Self.31c: %Z.type.d68 = symbolic_binding Self, 1 [symbolic]
  1001. // CHECK:STDOUT: }
  1002. // CHECK:STDOUT:
  1003. // CHECK:STDOUT: file {
  1004. // CHECK:STDOUT: %Z.decl: %Z.type.7a8 = constraint_decl @Z [concrete = constants.%empty_struct] {
  1005. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  1006. // CHECK:STDOUT: } {
  1007. // CHECK:STDOUT: %.loc8_18.1: type = splice_block %.loc8_18.2 [concrete = type] {
  1008. // CHECK:STDOUT: <elided>
  1009. // CHECK:STDOUT: %.loc8_18.2: type = type_literal type [concrete = type]
  1010. // CHECK:STDOUT: }
  1011. // CHECK:STDOUT: %T.loc8_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc8_14.1 (constants.%T)]
  1012. // CHECK:STDOUT: }
  1013. // CHECK:STDOUT: }
  1014. // CHECK:STDOUT:
  1015. // CHECK:STDOUT: generic constraint @Z(%T.loc8_14.2: type) {
  1016. // CHECK:STDOUT: %T.loc8_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc8_14.1 (constants.%T)]
  1017. // CHECK:STDOUT:
  1018. // CHECK:STDOUT: !definition:
  1019. // CHECK:STDOUT: %Z.type: type = facet_type <@Z, @Z(%T.loc8_14.1)> [symbolic = %Z.type (constants.%Z.type.d68)]
  1020. // CHECK:STDOUT: %Self.loc8_24.2: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  1021. // CHECK:STDOUT:
  1022. // CHECK:STDOUT: constraint {
  1023. // CHECK:STDOUT: %Self.loc8_24.1: @Z.%Z.type (%Z.type.d68) = symbolic_binding Self, 1 [symbolic = %Self.loc8_24.2 (constants.%Self.31c)]
  1024. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1025. // CHECK:STDOUT:
  1026. // CHECK:STDOUT: !members:
  1027. // CHECK:STDOUT: .Self = %Self.loc8_24.1
  1028. // CHECK:STDOUT: .T = <poisoned>
  1029. // CHECK:STDOUT: .Y = <poisoned>
  1030. // CHECK:STDOUT: .T = <poisoned>
  1031. // CHECK:STDOUT: .Y = <poisoned>
  1032. // CHECK:STDOUT:
  1033. // CHECK:STDOUT: !requires:
  1034. // CHECK:STDOUT: }
  1035. // CHECK:STDOUT: }
  1036. // CHECK:STDOUT:
  1037. // CHECK:STDOUT: specific @Z(constants.%T) {
  1038. // CHECK:STDOUT: %T.loc8_14.1 => constants.%T
  1039. // CHECK:STDOUT: }
  1040. // CHECK:STDOUT:
  1041. // CHECK:STDOUT: specific @Z.WithSelf(constants.%T, constants.%Self.31c) {}
  1042. // CHECK:STDOUT:
  1043. // CHECK:STDOUT: --- require_self_in_requirement.carbon
  1044. // CHECK:STDOUT:
  1045. // CHECK:STDOUT: constants {
  1046. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  1047. // CHECK:STDOUT: %Y.assoc_type: type = assoc_entity_type @Y [concrete]
  1048. // CHECK:STDOUT: %assoc0: %Y.assoc_type = assoc_entity element0, @Y.WithSelf.%Y1 [concrete]
  1049. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  1050. // CHECK:STDOUT: %Self.550: %Z.type = symbolic_binding Self, 0 [symbolic]
  1051. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self.550 [symbolic]
  1052. // CHECK:STDOUT: %.Self: %Y.type = symbolic_binding .Self [symbolic_self]
  1053. // CHECK:STDOUT: %.Self.binding.as_type: type = symbolic_binding_type .Self, %.Self [symbolic_self]
  1054. // CHECK:STDOUT: %Y.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @Y [symbolic_self]
  1055. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %Y.lookup_impl_witness, element0 [symbolic_self]
  1056. // CHECK:STDOUT: %Y_where.type: type = facet_type <@Y where %impl.elem0 = %Self.binding.as_type> [symbolic]
  1057. // CHECK:STDOUT: }
  1058. // CHECK:STDOUT:
  1059. // CHECK:STDOUT: file {
  1060. // CHECK:STDOUT: %Z.decl: type = constraint_decl @Z [concrete = constants.%Z.type] {} {}
  1061. // CHECK:STDOUT: }
  1062. // CHECK:STDOUT:
  1063. // CHECK:STDOUT: constraint @Z {
  1064. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  1065. // CHECK:STDOUT: %Z.WithSelf.decl = constraint_with_self_decl @Z [concrete]
  1066. // CHECK:STDOUT:
  1067. // CHECK:STDOUT: !with Self:
  1068. // CHECK:STDOUT: %Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.decl = require_decl @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require [concrete] {
  1069. // CHECK:STDOUT: require %Self.as_type.loc10_11 impls %.loc10_19
  1070. // CHECK:STDOUT: } {
  1071. // CHECK:STDOUT: %Self.as_type.loc10_11: type = facet_access_type @Z.%Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1072. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  1073. // CHECK:STDOUT: <elided>
  1074. // CHECK:STDOUT: %.Self.ref: %Y.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  1075. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.binding.as_type]
  1076. // CHECK:STDOUT: %.loc10_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.binding.as_type]
  1077. // CHECK:STDOUT: %Y1.ref: %Y.assoc_type = name_ref Y1, @Y1.%assoc0 [concrete = constants.%assoc0]
  1078. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%Y.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  1079. // CHECK:STDOUT: %Self.ref: %Z.type = name_ref Self, @Z.%Self [symbolic = %Self (constants.%Self.550)]
  1080. // CHECK:STDOUT: %Self.as_type.loc10_31: type = facet_access_type %Self.ref [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1081. // CHECK:STDOUT: %.loc10_31: type = converted %Self.ref, %Self.as_type.loc10_31 [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1082. // CHECK:STDOUT: %.loc10_19: type = where_expr %.Self [symbolic = %Y_where.type (constants.%Y_where.type)] {
  1083. // CHECK:STDOUT: requirement_base_facet_type constants.%Y.type
  1084. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc10_31
  1085. // CHECK:STDOUT: }
  1086. // CHECK:STDOUT: }
  1087. // CHECK:STDOUT:
  1088. // CHECK:STDOUT: !members:
  1089. // CHECK:STDOUT: .Self = %Self
  1090. // CHECK:STDOUT: .Y = <poisoned>
  1091. // CHECK:STDOUT: .Y = <poisoned>
  1092. // CHECK:STDOUT:
  1093. // CHECK:STDOUT: !requires:
  1094. // CHECK:STDOUT: @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require {
  1095. // CHECK:STDOUT: require @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.%Self.as_type.loc10_11 impls @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require.%.loc10_19
  1096. // CHECK:STDOUT: }
  1097. // CHECK:STDOUT: }
  1098. // CHECK:STDOUT:
  1099. // CHECK:STDOUT: generic require @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require(@Z.%Self: %Z.type) {
  1100. // CHECK:STDOUT: %Self: %Z.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  1101. // CHECK:STDOUT: %Self.binding.as_type: type = symbolic_binding_type Self, 0, %Self [symbolic = %Self.binding.as_type (constants.%Self.binding.as_type)]
  1102. // 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)]
  1103. // CHECK:STDOUT: }
  1104. // CHECK:STDOUT:
  1105. // CHECK:STDOUT: specific @Z.WithSelf(constants.%Self.550) {}
  1106. // CHECK:STDOUT:
  1107. // CHECK:STDOUT: specific @Z.WithSelf.Self.binding.as_type.impls.Y_where.type.require(constants.%Self.550) {
  1108. // CHECK:STDOUT: %Self => constants.%Self.550
  1109. // CHECK:STDOUT: %Self.binding.as_type => constants.%Self.binding.as_type
  1110. // CHECK:STDOUT: %Y_where.type => constants.%Y_where.type
  1111. // CHECK:STDOUT: }
  1112. // CHECK:STDOUT: