facet_assoc_const.carbon 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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/facet_types.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/facet_assoc_const.carbon
  10. // TIP: To dump output, run:
  11. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/facet/facet_assoc_const.carbon
  12. // --- success.carbon
  13. library "[[@TEST_NAME]]";
  14. interface I { let T:! type; }
  15. fn F(T:! I where .T = {}) {}
  16. // --- success_associated.carbon
  17. library "[[@TEST_NAME]]";
  18. interface I { let T:! type; let U:! type; }
  19. fn F(T:! I where .T = .U) {}
  20. // --- fail_two_different.carbon
  21. library "[[@TEST_NAME]]";
  22. interface L { let W:! type; }
  23. // CHECK:STDERR: fail_two_different.carbon:[[@LINE+4]]:10: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues]
  24. // CHECK:STDERR: fn F(T:! L where .W = {} and .W = ()) {}
  25. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  26. // CHECK:STDERR:
  27. fn F(T:! L where .W = {} and .W = ()) {}
  28. // --- fail_two_different_first_associated.carbon
  29. library "[[@TEST_NAME]]";
  30. interface L { let W:! type; let X:! type; }
  31. // CHECK:STDERR: fail_two_different_first_associated.carbon:[[@LINE+4]]:10: error: associated constant `.(L.W)` given two different values `.(L.X)` and `()` [AssociatedConstantWithDifferentValues]
  32. // CHECK:STDERR: fn F(T:! L where .W = .X and .W = ()) {}
  33. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. // CHECK:STDERR:
  35. fn F(T:! L where .W = .X and .W = ()) {}
  36. // --- fail_two_different_second_associated.carbon
  37. library "[[@TEST_NAME]]";
  38. interface L { let W:! type; let X:! type; }
  39. // CHECK:STDERR: fail_two_different_second_associated.carbon:[[@LINE+4]]:10: error: associated constant `.(L.W)` given two different values `()` and `.(L.X)` [AssociatedConstantWithDifferentValues]
  40. // CHECK:STDERR: fn F(T:! L where .W = () and .W = .X) {}
  41. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~
  42. // CHECK:STDERR:
  43. fn F(T:! L where .W = () and .W = .X) {}
  44. // --- fail_two_different_first_bad.carbon
  45. library "[[@TEST_NAME]]";
  46. interface L { let W:! type; }
  47. // CHECK:STDERR: fail_two_different_first_bad.carbon:[[@LINE+4]]:23: error: name `BAD5` not found [NameNotFound]
  48. // CHECK:STDERR: fn F(T:! L where .W = BAD5 and .W = ()) {}
  49. // CHECK:STDERR: ^~~~
  50. // CHECK:STDERR:
  51. fn F(T:! L where .W = BAD5 and .W = ()) {}
  52. // --- fail_two_different_second_bad.carbon
  53. library "[[@TEST_NAME]]";
  54. interface L { let W:! type; }
  55. // CHECK:STDERR: fail_two_different_second_bad.carbon:[[@LINE+4]]:35: error: name `BAD6` not found [NameNotFound]
  56. // CHECK:STDERR: fn F(T:! L where .W = {} and .W = BAD6) {}
  57. // CHECK:STDERR: ^~~~
  58. // CHECK:STDERR:
  59. fn F(T:! L where .W = {} and .W = BAD6) {}
  60. // --- fail_two_different_both_bad.carbon
  61. library "[[@TEST_NAME]]";
  62. interface L { let W:! type; }
  63. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+8]]:23: error: name `BAD7` not found [NameNotFound]
  64. // CHECK:STDERR: fn F(T:! L where .W = BAD7 and .W = BAD8) {}
  65. // CHECK:STDERR: ^~~~
  66. // CHECK:STDERR:
  67. // CHECK:STDERR: fail_two_different_both_bad.carbon:[[@LINE+4]]:37: error: name `BAD8` not found [NameNotFound]
  68. // CHECK:STDERR: fn F(T:! L where .W = BAD7 and .W = BAD8) {}
  69. // CHECK:STDERR: ^~~~
  70. // CHECK:STDERR:
  71. fn F(T:! L where .W = BAD7 and .W = BAD8) {}
  72. // --- fail_two_different_combined_from_bitand.carbon
  73. library "[[@TEST_NAME]]";
  74. interface L { let W:! type; }
  75. // CHECK:STDERR: fail_two_different_combined_from_bitand.carbon:[[@LINE+4]]:10: error: associated constant `.(L.W)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues]
  76. // CHECK:STDERR: fn F(T:! (L where .W = {}) & (L where .W = ())) {}
  77. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  78. // CHECK:STDERR:
  79. fn F(T:! (L where .W = {}) & (L where .W = ())) {}
  80. // --- two_different_combined_from_impl_and_facet.carbon
  81. library "[[@TEST_NAME]]";
  82. interface L { let W:! type; }
  83. interface M {}
  84. impl forall [T:! M] T as L where .W = () {}
  85. fn F(T:! M & (L where .W = {})) {}
  86. class C;
  87. impl C as L where .W = {} {}
  88. impl C as M {}
  89. fn G() {
  90. F(C);
  91. }
  92. // --- fail_two_different_combined_from_final_impl_and_facet.carbon
  93. library "[[@TEST_NAME]]";
  94. interface L { let W:! type; }
  95. interface M {}
  96. final impl forall [T:! M] T as L where .W = () {}
  97. fn G(T:! M & L, a: T.W) -> () { return a; }
  98. fn H(T:! L where .W = {}, a: T.W) -> {} { return a; }
  99. fn F(T:! M & (L where .W = {}), a: T.W) {
  100. // TODO: One of `b` or `c` must fail, because `T.W` is either found to be `()` from
  101. // the impl or `{}` from the facet type of T.
  102. let b: () = G(T, a);
  103. // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+10]]:15: error: cannot implicitly convert expression of type `()` to `{}` [ConversionFailure]
  104. // CHECK:STDERR: let c: {} = H(T, a);
  105. // CHECK:STDERR: ^~~~~~~
  106. // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE+7]]:15: note: type `()` does not implement interface `Core.ImplicitAs({})` [MissingImplInMemberAccessNote]
  107. // CHECK:STDERR: let c: {} = H(T, a);
  108. // CHECK:STDERR: ^~~~~~~
  109. // CHECK:STDERR: fail_two_different_combined_from_final_impl_and_facet.carbon:[[@LINE-13]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  110. // CHECK:STDERR: fn H(T:! L where .W = {}, a: T.W) -> {} { return a; }
  111. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  112. // CHECK:STDERR:
  113. let c: {} = H(T, a);
  114. }
  115. // --- fail_many_different.carbon
  116. library "[[@TEST_NAME]]";
  117. interface L { let W:! type; }
  118. // CHECK:STDERR: fail_many_different.carbon:[[@LINE+4]]:10: error: associated constant `.(L.W)` given two different values `((), (), ())` and `({}, (), ())` [AssociatedConstantWithDifferentValues]
  119. // CHECK:STDERR: fn G(T:! L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {})) {}
  120. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. // CHECK:STDERR:
  122. fn G(T:! L where .W = ((), (), ()) and .W = ({}, (), ()) and .W = ({}, {}, ()) and .W = ({}, (), {})) {}
  123. // --- rewrite_uses_second_facet.carbon
  124. library "[[@TEST_NAME]]";
  125. interface M { let X:! type; let Y:! type; }
  126. fn F(T:! M where .X = (), U:! M where .Y = T.X) -> U.Y {
  127. return ();
  128. }
  129. // --- fail_rewrite_conflicts_with_second_facet.carbon
  130. library "[[@TEST_NAME]]";
  131. interface M { let X:! type; let Y:! type; }
  132. // CHECK:STDERR: fail_rewrite_conflicts_with_second_facet.carbon:[[@LINE+4]]:31: error: associated constant `.(M.Y)` given two different values `T.(M.X)` and `.(M.X)` [AssociatedConstantWithDifferentValues]
  133. // CHECK:STDERR: fn F(T:! M where .X = (), U:! M where .Y = T.X and .Y = .X) {}
  134. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135. // CHECK:STDERR:
  136. fn F(T:! M where .X = (), U:! M where .Y = T.X and .Y = .X) {}
  137. // --- repeated.carbon
  138. library "[[@TEST_NAME]]";
  139. interface M { let X:! type; }
  140. fn F(T:! M where .X = {} and .X = {}) {}
  141. fn G(T:! M where .X = {}) {
  142. F(T);
  143. }
  144. // --- repeated_associated.carbon
  145. library "[[@TEST_NAME]]";
  146. interface M { let X:! type; let Y:! type; }
  147. fn F(T:! M where .X = .Y and .X = .Y) {}
  148. fn G(T:! M where .X = () and .Y = ()) {
  149. F(T);
  150. }
  151. // --- repeated_with_bitand.carbon
  152. library "[[@TEST_NAME]]";
  153. interface M { let X:! type; let Y:! type; }
  154. fn F1(T:! (M where .X = .Y) & (M where .X = .Y and .Y = ())) -> T.X {
  155. return ();
  156. }
  157. fn F2(T:! (M where .X = .Y and .Y = ()) & (M where .X = .Y)) -> T.X {
  158. return ();
  159. }
  160. // --- fail_repeated_and_different.carbon
  161. library "[[@TEST_NAME]]";
  162. interface M { let X:! type; }
  163. // CHECK:STDERR: fail_repeated_and_different.carbon:[[@LINE+4]]:10: error: associated constant `.(M.X)` given two different values `{}` and `()` [AssociatedConstantWithDifferentValues]
  164. // CHECK:STDERR: fn F(T:! M where .X = {} and .X = () and .X = {}) {}
  165. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  166. // CHECK:STDERR:
  167. fn F(T:! M where .X = {} and .X = () and .X = {}) {}
  168. // --- fail_cycle_single.carbon
  169. library "[[@TEST_NAME]]";
  170. interface M { let X:! type; }
  171. // CHECK:STDERR: fail_cycle_single.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle]
  172. // CHECK:STDERR: fn F(T:! M where .X = .X) {}
  173. // CHECK:STDERR: ^~~~~~~~~~~~~~~
  174. // CHECK:STDERR:
  175. fn F(T:! M where .X = .X) {}
  176. // --- fail_cycle.carbon
  177. library "[[@TEST_NAME]]";
  178. interface M { let X:! type; let Y:! type; let Z:! type; }
  179. // This fails because it resolves to `.X = .X` which is cyclical.
  180. // The value of .X and .Y becomes <error> but .Z is still valid.
  181. //
  182. //@dump-sem-ir-begin
  183. // CHECK:STDERR: fail_cycle.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(M.X)` [FacetTypeConstraintCycle]
  184. // CHECK:STDERR: fn F(T:! M where .X = .Y and .Y = .X and .Z = ()) {}
  185. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  186. // CHECK:STDERR:
  187. fn F(T:! M where .X = .Y and .Y = .X and .Z = ()) {}
  188. //@dump-sem-ir-end
  189. // --- fail_cycle_between_interfaces.carbon
  190. library "[[@TEST_NAME]]";
  191. interface I {
  192. let X1:! type;
  193. let X2:! type;
  194. }
  195. interface J {
  196. let X3:! type;
  197. }
  198. // This fails because it resolves to `.X1 = .X1` which is cyclical.
  199. //
  200. // CHECK:STDERR: fail_cycle_between_interfaces.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(I.X2)` [FacetTypeConstraintCycle]
  201. // CHECK:STDERR: fn G(T:! I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {}
  202. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203. // CHECK:STDERR:
  204. fn G(T:! I & J where .X1 = .X3 and .X2 = .X1 and .X3 = .X2) {}
  205. // --- fail_indirect_cycle.carbon
  206. library "[[@TEST_NAME]]";
  207. interface I {
  208. let X1:! type;
  209. let X2:! type;
  210. }
  211. // This fails because it resolves to `.X1 = .X1**` which is cyclical.
  212. //
  213. // CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(I.X1)` [FacetTypeConstraintCycle]
  214. // CHECK:STDERR: fn F(T:! I where .X1 = .X2* and .X2 = .X1*);
  215. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  216. // CHECK:STDERR:
  217. fn F(T:! I where .X1 = .X2* and .X2 = .X1*);
  218. class C(T:! type);
  219. // This fails because it resolves to `.X1 = C(C(.X1))` which is cyclical.
  220. //
  221. // CHECK:STDERR: fail_indirect_cycle.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(I.X1)` [FacetTypeConstraintCycle]
  222. // CHECK:STDERR: fn G(T:! I where .X1 = C(.X2) and .X2 = C(.X1));
  223. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  224. // CHECK:STDERR:
  225. fn G(T:! I where .X1 = C(.X2) and .X2 = C(.X1));
  226. // --- fail_complex_indirect_cycle.carbon
  227. library "[[@TEST_NAME]]";
  228. interface I {
  229. let X1:! type;
  230. let X2:! type;
  231. let X3:! type;
  232. }
  233. class C(T:! type, U:! type);
  234. // This fails because it resolves to `.X1 = C(C(.X3, .X1), .X3)` which is
  235. // cyclical.
  236. //
  237. // CHECK:STDERR: fail_complex_indirect_cycle.carbon:[[@LINE+4]]:10: error: found cycle in facet type constraint for `.(I.X1)` [FacetTypeConstraintCycle]
  238. // CHECK:STDERR: fn F(T:! I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1));
  239. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  240. // CHECK:STDERR:
  241. fn F(T:! I where .X1 = C(.X2, .X3) and .X2 = C(.X3, .X1));
  242. // --- non-type.carbon
  243. library "[[@TEST_NAME]]";
  244. interface N {
  245. let Y:! {.a: {}};
  246. }
  247. fn F(T:! N where .Y = {.a = {}}) { }
  248. // --- non-type_repeated.carbon
  249. library "[[@TEST_NAME]]";
  250. interface N {
  251. let Y:! {.a: {}};
  252. }
  253. fn F(T:! N where .Y = {.a = {}} and .Y = {.a = {}}) { }
  254. // --- fail_non-type_different.carbon
  255. library "[[@TEST_NAME]]";
  256. interface N {
  257. let Y:! {.a: type};
  258. }
  259. // CHECK:STDERR: fail_non-type_different.carbon:[[@LINE+4]]:10: error: associated constant `.(N.Y)` given two different values `{.a = {}}` and `{.a = ()}` [AssociatedConstantWithDifferentValues]
  260. // CHECK:STDERR: fn F(T:! N where .Y = {.a = {}} and .Y = {.a = ()}) {}
  261. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  262. // CHECK:STDERR:
  263. fn F(T:! N where .Y = {.a = {}} and .Y = {.a = ()}) {}
  264. // --- fail_todo_cycle_through_self_reference.carbon
  265. library "[[@TEST_NAME]]";
  266. interface Z {
  267. let T:! type;
  268. // TODO: This should not be an error.
  269. //
  270. // CHECK:STDERR: fail_todo_cycle_through_self_reference.carbon:[[@LINE+7]]:11: error: associated constant has incomplete type `Z` [IncompleteTypeInAssociatedConstantDecl]
  271. // CHECK:STDERR: let U:! Z;
  272. // CHECK:STDERR: ^
  273. // CHECK:STDERR: fail_todo_cycle_through_self_reference.carbon:[[@LINE-7]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  274. // CHECK:STDERR: interface Z {
  275. // CHECK:STDERR: ^~~~~~~~~~~~~
  276. // CHECK:STDERR:
  277. let U:! Z;
  278. }
  279. // TODO: Should be diagnosed as a cycle.
  280. fn F(A:! Z where .T = .U.T and .U = .Self) {}
  281. // --- fail_todo_reference_same_constant_in_different_self.carbon
  282. library "[[@TEST_NAME]]";
  283. interface Z {
  284. let T:! type;
  285. // TODO: This should not be an error.
  286. //
  287. // CHECK:STDERR: fail_todo_reference_same_constant_in_different_self.carbon:[[@LINE+7]]:11: error: associated constant has incomplete type `Z` [IncompleteTypeInAssociatedConstantDecl]
  288. // CHECK:STDERR: let U:! Z;
  289. // CHECK:STDERR: ^
  290. // CHECK:STDERR: fail_todo_reference_same_constant_in_different_self.carbon:[[@LINE-7]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  291. // CHECK:STDERR: interface Z {
  292. // CHECK:STDERR: ^~~~~~~~~~~~~
  293. // CHECK:STDERR:
  294. let U:! Z;
  295. }
  296. // TODO: Should not be diagnosed as a cycle, once the incorrect failure above is
  297. // fixed.
  298. fn F(A:! Z where .T = (), B:! Z where .T = .U.T and .U = A) {}
  299. // --- fail_todo_non_cycle_with_self_reference.carbon
  300. library "[[@TEST_NAME]]";
  301. interface Z {
  302. // TODO: This should not be an error.
  303. //
  304. // CHECK:STDERR: fail_todo_non_cycle_with_self_reference.carbon:[[@LINE+7]]:11: error: associated constant has incomplete type `Z` [IncompleteTypeInAssociatedConstantDecl]
  305. // CHECK:STDERR: let T:! Z;
  306. // CHECK:STDERR: ^
  307. // CHECK:STDERR: fail_todo_non_cycle_with_self_reference.carbon:[[@LINE-6]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  308. // CHECK:STDERR: interface Z {
  309. // CHECK:STDERR: ^~~~~~~~~~~~~
  310. // CHECK:STDERR:
  311. let T:! Z;
  312. let U:! type;
  313. // TODO: This should not be an error.
  314. //
  315. // CHECK:STDERR: fail_todo_non_cycle_with_self_reference.carbon:[[@LINE+7]]:11: error: associated constant has incomplete type `Z` [IncompleteTypeInAssociatedConstantDecl]
  316. // CHECK:STDERR: let V:! Z;
  317. // CHECK:STDERR: ^
  318. // CHECK:STDERR: fail_todo_non_cycle_with_self_reference.carbon:[[@LINE-17]]:1: note: interface is currently being defined [InterfaceIncompleteWithinDefinition]
  319. // CHECK:STDERR: interface Z {
  320. // CHECK:STDERR: ^~~~~~~~~~~~~
  321. // CHECK:STDERR:
  322. let V:! Z;
  323. }
  324. // TODO: Should not be diagnosed as a cycle, once the incorrect failure above is
  325. // fixed.
  326. fn F(A:! Z where .T = .V.U and .V = .Self and .U = ()) -> A.T {
  327. return ();
  328. }
  329. // CHECK:STDOUT: --- fail_cycle.carbon
  330. // CHECK:STDOUT:
  331. // CHECK:STDOUT: constants {
  332. // CHECK:STDOUT: %M.type: type = facet_type <@M> [concrete]
  333. // CHECK:STDOUT: %M.assoc_type: type = assoc_entity_type @M [concrete]
  334. // CHECK:STDOUT: %assoc0: %M.assoc_type = assoc_entity element0, @M.%X [concrete]
  335. // CHECK:STDOUT: %assoc1: %M.assoc_type = assoc_entity element1, @M.%Y [concrete]
  336. // CHECK:STDOUT: %assoc2: %M.assoc_type = assoc_entity element2, @M.%Z [concrete]
  337. // CHECK:STDOUT: %.Self: %M.type = bind_symbolic_name .Self [symbolic_self]
  338. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  339. // CHECK:STDOUT: %M.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @M [symbolic_self]
  340. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %M.lookup_impl_witness, element0 [symbolic_self]
  341. // CHECK:STDOUT: %impl.elem1: type = impl_witness_access %M.lookup_impl_witness, element1 [symbolic_self]
  342. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access %M.lookup_impl_witness, element2 [symbolic_self]
  343. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  344. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  345. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: imports {
  349. // CHECK:STDOUT: }
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: file {
  352. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  353. // CHECK:STDOUT: %T.patt: <error> = symbolic_binding_pattern T, 0 [concrete]
  354. // CHECK:STDOUT: } {
  355. // CHECK:STDOUT: %.loc13_12.1: type = splice_block %.loc13_12.2 [concrete = <error>] {
  356. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type]
  357. // CHECK:STDOUT: <elided>
  358. // CHECK:STDOUT: %.Self.ref.loc13_18: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  359. // CHECK:STDOUT: %X.ref.loc13_18: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  360. // CHECK:STDOUT: %.Self.as_type.loc13_18: type = facet_access_type %.Self.ref.loc13_18 [symbolic_self = constants.%.Self.as_type]
  361. // CHECK:STDOUT: %.loc13_18: type = converted %.Self.ref.loc13_18, %.Self.as_type.loc13_18 [symbolic_self = constants.%.Self.as_type]
  362. // CHECK:STDOUT: %impl.elem0.loc13_18: type = impl_witness_access constants.%M.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  363. // CHECK:STDOUT: %.Self.ref.loc13_23: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  364. // CHECK:STDOUT: %Y.ref.loc13_23: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1]
  365. // CHECK:STDOUT: %.Self.as_type.loc13_23: type = facet_access_type %.Self.ref.loc13_23 [symbolic_self = constants.%.Self.as_type]
  366. // CHECK:STDOUT: %.loc13_23: type = converted %.Self.ref.loc13_23, %.Self.as_type.loc13_23 [symbolic_self = constants.%.Self.as_type]
  367. // CHECK:STDOUT: %impl.elem1.loc13_23: type = impl_witness_access constants.%M.lookup_impl_witness, element1 [symbolic_self = constants.%impl.elem1]
  368. // CHECK:STDOUT: %.Self.ref.loc13_30: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  369. // CHECK:STDOUT: %Y.ref.loc13_30: %M.assoc_type = name_ref Y, @Y.%assoc1 [concrete = constants.%assoc1]
  370. // CHECK:STDOUT: %.Self.as_type.loc13_30: type = facet_access_type %.Self.ref.loc13_30 [symbolic_self = constants.%.Self.as_type]
  371. // CHECK:STDOUT: %.loc13_30: type = converted %.Self.ref.loc13_30, %.Self.as_type.loc13_30 [symbolic_self = constants.%.Self.as_type]
  372. // CHECK:STDOUT: %impl.elem1.loc13_30: type = impl_witness_access constants.%M.lookup_impl_witness, element1 [symbolic_self = constants.%impl.elem1]
  373. // CHECK:STDOUT: %.Self.ref.loc13_35: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  374. // CHECK:STDOUT: %X.ref.loc13_35: %M.assoc_type = name_ref X, @X.%assoc0 [concrete = constants.%assoc0]
  375. // CHECK:STDOUT: %.Self.as_type.loc13_35: type = facet_access_type %.Self.ref.loc13_35 [symbolic_self = constants.%.Self.as_type]
  376. // CHECK:STDOUT: %.loc13_35: type = converted %.Self.ref.loc13_35, %.Self.as_type.loc13_35 [symbolic_self = constants.%.Self.as_type]
  377. // CHECK:STDOUT: %impl.elem0.loc13_35: type = impl_witness_access constants.%M.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  378. // CHECK:STDOUT: %.Self.ref.loc13_42: %M.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  379. // CHECK:STDOUT: %Z.ref: %M.assoc_type = name_ref Z, @Z.%assoc2 [concrete = constants.%assoc2]
  380. // CHECK:STDOUT: %.Self.as_type.loc13_42: type = facet_access_type %.Self.ref.loc13_42 [symbolic_self = constants.%.Self.as_type]
  381. // CHECK:STDOUT: %.loc13_42: type = converted %.Self.ref.loc13_42, %.Self.as_type.loc13_42 [symbolic_self = constants.%.Self.as_type]
  382. // CHECK:STDOUT: %impl.elem2: type = impl_witness_access constants.%M.lookup_impl_witness, element2 [symbolic_self = constants.%impl.elem2]
  383. // CHECK:STDOUT: %.loc13_48.1: %empty_tuple.type = tuple_literal ()
  384. // CHECK:STDOUT: %.loc13_48.2: type = converted %.loc13_48.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  385. // CHECK:STDOUT: %.loc13_12.2: type = where_expr %.Self [concrete = <error>] {
  386. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc13_18, %impl.elem1.loc13_23
  387. // CHECK:STDOUT: requirement_rewrite %impl.elem1.loc13_30, %impl.elem0.loc13_35
  388. // CHECK:STDOUT: requirement_rewrite %impl.elem2, %.loc13_48.2
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT: }
  391. // CHECK:STDOUT: %T: <error> = bind_symbolic_name T, 0 [concrete = <error>]
  392. // CHECK:STDOUT: }
  393. // CHECK:STDOUT: }
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: generic fn @F(%T: <error>) {
  396. // CHECK:STDOUT: !definition:
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: fn() {
  399. // CHECK:STDOUT: !entry:
  400. // CHECK:STDOUT: return
  401. // CHECK:STDOUT: }
  402. // CHECK:STDOUT: }
  403. // CHECK:STDOUT:
  404. // CHECK:STDOUT: specific @F(<error>) {}
  405. // CHECK:STDOUT: