require.carbon 36 KB

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