require.carbon 42 KB

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