period_self.carbon 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  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/facet/period_self.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/period_self.carbon
  12. // --- period_self_param.carbon
  13. library "[[@TEST_NAME]]";
  14. //@dump-sem-ir-begin
  15. interface I(T:! type) {
  16. let I1:! type;
  17. }
  18. fn F(T:! I(.Self) where .I1 = ()) -> T.I1 {
  19. return ();
  20. }
  21. fn G(T:! I(.Self as type) where .I1 = ()) -> T.I1 {
  22. return ();
  23. }
  24. //@dump-sem-ir-end
  25. // --- underscore_identifier_name.carbon
  26. library "[[@TEST_NAME]]";
  27. interface I(T:! type) {
  28. let I1:! type;
  29. }
  30. // Underscore as the identifier name produces a different parse tree for the
  31. // binding pattern.
  32. fn G(_:! I(.Self) where .I1 = ()) {}
  33. // --- fail_period_self_as_type.carbon
  34. library "[[@TEST_NAME]]";
  35. // TODO: We should diagnose this use of `.Self` directly rather than later when
  36. // it is converted to `type`.
  37. interface I(T:! .Self) {
  38. // CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+7]]:13: error: cannot implicitly convert non-type value of type `.Self` to `type` [ConversionFailureNonTypeToFacet]
  39. // CHECK:STDERR: fn G() -> T;
  40. // CHECK:STDERR: ^
  41. // CHECK:STDERR: fail_period_self_as_type.carbon:[[@LINE+4]]:13: note: type `.Self` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessInContext]
  42. // CHECK:STDERR: fn G() -> T;
  43. // CHECK:STDERR: ^
  44. // CHECK:STDERR:
  45. fn G() -> T;
  46. }
  47. // --- convert_period_self_to_full_facet_value.carbon
  48. library "[[@TEST_NAME]]";
  49. interface I(T:! type) {}
  50. fn F(U:! I(.Self)) {
  51. U as I(U);
  52. (U as type) as I(U);
  53. }
  54. // --- convert_period_self_to_full_facet_value_with_assoc_constant.carbon
  55. library "[[@TEST_NAME]]";
  56. interface I(T:! type) {
  57. let X:! type;
  58. }
  59. fn F(U:! I(.Self) where .X = .Self) {
  60. U as (I(U) where .X = U);
  61. (U as type) as (I(U) where .X = U);
  62. }
  63. // --- fail_todo_return_of_type_period_self.carbon
  64. library "[[@TEST_NAME]]";
  65. interface I(T:! type) {
  66. fn G() -> T*;
  67. }
  68. interface J(T:! type) {
  69. fn J1() -> T*;
  70. }
  71. fn F2[U:! I(.Self)](unused T: U*) {}
  72. fn F(U:! I(.Self)) {
  73. // Caller sees the returned `.Self` type from `F()` as the full `U`.
  74. // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:3: error: member name `G` not found [MemberNameNotFound]
  75. // CHECK:STDERR: U.G()->G()->G();
  76. // CHECK:STDERR: ^~~~~~~~
  77. // CHECK:STDERR:
  78. U.G()->G()->G();
  79. // Conversion to `type` retains access to all of `U`.
  80. // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:3: error: member name `G` not found [MemberNameNotFound]
  81. // CHECK:STDERR: (U as type).G()->G()->G();
  82. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~
  83. // CHECK:STDERR:
  84. (U as type).G()->G()->G();
  85. // Using the returned `.Self` as a facet value works, not just member lookup
  86. // on its facet type.
  87. // CHECK:STDERR: fail_todo_return_of_type_period_self.carbon:[[@LINE+4]]:6: error: member name `G` not found [MemberNameNotFound]
  88. // CHECK:STDERR: F2(U.G()->G()->G());
  89. // CHECK:STDERR: ^~~~~~~~
  90. // CHECK:STDERR:
  91. F2(U.G()->G()->G());
  92. }
  93. // --- fail_todo_return_of_type_period_self_extends_interface.carbon
  94. library "[[@TEST_NAME]]";
  95. interface I(T:! type) {
  96. fn I1() -> T*;
  97. }
  98. interface J(T:! type) {
  99. fn J1() -> T*;
  100. }
  101. fn F2[U:! I(.Self) & J(.Self)](unused T: U*) {}
  102. fn F(U:! I(.Self) & J(.Self)) {
  103. // TODO: The returned value of `I1` and `J1` has type `U` which has access to
  104. // the methods of `I` and `J`.
  105. // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:3: error: member name `J1` not found [MemberNameNotFound]
  106. // CHECK:STDERR: U.I1()->J1()->I1()->J1()->I1()->J1();
  107. // CHECK:STDERR: ^~~~~~~~~~
  108. // CHECK:STDERR:
  109. U.I1()->J1()->I1()->J1()->I1()->J1();
  110. // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:3: error: member name `J1` not found [MemberNameNotFound]
  111. // CHECK:STDERR: (U as type).I1()->J1()->I1()->J1()->I1()->J1();
  112. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~
  113. // CHECK:STDERR:
  114. (U as type).I1()->J1()->I1()->J1()->I1()->J1();
  115. // TODO: Using the returned value of type `U` as a facet value works.
  116. // CHECK:STDERR: fail_todo_return_of_type_period_self_extends_interface.carbon:[[@LINE+4]]:6: error: member name `J1` not found [MemberNameNotFound]
  117. // CHECK:STDERR: F2(U.I1()->J1()->I1()->J1()->I1()->J1());
  118. // CHECK:STDERR: ^~~~~~~~~~
  119. // CHECK:STDERR:
  120. F2(U.I1()->J1()->I1()->J1()->I1()->J1());
  121. }
  122. // --- fail_todo_return_of_period_self_impls_interface.carbon
  123. library "[[@TEST_NAME]]";
  124. interface I(T:! type) {
  125. fn I1() -> T;
  126. }
  127. interface J(T:! type) {
  128. fn J1() -> T;
  129. }
  130. fn G(U:! I(.Self) where .Self impls J(.Self)) {
  131. // Compound member lookup through a non-type value is possible for methods
  132. // which take a `self` parameter. But it's not possible for methods without
  133. // `self`. For those you need to go directly throug the type.
  134. // See: https://github.com/carbon-language/carbon-lang/issues/6025
  135. // TODO: This step should work.
  136. //
  137. // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+7]]:14: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure]
  138. // CHECK:STDERR: let u: U = U.I1();
  139. // CHECK:STDERR: ^~~~~~
  140. // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:14: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext]
  141. // CHECK:STDERR: let u: U = U.I1();
  142. // CHECK:STDERR: ^~~~~~
  143. // CHECK:STDERR:
  144. let u: U = U.I1();
  145. // `u` is a non-type value. Can call methods with `self` through compound
  146. // member lookup, but can't call methods without `self`. See the
  147. // `compound_access_through_call_with_self_param.carbon` test for the former.
  148. //
  149. // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:6: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
  150. // CHECK:STDERR: u.(J.J1)();
  151. // CHECK:STDERR: ^~~~
  152. // CHECK:STDERR:
  153. u.(J.J1)();
  154. // This is the same as the above, since U.I1() returns a non-type value of
  155. // type `U`.
  156. //
  157. // CHECK:STDERR: fail_todo_return_of_period_self_impls_interface.carbon:[[@LINE+4]]:11: error: type `<type of J>` does not support qualified expressions [QualifiedExprUnsupported]
  158. // CHECK:STDERR: U.I1().(J.J1)();
  159. // CHECK:STDERR: ^~~~
  160. // CHECK:STDERR:
  161. U.I1().(J.J1)();
  162. }
  163. // --- fail_todo_return_of_type_period_self_has_type_u.carbon
  164. library "[[@TEST_NAME]]";
  165. interface I(T:! type) {
  166. fn G() -> T;
  167. }
  168. fn F(U:! I(.Self)) {
  169. // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `U` [ConversionFailure]
  170. // CHECK:STDERR: let unused a: U = U.G();
  171. // CHECK:STDERR: ^~~~~
  172. // CHECK:STDERR: fail_todo_return_of_type_period_self_has_type_u.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(U)` [MissingImplInMemberAccessInContext]
  173. // CHECK:STDERR: let unused a: U = U.G();
  174. // CHECK:STDERR: ^~~~~
  175. // CHECK:STDERR:
  176. let unused a: U = U.G();
  177. }
  178. // --- return_of_type_period_self_assoc_const_has_type_u.carbon
  179. library "[[@TEST_NAME]]";
  180. interface I {
  181. let X:! type;
  182. fn G() -> X;
  183. }
  184. fn F(U:! Core.Destroy & I where .X = .Self) {
  185. let unused a: U = U.G();
  186. }
  187. // --- fail_todo_nested_period_self.carbon
  188. library "[[@TEST_NAME]]";
  189. interface I(T:! type) {
  190. let A:! type;
  191. let B:! type;
  192. fn G() -> T;
  193. }
  194. // Both `.Self` refer to `T`. The first because it's the interface for the
  195. // binding. The second because it refers to the top level facet type which is
  196. // constraining the binding.
  197. fn F(T:! I(.Self) where .A = ((I(.Self) where .B = {}) where .A = {}) and .B = {}, U:! T.A) {
  198. // T.G() has type T.
  199. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure]
  200. // CHECK:STDERR: let unused t: T = T.G();
  201. // CHECK:STDERR: ^~~~~
  202. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessInContext]
  203. // CHECK:STDERR: let unused t: T = T.G();
  204. // CHECK:STDERR: ^~~~~
  205. // CHECK:STDERR:
  206. let unused t: T = T.G();
  207. // U.G() has type T.
  208. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+7]]:21: error: cannot implicitly convert expression of type `.Self` to `T` [ConversionFailure]
  209. // CHECK:STDERR: let unused u: T = U.G();
  210. // CHECK:STDERR: ^~~~~
  211. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:21: note: type `.Self` does not implement interface `Core.ImplicitAs(T)` [MissingImplInMemberAccessInContext]
  212. // CHECK:STDERR: let unused u: T = U.G();
  213. // CHECK:STDERR: ^~~~~
  214. // CHECK:STDERR:
  215. let unused u: T = U.G();
  216. // Shows both `I(.Self)` are `I(T)`.
  217. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:9: error: found cycle in facet type constraint for `.(I(T).A)` [FacetTypeConstraintCycle]
  218. // CHECK:STDERR: T as (I(T) where .A = (I(T) where .A = {} and .B = {}));
  219. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  220. // CHECK:STDERR:
  221. T as (I(T) where .A = (I(T) where .A = {} and .B = {}));
  222. // CHECK:STDERR: fail_todo_nested_period_self.carbon:[[@LINE+4]]:3: error: cannot convert type `U` that implements `I(.Self) where .(I(.Self).B) = {} and .(I(.Self).A) = {}` into type implementing `I(T) where .(I(T).A) = {} and .(I(T).B) = {}` [ConversionFailureFacetToFacet]
  223. // CHECK:STDERR: U as (I(T) where .A = {} and .B = {});
  224. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225. // CHECK:STDERR:
  226. U as (I(T) where .A = {} and .B = {});
  227. }
  228. // --- todo_fail_nested_period_self_ambiguous.carbon
  229. library "[[@TEST_NAME]]";
  230. interface I(T:! type) {
  231. let A:! type;
  232. }
  233. // TODO: This should be an error: The third `.Self` becomes is not able to be
  234. // bound to anything unambiguous here, as it could refer to `T` or to something
  235. // later being constrained by `T.A`.
  236. fn F(unused T:! I(.Self) where .A = (I(.Self) where .A = I(.Self))) {}
  237. // --- period_self_parameter_sees_lhs_of_where_expr.carbon
  238. library "[[@TEST_NAME]]";
  239. interface I(T:! Core.Destroy) {}
  240. // The `.Self` can see the LHS of the `where` to know `U` impls Core.Destroy.
  241. fn F(unused U:! Core.Destroy where .Self impls I(.Self)) {}
  242. // --- fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon
  243. library "[[@TEST_NAME]]";
  244. interface I(T:! Core.Destroy) {}
  245. // TODO: Implied constraints that `.Self` impls `Core.Destroy` are satisfied by
  246. // the `&` expression.
  247. //
  248. // CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE+7]]:32: error: cannot convert type `.Self` that implements `type` into type implementing `Core.Destroy` [ConversionFailureFacetToFacet]
  249. // CHECK:STDERR: fn F(unused U:! Core.Destroy & I(.Self)) {}
  250. // CHECK:STDERR: ^~~~~~~~
  251. // CHECK:STDERR: fail_todo_period_self_parameter_constraint_satisfied_with_type_and.carbon:[[@LINE-8]]:13: note: initializing generic parameter `T` declared here [InitializingGenericParam]
  252. // CHECK:STDERR: interface I(T:! Core.Destroy) {}
  253. // CHECK:STDERR: ^~~~~~~~~~~~~~~~
  254. // CHECK:STDERR:
  255. fn F(unused U:! Core.Destroy & I(.Self)) {}
  256. // --- compound_lookup_on_returned_period_self_parameter.carbon
  257. library "[[@TEST_NAME]]";
  258. interface I(T:! Core.Destroy) {
  259. fn G[self: Self]() -> T;
  260. }
  261. fn F[U:! Core.Destroy where .Self impls I(.Self)](u: U) {
  262. // This tests that both `I.G` is accessible and that `Destroy` is preserved;
  263. // we'd get an error for missing Destroy otherwise since G() returns an
  264. // initializing expression.
  265. u.(I(U).G)().(I(U).G)().(I(U).G)();
  266. }
  267. // --- unambiguous_period_self.carbon
  268. library "[[@TEST_NAME]]";
  269. interface Z(T:! type) {}
  270. interface Y(T:! type) {
  271. let Y1:! type;
  272. let Y2:! type;
  273. }
  274. interface X(T:! type) {}
  275. class P;
  276. class Q(T:! type);
  277. class R(T:! type);
  278. fn A(unused T:! Z(.Self) where .Self impls (Y(.Self) where .Self impls X(.Self))) {}
  279. // ^T as type ^T as Z(T) ^T as Z(T) ^T as Z(T) & Y(T)
  280. // ^ T as Z(T) & Y(T)
  281. fn B(unused T:! Z(.Self) where .Self impls (Y(.Self) where Q(.Self) impls X(.Self))) {}
  282. // ^T as type ^T as Z(T) ^T as Z(T) ^T as Z(T) & Y(T)
  283. // ^ T as Z(T) & Y(T)
  284. fn C(unused T:! Z(.Self) where .Self impls (Y(.Self) where .Y1 = .Self)) {}
  285. // ^T as type ^T as Z(T) ^T as Z(T) ^T as Z(T) & Y(T)
  286. // ^ T as Z(T) & Y(T)
  287. // This introduces a different meaning of `.Self`, but we allow it here.
  288. fn D(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Self impls X(P))) {}
  289. // ^T as type ^T as Z(T) ^T as Z(T) ^R(T as Z(T)) as Y(T as Z(T))
  290. // This introduces a different meaning of `.Self`, but we allow it here.
  291. fn E(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Y1 = .Y2)) {}
  292. // ^T as type ^T as Z(T) ^T as Z(T) ^R(T as Z(T)) as Y(T as Z(T))
  293. // ^R(T as Z(T)) as Y(T as Z(T))
  294. // Member designators have an implicit `.Self` which is always allowed. It binds
  295. // to the innermost facet value rather than being ambiguous.
  296. fn F(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Self impls X(.Y1))) {}
  297. // ^T as type ^T as Z(T) ^T as Z(T) ^R(T as Z(T)) as Y(T as Z(T))
  298. // ^Implicit: R(T as Z(T)) as Y(T as Z(T))
  299. // --- fail_type_impls_ambiguous_period_self_argument.carbon
  300. library "[[@TEST_NAME]]";
  301. interface Z(T:! type) {}
  302. interface Y(T:! type) {}
  303. interface X(T:! type) {}
  304. interface W {}
  305. class P;
  306. class Q(T:! type);
  307. class R(T:! type);
  308. // CHECK:STDERR: fail_type_impls_ambiguous_period_self_argument.carbon:[[@LINE+4]]:71: error: `.Self` is ambiguous after nested `where` in `<type> impls ...` clause. [AmbiguousPeriodSelf]
  309. // CHECK:STDERR: fn A(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where P impls X(.Self))) {}
  310. // CHECK:STDERR: ^~~~~~~~
  311. // CHECK:STDERR:
  312. fn A(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where P impls X(.Self))) {}
  313. // ^T as type ^T as Z(T) ^T as Z(T) ^ERROR: R(T as Z(T)) as Y(T as Z(T))
  314. // --- fail_ambiguous_period_self_argument_impls.carbon
  315. library "[[@TEST_NAME]]";
  316. interface Z(T:! type) {}
  317. interface Y(T:! type) {}
  318. interface X {}
  319. class Q(T:! type);
  320. class R(T:! type);
  321. // CHECK:STDERR: fail_ambiguous_period_self_argument_impls.carbon:[[@LINE+4]]:63: error: `.Self` is ambiguous after nested `where` in `<type> impls ...` clause. [AmbiguousPeriodSelf]
  322. // CHECK:STDERR: fn B(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where Q(.Self) impls X)) {}
  323. // CHECK:STDERR: ^~~~~~~~
  324. // CHECK:STDERR:
  325. fn B(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where Q(.Self) impls X)) {}
  326. // ^T as type ^T as Z(T) ^T as Z(T) ^ERROR: R(T as Z(T)) as Y(T as Z(T))
  327. // --- fail_period_self_impls_ambiguous_period_self_argument.carbon
  328. library "[[@TEST_NAME]]";
  329. interface Z(T:! type) {}
  330. interface Y(T:! type) {}
  331. interface X(T:! type) {}
  332. class R(T:! type);
  333. // CHECK:STDERR: fail_period_self_impls_ambiguous_period_self_argument.carbon:[[@LINE+4]]:75: error: `.Self` is ambiguous after nested `where` in `<type> impls ...` clause. [AmbiguousPeriodSelf]
  334. // CHECK:STDERR: fn C(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Self impls X(.Self))) {}
  335. // CHECK:STDERR: ^~~~~~~~
  336. // CHECK:STDERR:
  337. fn C(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Self impls X(.Self))) {}
  338. // ^T as type ^T as Z(T) ^T as Z(T) ^R(T as Z(T)) as Y(T as Z(T))
  339. // ^ERROR: R(T as Z(T)) as Y(T as Z(T))
  340. // --- fail_rewrite_rhs_ambiguous_period_self.carbon
  341. library "[[@TEST_NAME]]";
  342. interface Z(T:! type) {}
  343. interface Y(T:! type) {
  344. let Y1:! type;
  345. }
  346. class R(T:! type);
  347. // CHECK:STDERR: fail_rewrite_rhs_ambiguous_period_self.carbon:[[@LINE+4]]:69: error: `.Self` is ambiguous after nested `where` in `<type> impls ...` clause. [AmbiguousPeriodSelf]
  348. // CHECK:STDERR: fn D(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Y1 = .Self)) {}
  349. // CHECK:STDERR: ^~~~~
  350. // CHECK:STDERR:
  351. fn D(unused T:! Z(.Self) where R(.Self) impls (Y(.Self) where .Y1 = .Self)) {}
  352. // ^T as type ^T as Z(T) ^T as Z(T) ^R(T as Z(T)) as Y(T as Z(T))
  353. // ^ERROR: R(T as Z(T)) as Y(T as Z(T))
  354. // --- impl_as_rewrite_with_period_self.carbon
  355. library "[[@TEST_NAME]]";
  356. interface Z {
  357. let Z1:! type;
  358. }
  359. class C;
  360. impl C as Z where .Z1 = .Self {}
  361. fn F() {
  362. C as (Z where .Z1 = C);
  363. }
  364. // --- impl_as_impls_with_period_self.carbon
  365. library "[[@TEST_NAME]]";
  366. interface Z {
  367. let Z1:! type;
  368. }
  369. interface Y {}
  370. class C;
  371. impl C as Z where .Z1 = .Self {}
  372. impl C as Y {}
  373. fn F() {
  374. C as (Z where .Z1 impls Y);
  375. }
  376. // CHECK:STDOUT: --- period_self_param.carbon
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: constants {
  379. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  380. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  381. // CHECK:STDOUT: %pattern_type.98f: type = pattern_type type [concrete]
  382. // CHECK:STDOUT: %T.67d: type = symbolic_binding T, 0 [symbolic]
  383. // CHECK:STDOUT: %I.type.609: type = generic_interface_type @I [concrete]
  384. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  385. // CHECK:STDOUT: %I.generic: %I.type.609 = struct_value () [concrete]
  386. // CHECK:STDOUT: %I.type.1ab: type = facet_type <@I, @I(%T.67d)> [symbolic]
  387. // CHECK:STDOUT: %Self.fdb: %I.type.1ab = symbolic_binding Self, 1 [symbolic]
  388. // CHECK:STDOUT: %I.assoc_type.76c: type = assoc_entity_type @I, @I(%T.67d) [symbolic]
  389. // CHECK:STDOUT: %assoc0.99e: %I.assoc_type.76c = assoc_entity element0, @I.WithSelf.%I1 [symbolic]
  390. // CHECK:STDOUT: %.Self.as_type.246: type = facet_access_type %.Self.c39 [symbolic_self]
  391. // CHECK:STDOUT: %I.type.6e7: type = facet_type <@I, @I(%.Self.as_type.246)> [symbolic_self]
  392. // CHECK:STDOUT: %.Self.534: %I.type.6e7 = symbolic_binding .Self [symbolic_self]
  393. // CHECK:STDOUT: %Self.c6b: %I.type.6e7 = symbolic_binding Self, 1 [symbolic]
  394. // CHECK:STDOUT: %I.assoc_type.24b: type = assoc_entity_type @I, @I(%.Self.as_type.246) [symbolic_self]
  395. // CHECK:STDOUT: %assoc0.0ba: %I.assoc_type.24b = assoc_entity element0, @I.WithSelf.%I1 [symbolic_self]
  396. // CHECK:STDOUT: %.Self.as_type.089: type = facet_access_type %.Self.534 [symbolic_self]
  397. // CHECK:STDOUT: %I.lookup_impl_witness.42f: <witness> = lookup_impl_witness %.Self.534, @I, @I(%.Self.as_type.246) [symbolic_self]
  398. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %I.lookup_impl_witness.42f, element0 [symbolic_self]
  399. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  400. // CHECK:STDOUT: %I_where.type: type = facet_type <@I, @I(%.Self.as_type.246) where %impl.elem0 = %empty_tuple.type> [symbolic_self]
  401. // CHECK:STDOUT: %pattern_type.0d7: type = pattern_type %I_where.type [symbolic_self]
  402. // CHECK:STDOUT: %T.279: %I_where.type = symbolic_binding T, 0 [symbolic]
  403. // CHECK:STDOUT: %T.as_type: type = facet_access_type %T.279 [symbolic]
  404. // CHECK:STDOUT: %facet_value: %type = facet_value %T.as_type, () [symbolic]
  405. // CHECK:STDOUT: %I.lookup_impl_witness.baf: <witness> = lookup_impl_witness %T.279, @I, @I(%T.as_type) [symbolic]
  406. // CHECK:STDOUT: %I.facet: %I.type.6e7 = facet_value %T.as_type, (%I.lookup_impl_witness.baf) [symbolic]
  407. // CHECK:STDOUT: %.262: Core.Form = init_form %empty_tuple.type [concrete]
  408. // CHECK:STDOUT: %pattern_type.cb1: type = pattern_type %empty_tuple.type [concrete]
  409. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  410. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  411. // CHECK:STDOUT: %G.type: type = fn_type @G [concrete]
  412. // CHECK:STDOUT: %G: %G.type = struct_value () [concrete]
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT:
  415. // CHECK:STDOUT: file {
  416. // CHECK:STDOUT: %I.decl: %I.type.609 = interface_decl @I [concrete = constants.%I.generic] {
  417. // CHECK:STDOUT: %T.patt: %pattern_type.98f = symbolic_binding_pattern T, 0 [concrete]
  418. // CHECK:STDOUT: } {
  419. // CHECK:STDOUT: %.loc4_17.1: type = splice_block %.loc4_17.2 [concrete = type] {
  420. // CHECK:STDOUT: <elided>
  421. // CHECK:STDOUT: %.loc4_17.2: type = type_literal type [concrete = type]
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT: %T.loc4_14.2: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T.67d)]
  424. // CHECK:STDOUT: }
  425. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  426. // CHECK:STDOUT: %T.patt: %pattern_type.0d7 = symbolic_binding_pattern T, 0 [concrete]
  427. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  428. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc8_39 [concrete]
  429. // CHECK:STDOUT: } {
  430. // CHECK:STDOUT: %T.ref: %I_where.type = name_ref T, %T.loc8_7.2 [symbolic = %T.loc8_7.1 (constants.%T.279)]
  431. // CHECK:STDOUT: %T.as_type.loc8_39.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc8_39.1 (constants.%T.as_type)]
  432. // CHECK:STDOUT: %.loc8_39.1: type = converted %T.ref, %T.as_type.loc8_39.2 [symbolic = %T.as_type.loc8_39.1 (constants.%T.as_type)]
  433. // CHECK:STDOUT: %.loc8_39.2: %I.assoc_type.24b = specific_constant @I1.%assoc0, @I.WithSelf(constants.%.Self.as_type.246, constants.%T.279) [symbolic_self = constants.%assoc0.0ba]
  434. // CHECK:STDOUT: %I1.ref.loc8_39: %I.assoc_type.24b = name_ref I1, %.loc8_39.2 [symbolic_self = constants.%assoc0.0ba]
  435. // CHECK:STDOUT: %facet_value.loc8_39.2: %type = facet_value constants.%T.as_type, () [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  436. // CHECK:STDOUT: %.loc8_39.3: %type = converted constants.%T.as_type, %facet_value.loc8_39.2 [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  437. // CHECK:STDOUT: %T.as_type.loc8_39.3: type = facet_access_type constants.%T.279 [symbolic = %T.as_type.loc8_39.1 (constants.%T.as_type)]
  438. // CHECK:STDOUT: %facet_value.loc8_39.3: %type = facet_value %T.as_type.loc8_39.3, () [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  439. // CHECK:STDOUT: %.loc8_39.4: %type = converted constants.%T.279, %facet_value.loc8_39.3 [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  440. // CHECK:STDOUT: %T.as_type.loc8_39.4: type = facet_access_type constants.%T.279 [symbolic = %T.as_type.loc8_39.1 (constants.%T.as_type)]
  441. // CHECK:STDOUT: %facet_value.loc8_39.4: %type = facet_value %T.as_type.loc8_39.4, () [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  442. // CHECK:STDOUT: %.loc8_39.5: %type = converted constants.%T.279, %facet_value.loc8_39.4 [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  443. // CHECK:STDOUT: %impl.elem0.loc8_39: type = impl_witness_access constants.%I.lookup_impl_witness.baf, element0 [concrete = constants.%empty_tuple.type]
  444. // CHECK:STDOUT: %.loc8_39.6: Core.Form = init_form %impl.elem0.loc8_39 [concrete = constants.%.262]
  445. // CHECK:STDOUT: %.loc8_19.1: type = splice_block %.loc8_19.2 [symbolic_self = constants.%I_where.type] {
  446. // CHECK:STDOUT: <elided>
  447. // CHECK:STDOUT: %I.ref: %I.type.609 = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  448. // CHECK:STDOUT: %.Self.ref.loc8_12: %type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self.c39]
  449. // CHECK:STDOUT: %.Self.as_type.loc8_17: type = facet_access_type %.Self.ref.loc8_12 [symbolic_self = constants.%.Self.as_type.246]
  450. // CHECK:STDOUT: %.loc8_17: type = converted %.Self.ref.loc8_12, %.Self.as_type.loc8_17 [symbolic_self = constants.%.Self.as_type.246]
  451. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%.Self.as_type.246)> [symbolic_self = constants.%I.type.6e7]
  452. // CHECK:STDOUT: <elided>
  453. // CHECK:STDOUT: %.Self.ref.loc8_25: %I.type.6e7 = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.534]
  454. // CHECK:STDOUT: %.Self.as_type.loc8_25: type = facet_access_type %.Self.ref.loc8_25 [symbolic_self = constants.%.Self.as_type.089]
  455. // CHECK:STDOUT: %.loc8_25.1: type = converted %.Self.ref.loc8_25, %.Self.as_type.loc8_25 [symbolic_self = constants.%.Self.as_type.089]
  456. // CHECK:STDOUT: %.loc8_25.2: %I.assoc_type.24b = specific_constant @I1.%assoc0, @I.WithSelf(constants.%.Self.as_type.246, constants.%.Self.534) [symbolic_self = constants.%assoc0.0ba]
  457. // CHECK:STDOUT: %I1.ref.loc8_25: %I.assoc_type.24b = name_ref I1, %.loc8_25.2 [symbolic_self = constants.%assoc0.0ba]
  458. // CHECK:STDOUT: %impl.elem0.loc8_25: type = impl_witness_access constants.%I.lookup_impl_witness.42f, element0 [symbolic_self = constants.%impl.elem0]
  459. // CHECK:STDOUT: %.loc8_32.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  460. // CHECK:STDOUT: %.loc8_32.2: type = converted %.loc8_32.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  461. // CHECK:STDOUT: %.loc8_19.2: type = where_expr [symbolic_self = constants.%I_where.type] {
  462. // CHECK:STDOUT: requirement_base_facet_type %I.type
  463. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc8_25, %.loc8_32.2
  464. // CHECK:STDOUT: }
  465. // CHECK:STDOUT: }
  466. // CHECK:STDOUT: %T.loc8_7.2: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_7.1 (constants.%T.279)]
  467. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  468. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT: %G.decl: %G.type = fn_decl @G [concrete = constants.%G] {
  471. // CHECK:STDOUT: %T.patt: %pattern_type.0d7 = symbolic_binding_pattern T, 0 [concrete]
  472. // CHECK:STDOUT: %return.param_patt: %pattern_type.cb1 = out_param_pattern [concrete]
  473. // CHECK:STDOUT: %return.patt: %pattern_type.cb1 = return_slot_pattern %return.param_patt, %impl.elem0.loc12_47 [concrete]
  474. // CHECK:STDOUT: } {
  475. // CHECK:STDOUT: %T.ref: %I_where.type = name_ref T, %T.loc12_7.2 [symbolic = %T.loc12_7.1 (constants.%T.279)]
  476. // CHECK:STDOUT: %T.as_type.loc12_47.2: type = facet_access_type %T.ref [symbolic = %T.as_type.loc12_47.1 (constants.%T.as_type)]
  477. // CHECK:STDOUT: %.loc12_47.1: type = converted %T.ref, %T.as_type.loc12_47.2 [symbolic = %T.as_type.loc12_47.1 (constants.%T.as_type)]
  478. // CHECK:STDOUT: %.loc12_47.2: %I.assoc_type.24b = specific_constant @I1.%assoc0, @I.WithSelf(constants.%.Self.as_type.246, constants.%T.279) [symbolic_self = constants.%assoc0.0ba]
  479. // CHECK:STDOUT: %I1.ref.loc12_47: %I.assoc_type.24b = name_ref I1, %.loc12_47.2 [symbolic_self = constants.%assoc0.0ba]
  480. // CHECK:STDOUT: %T.as_type.loc12_47.3: type = facet_access_type constants.%T.279 [symbolic = %T.as_type.loc12_47.1 (constants.%T.as_type)]
  481. // CHECK:STDOUT: %facet_value.loc12_47.2: %type = facet_value %T.as_type.loc12_47.3, () [symbolic = %facet_value.loc12_47.1 (constants.%facet_value)]
  482. // CHECK:STDOUT: %.loc12_47.3: %type = converted constants.%T.279, %facet_value.loc12_47.2 [symbolic = %facet_value.loc12_47.1 (constants.%facet_value)]
  483. // CHECK:STDOUT: %impl.elem0.loc12_47: type = impl_witness_access constants.%I.lookup_impl_witness.baf, element0 [concrete = constants.%empty_tuple.type]
  484. // CHECK:STDOUT: %.loc12_47.4: Core.Form = init_form %impl.elem0.loc12_47 [concrete = constants.%.262]
  485. // CHECK:STDOUT: %.loc12_27.1: type = splice_block %.loc12_27.2 [symbolic_self = constants.%I_where.type] {
  486. // CHECK:STDOUT: <elided>
  487. // CHECK:STDOUT: %I.ref: %I.type.609 = name_ref I, file.%I.decl [concrete = constants.%I.generic]
  488. // CHECK:STDOUT: %.Self.ref.loc12_12: %type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self.c39]
  489. // CHECK:STDOUT: %.loc12_21: type = type_literal type [concrete = type]
  490. // CHECK:STDOUT: %.Self.as_type.loc12_18: type = facet_access_type %.Self.ref.loc12_12 [symbolic_self = constants.%.Self.as_type.246]
  491. // CHECK:STDOUT: %.loc12_18: type = converted %.Self.ref.loc12_12, %.Self.as_type.loc12_18 [symbolic_self = constants.%.Self.as_type.246]
  492. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(constants.%.Self.as_type.246)> [symbolic_self = constants.%I.type.6e7]
  493. // CHECK:STDOUT: <elided>
  494. // CHECK:STDOUT: %.Self.ref.loc12_33: %I.type.6e7 = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.534]
  495. // CHECK:STDOUT: %.Self.as_type.loc12_33: type = facet_access_type %.Self.ref.loc12_33 [symbolic_self = constants.%.Self.as_type.089]
  496. // CHECK:STDOUT: %.loc12_33.1: type = converted %.Self.ref.loc12_33, %.Self.as_type.loc12_33 [symbolic_self = constants.%.Self.as_type.089]
  497. // CHECK:STDOUT: %.loc12_33.2: %I.assoc_type.24b = specific_constant @I1.%assoc0, @I.WithSelf(constants.%.Self.as_type.246, constants.%.Self.534) [symbolic_self = constants.%assoc0.0ba]
  498. // CHECK:STDOUT: %I1.ref.loc12_33: %I.assoc_type.24b = name_ref I1, %.loc12_33.2 [symbolic_self = constants.%assoc0.0ba]
  499. // CHECK:STDOUT: %impl.elem0.loc12_33: type = impl_witness_access constants.%I.lookup_impl_witness.42f, element0 [symbolic_self = constants.%impl.elem0]
  500. // CHECK:STDOUT: %.loc12_40.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  501. // CHECK:STDOUT: %.loc12_40.2: type = converted %.loc12_40.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  502. // CHECK:STDOUT: %.loc12_27.2: type = where_expr [symbolic_self = constants.%I_where.type] {
  503. // CHECK:STDOUT: requirement_base_facet_type %I.type
  504. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc12_33, %.loc12_40.2
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT: }
  507. // CHECK:STDOUT: %T.loc12_7.2: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc12_7.1 (constants.%T.279)]
  508. // CHECK:STDOUT: %return.param: ref %empty_tuple.type = out_param call_param0
  509. // CHECK:STDOUT: %return: ref %empty_tuple.type = return_slot %return.param
  510. // CHECK:STDOUT: }
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT:
  513. // CHECK:STDOUT: generic interface @I(%T.loc4_14.2: type) {
  514. // CHECK:STDOUT: %T.loc4_14.1: type = symbolic_binding T, 0 [symbolic = %T.loc4_14.1 (constants.%T.67d)]
  515. // CHECK:STDOUT:
  516. // CHECK:STDOUT: !definition:
  517. // CHECK:STDOUT: %I.type: type = facet_type <@I, @I(%T.loc4_14.1)> [symbolic = %I.type (constants.%I.type.1ab)]
  518. // CHECK:STDOUT: %Self.loc4_23.2: @I.%I.type (%I.type.1ab) = symbolic_binding Self, 1 [symbolic = %Self.loc4_23.2 (constants.%Self.fdb)]
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: interface {
  521. // CHECK:STDOUT: %Self.loc4_23.1: @I.%I.type (%I.type.1ab) = symbolic_binding Self, 1 [symbolic = %Self.loc4_23.2 (constants.%Self.fdb)]
  522. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  523. // CHECK:STDOUT:
  524. // CHECK:STDOUT: !with Self:
  525. // CHECK:STDOUT: %I1: type = assoc_const_decl @I1 [concrete] {
  526. // CHECK:STDOUT: %assoc0: @I.WithSelf.%I.assoc_type (%I.assoc_type.76c) = assoc_entity element0, @I.WithSelf.%I1 [symbolic = @I.WithSelf.%assoc0 (constants.%assoc0.99e)]
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT:
  529. // CHECK:STDOUT: !members:
  530. // CHECK:STDOUT: .Self = %Self.loc4_23.1
  531. // CHECK:STDOUT: .I1 = @I1.%assoc0
  532. // CHECK:STDOUT: witness = (@I.WithSelf.%I1)
  533. // CHECK:STDOUT:
  534. // CHECK:STDOUT: !requires:
  535. // CHECK:STDOUT: }
  536. // CHECK:STDOUT: }
  537. // CHECK:STDOUT:
  538. // CHECK:STDOUT: generic fn @F(%T.loc8_7.2: %I_where.type) {
  539. // CHECK:STDOUT: %T.loc8_7.1: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc8_7.1 (constants.%T.279)]
  540. // CHECK:STDOUT: %T.as_type.loc8_39.1: type = facet_access_type %T.loc8_7.1 [symbolic = %T.as_type.loc8_39.1 (constants.%T.as_type)]
  541. // CHECK:STDOUT: %facet_value.loc8_39.1: %type = facet_value %T.as_type.loc8_39.1, () [symbolic = %facet_value.loc8_39.1 (constants.%facet_value)]
  542. // CHECK:STDOUT:
  543. // CHECK:STDOUT: !definition:
  544. // CHECK:STDOUT:
  545. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  546. // CHECK:STDOUT: !entry:
  547. // CHECK:STDOUT: %.loc9_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  548. // CHECK:STDOUT: %.loc9_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  549. // CHECK:STDOUT: %.loc9_12: init %empty_tuple.type = converted %.loc9_11.1, %.loc9_11.2 [concrete = constants.%empty_tuple]
  550. // CHECK:STDOUT: return %.loc9_12
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: generic fn @G(%T.loc12_7.2: %I_where.type) {
  555. // CHECK:STDOUT: %T.loc12_7.1: %I_where.type = symbolic_binding T, 0 [symbolic = %T.loc12_7.1 (constants.%T.279)]
  556. // CHECK:STDOUT: %T.as_type.loc12_47.1: type = facet_access_type %T.loc12_7.1 [symbolic = %T.as_type.loc12_47.1 (constants.%T.as_type)]
  557. // CHECK:STDOUT: %facet_value.loc12_47.1: %type = facet_value %T.as_type.loc12_47.1, () [symbolic = %facet_value.loc12_47.1 (constants.%facet_value)]
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: !definition:
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: fn() -> out %return.param: %empty_tuple.type {
  562. // CHECK:STDOUT: !entry:
  563. // CHECK:STDOUT: %.loc13_11.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  564. // CHECK:STDOUT: %.loc13_11.2: init %empty_tuple.type = tuple_init () [concrete = constants.%empty_tuple]
  565. // CHECK:STDOUT: %.loc13_12: init %empty_tuple.type = converted %.loc13_11.1, %.loc13_11.2 [concrete = constants.%empty_tuple]
  566. // CHECK:STDOUT: return %.loc13_12
  567. // CHECK:STDOUT: }
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: specific @I(constants.%T.67d) {
  571. // CHECK:STDOUT: %T.loc4_14.1 => constants.%T.67d
  572. // CHECK:STDOUT: }
  573. // CHECK:STDOUT:
  574. // CHECK:STDOUT: specific @I.WithSelf(constants.%T.67d, constants.%Self.fdb) {}
  575. // CHECK:STDOUT:
  576. // CHECK:STDOUT: specific @I(constants.%.Self.as_type.246) {
  577. // CHECK:STDOUT: %T.loc4_14.1 => constants.%.Self.as_type.246
  578. // CHECK:STDOUT:
  579. // CHECK:STDOUT: !definition:
  580. // CHECK:STDOUT: %I.type => constants.%I.type.6e7
  581. // CHECK:STDOUT: %Self.loc4_23.2 => constants.%Self.c6b
  582. // CHECK:STDOUT: }
  583. // CHECK:STDOUT:
  584. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self.as_type.246, constants.%Self.fdb) {
  585. // CHECK:STDOUT: !definition:
  586. // CHECK:STDOUT: %T => constants.%.Self.as_type.246
  587. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.24b
  588. // CHECK:STDOUT: %assoc0 => constants.%assoc0.0ba
  589. // CHECK:STDOUT: }
  590. // CHECK:STDOUT:
  591. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self.as_type.246, constants.%.Self.534) {
  592. // CHECK:STDOUT: !definition:
  593. // CHECK:STDOUT: %T => constants.%.Self.as_type.246
  594. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.24b
  595. // CHECK:STDOUT: %assoc0 => constants.%assoc0.0ba
  596. // CHECK:STDOUT: }
  597. // CHECK:STDOUT:
  598. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self.as_type.246, constants.%T.279) {
  599. // CHECK:STDOUT: !definition:
  600. // CHECK:STDOUT: %T => constants.%.Self.as_type.246
  601. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.24b
  602. // CHECK:STDOUT: %assoc0 => constants.%assoc0.0ba
  603. // CHECK:STDOUT: }
  604. // CHECK:STDOUT:
  605. // CHECK:STDOUT: specific @I(constants.%T.as_type) {
  606. // CHECK:STDOUT: %T.loc4_14.1 => constants.%T.as_type
  607. // CHECK:STDOUT: }
  608. // CHECK:STDOUT:
  609. // CHECK:STDOUT: specific @I.WithSelf(constants.%.Self.as_type.246, constants.%I.facet) {
  610. // CHECK:STDOUT: !definition:
  611. // CHECK:STDOUT: %T => constants.%.Self.as_type.246
  612. // CHECK:STDOUT: %I.assoc_type => constants.%I.assoc_type.24b
  613. // CHECK:STDOUT: %assoc0 => constants.%assoc0.0ba
  614. // CHECK:STDOUT: }
  615. // CHECK:STDOUT:
  616. // CHECK:STDOUT: specific @F(constants.%T.279) {
  617. // CHECK:STDOUT: %T.loc8_7.1 => constants.%T.279
  618. // CHECK:STDOUT: %T.as_type.loc8_39.1 => constants.%T.as_type
  619. // CHECK:STDOUT: %facet_value.loc8_39.1 => constants.%facet_value
  620. // CHECK:STDOUT: }
  621. // CHECK:STDOUT:
  622. // CHECK:STDOUT: specific @G(constants.%T.279) {
  623. // CHECK:STDOUT: %T.loc12_7.1 => constants.%T.279
  624. // CHECK:STDOUT: %T.as_type.loc12_47.1 => constants.%T.as_type
  625. // CHECK:STDOUT: %facet_value.loc12_47.1 => constants.%facet_value
  626. // CHECK:STDOUT: }
  627. // CHECK:STDOUT: