require.carbon 43 KB

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