constraints.carbon 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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. // AUTOUPDATE
  6. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/where_expr/constraints.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/where_expr/constraints.carbon
  10. // --- state_constraints.carbon
  11. library "[[@TEST_NAME]]";
  12. interface J {}
  13. interface I {
  14. let Member:! type;
  15. let Second:! J;
  16. }
  17. fn EqualEqual(U:! I where .Self == ());
  18. fn Impls(V:! J where .Self impls I);
  19. fn And(W:! I where .Self impls J and .Member == ());
  20. // --- associated_type_impls.carbon
  21. library "[[@TEST_NAME]]";
  22. interface L {}
  23. interface M {}
  24. interface K {
  25. let Associated:! L;
  26. }
  27. fn AssociatedTypeImpls(W:! K where .Associated impls M);
  28. // --- fail_left_of_impls_non_type.carbon
  29. library "[[@TEST_NAME]]";
  30. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  31. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  32. // CHECK:STDERR: ^
  33. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  34. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  35. // CHECK:STDERR: ^
  36. // CHECK:STDERR:
  37. fn NonTypeImpls(U:! type where 7 impls type);
  38. // --- fail_right_of_impls_non_type.carbon
  39. library "[[@TEST_NAME]]";
  40. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  41. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  42. // CHECK:STDERR: ^
  43. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `Core.IntLiteral` does not implement interface `Core.ImplicitAs(type)` [MissingImplInMemberAccessNote]
  44. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  45. // CHECK:STDERR: ^
  46. // CHECK:STDERR:
  47. fn ImplsNonType(U:! type where .Self impls 7);
  48. // --- fail_right_of_impls_non_facet_type.carbon
  49. library "[[@TEST_NAME]]";
  50. // CHECK:STDERR: fail_right_of_impls_non_facet_type.carbon:[[@LINE+4]]:51: error: right argument of `impls` requirement must be a facet type [ImplsOnNonFacetType]
  51. // CHECK:STDERR: fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  52. // CHECK:STDERR: ^~~
  53. // CHECK:STDERR:
  54. fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  55. // --- fail_todo_enforce_constraint.carbon
  56. library "[[@TEST_NAME]]";
  57. import library "state_constraints";
  58. // C implements J but not I.
  59. class C {}
  60. impl C as J {}
  61. // TODO: Should report that `C` does not meet the constraint.
  62. fn DoesNotImplI() {
  63. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+11]]:3: error: cannot implicitly convert from `type` to `J where...` [ImplicitAsConversionFailure]
  64. // CHECK:STDERR: Impls(C);
  65. // CHECK:STDERR: ^~~~~~~~
  66. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+8]]:3: note: type `type` does not implement interface `Core.ImplicitAs(J where...)` [MissingImplInMemberAccessNote]
  67. // CHECK:STDERR: Impls(C);
  68. // CHECK:STDERR: ^~~~~~~~
  69. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE-14]]:1: in import [InImport]
  70. // CHECK:STDERR: state_constraints.carbon:13:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  71. // CHECK:STDERR: fn Impls(V:! J where .Self impls I);
  72. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  73. // CHECK:STDERR:
  74. Impls(C);
  75. }
  76. fn EmptyStruct(Y:! J where .Self == {});
  77. // TODO: Should report that `C` does not meeet the constraint.
  78. fn NotEmptyStruct() {
  79. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `type` to `J where...` [ImplicitAsConversionFailure]
  80. // CHECK:STDERR: EmptyStruct(C);
  81. // CHECK:STDERR: ^~~~~~~~~~~~~~
  82. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `Core.ImplicitAs(J where...)` [MissingImplInMemberAccessNote]
  83. // CHECK:STDERR: EmptyStruct(C);
  84. // CHECK:STDERR: ^~~~~~~~~~~~~~
  85. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  86. // CHECK:STDERR: fn EmptyStruct(Y:! J where .Self == {});
  87. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. // CHECK:STDERR:
  89. EmptyStruct(C);
  90. }
  91. // CHECK:STDOUT: --- state_constraints.carbon
  92. // CHECK:STDOUT:
  93. // CHECK:STDOUT: constants {
  94. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  95. // CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic]
  96. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  97. // CHECK:STDOUT: %Self.826: %I.type = bind_symbolic_name Self, 0 [symbolic]
  98. // CHECK:STDOUT: %I.assoc_type: type = assoc_entity_type %I.type [concrete]
  99. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Member [concrete]
  100. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  101. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%Second [concrete]
  102. // CHECK:STDOUT: %.Self.258: %I.type = bind_symbolic_name .Self [symbolic_self]
  103. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where TODO> [concrete]
  104. // CHECK:STDOUT: %U: %I_where.type = bind_symbolic_name U, 0 [symbolic]
  105. // CHECK:STDOUT: %U.patt: %I_where.type = symbolic_binding_pattern U, 0 [symbolic]
  106. // CHECK:STDOUT: %EqualEqual.type: type = fn_type @EqualEqual [concrete]
  107. // CHECK:STDOUT: %EqualEqual: %EqualEqual.type = struct_value () [concrete]
  108. // CHECK:STDOUT: %.Self.968: %J.type = bind_symbolic_name .Self [symbolic_self]
  109. // CHECK:STDOUT: %.Self.as_type.78d: type = facet_access_type %.Self.968 [symbolic_self]
  110. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where TODO> [concrete]
  111. // CHECK:STDOUT: %V: %J_where.type = bind_symbolic_name V, 0 [symbolic]
  112. // CHECK:STDOUT: %V.patt: %J_where.type = symbolic_binding_pattern V, 0 [symbolic]
  113. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [concrete]
  114. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [concrete]
  115. // CHECK:STDOUT: %.Self.as_type.541: type = facet_access_type %.Self.258 [symbolic_self]
  116. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.258 [symbolic_self]
  117. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type.541, %.Self.as_wit [symbolic_self]
  118. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  119. // CHECK:STDOUT: %W: %I_where.type = bind_symbolic_name W, 0 [symbolic]
  120. // CHECK:STDOUT: %W.patt: %I_where.type = symbolic_binding_pattern W, 0 [symbolic]
  121. // CHECK:STDOUT: %And.type: type = fn_type @And [concrete]
  122. // CHECK:STDOUT: %And: %And.type = struct_value () [concrete]
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: imports {
  126. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  127. // CHECK:STDOUT: import Core//prelude
  128. // CHECK:STDOUT: import Core//prelude/...
  129. // CHECK:STDOUT: }
  130. // CHECK:STDOUT: }
  131. // CHECK:STDOUT:
  132. // CHECK:STDOUT: file {
  133. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  134. // CHECK:STDOUT: .Core = imports.%Core
  135. // CHECK:STDOUT: .J = %J.decl
  136. // CHECK:STDOUT: .I = %I.decl
  137. // CHECK:STDOUT: .EqualEqual = %EqualEqual.decl
  138. // CHECK:STDOUT: .Impls = %Impls.decl
  139. // CHECK:STDOUT: .And = %And.decl
  140. // CHECK:STDOUT: }
  141. // CHECK:STDOUT: %Core.import = import Core
  142. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  143. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  144. // CHECK:STDOUT: %EqualEqual.decl: %EqualEqual.type = fn_decl @EqualEqual [concrete = constants.%EqualEqual] {
  145. // CHECK:STDOUT: %U.patt.loc11_15.1: %I_where.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  146. // CHECK:STDOUT: %U.param_patt: %I_where.type = value_param_pattern %U.patt.loc11_15.1, runtime_param<none> [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  147. // CHECK:STDOUT: } {
  148. // CHECK:STDOUT: %U.param: %I_where.type = value_param runtime_param<none>
  149. // CHECK:STDOUT: %.loc11_21.1: type = splice_block %.loc11_21.2 [concrete = constants.%I_where.type] {
  150. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  151. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.258]
  152. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.258]
  153. // CHECK:STDOUT: %.loc11_37: %empty_tuple.type = tuple_literal ()
  154. // CHECK:STDOUT: %.loc11_21.2: type = where_expr %.Self [concrete = constants.%I_where.type] {
  155. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc11_37
  156. // CHECK:STDOUT: }
  157. // CHECK:STDOUT: }
  158. // CHECK:STDOUT: %U.loc11_15.1: %I_where.type = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_15.2 (constants.%U)]
  159. // CHECK:STDOUT: }
  160. // CHECK:STDOUT: %Impls.decl: %Impls.type = fn_decl @Impls [concrete = constants.%Impls] {
  161. // CHECK:STDOUT: %V.patt.loc13_10.1: %J_where.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  162. // CHECK:STDOUT: %V.param_patt: %J_where.type = value_param_pattern %V.patt.loc13_10.1, runtime_param<none> [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  163. // CHECK:STDOUT: } {
  164. // CHECK:STDOUT: %V.param: %J_where.type = value_param runtime_param<none>
  165. // CHECK:STDOUT: %.loc13_16.1: type = splice_block %.loc13_16.2 [concrete = constants.%J_where.type] {
  166. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  167. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.968]
  168. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.968]
  169. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  170. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type.78d]
  171. // CHECK:STDOUT: %.loc13_22: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type.78d]
  172. // CHECK:STDOUT: %.loc13_16.2: type = where_expr %.Self [concrete = constants.%J_where.type] {
  173. // CHECK:STDOUT: requirement_impls %.loc13_22, %I.ref
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT: }
  176. // CHECK:STDOUT: %V.loc13_10.1: %J_where.type = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc13_10.2 (constants.%V)]
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [concrete = constants.%And] {
  179. // CHECK:STDOUT: %W.patt.loc15_8.1: %I_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  180. // CHECK:STDOUT: %W.param_patt: %I_where.type = value_param_pattern %W.patt.loc15_8.1, runtime_param<none> [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  181. // CHECK:STDOUT: } {
  182. // CHECK:STDOUT: %W.param: %I_where.type = value_param runtime_param<none>
  183. // CHECK:STDOUT: %.loc15_14.1: type = splice_block %.loc15_14.2 [concrete = constants.%I_where.type] {
  184. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  185. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self.258]
  186. // CHECK:STDOUT: %.Self.ref.loc15_20: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.258]
  187. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  188. // CHECK:STDOUT: %.Self.as_type.loc15_20: type = facet_access_type %.Self.ref.loc15_20 [symbolic_self = constants.%.Self.as_type.541]
  189. // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref.loc15_20, %.Self.as_type.loc15_20 [symbolic_self = constants.%.Self.as_type.541]
  190. // CHECK:STDOUT: %.Self.ref.loc15_38: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self.258]
  191. // CHECK:STDOUT: %Member.ref: %I.assoc_type = name_ref Member, @Member.%assoc0 [concrete = constants.%assoc0]
  192. // CHECK:STDOUT: %.Self.as_type.loc15_38: type = facet_access_type %.Self.ref.loc15_38 [symbolic_self = constants.%.Self.as_type.541]
  193. // CHECK:STDOUT: %.loc15_38: type = converted %.Self.ref.loc15_38, %.Self.as_type.loc15_38 [symbolic_self = constants.%.Self.as_type.541]
  194. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref.loc15_38 [symbolic_self = constants.%.Self.as_wit]
  195. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  196. // CHECK:STDOUT: %.loc15_50: %empty_tuple.type = tuple_literal ()
  197. // CHECK:STDOUT: %.loc15_14.2: type = where_expr %.Self [concrete = constants.%I_where.type] {
  198. // CHECK:STDOUT: requirement_impls %.loc15_20, %J.ref
  199. // CHECK:STDOUT: requirement_equivalent %impl.elem0, %.loc15_50
  200. // CHECK:STDOUT: }
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: %W.loc15_8.1: %I_where.type = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc15_8.2 (constants.%W)]
  203. // CHECK:STDOUT: }
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: interface @J {
  207. // CHECK:STDOUT: %Self: %J.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.ccd]
  208. // CHECK:STDOUT:
  209. // CHECK:STDOUT: !members:
  210. // CHECK:STDOUT: .Self = %Self
  211. // CHECK:STDOUT: witness = ()
  212. // CHECK:STDOUT: }
  213. // CHECK:STDOUT:
  214. // CHECK:STDOUT: interface @I {
  215. // CHECK:STDOUT: %Self: %I.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.826]
  216. // CHECK:STDOUT: %Member: type = assoc_const_decl @Member [concrete] {
  217. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Member [concrete = constants.%assoc0]
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: %Second: %J.type = assoc_const_decl @Second [concrete] {
  220. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%Second [concrete = constants.%assoc1]
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT:
  223. // CHECK:STDOUT: !members:
  224. // CHECK:STDOUT: .Self = %Self
  225. // CHECK:STDOUT: .Member = @Member.%assoc0
  226. // CHECK:STDOUT: .J = <poisoned>
  227. // CHECK:STDOUT: .Second = @Second.%assoc1
  228. // CHECK:STDOUT: witness = (%Member, %Second)
  229. // CHECK:STDOUT: }
  230. // CHECK:STDOUT:
  231. // CHECK:STDOUT: generic assoc_const @Member(@I.%Self: %I.type) {
  232. // CHECK:STDOUT: assoc_const Member:! type;
  233. // CHECK:STDOUT: }
  234. // CHECK:STDOUT:
  235. // CHECK:STDOUT: generic assoc_const @Second(@I.%Self: %I.type) {
  236. // CHECK:STDOUT: assoc_const Second:! %J.type;
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT:
  239. // CHECK:STDOUT: generic fn @EqualEqual(%U.loc11_15.1: %I_where.type) {
  240. // CHECK:STDOUT: %U.loc11_15.2: %I_where.type = bind_symbolic_name U, 0 [symbolic = %U.loc11_15.2 (constants.%U)]
  241. // CHECK:STDOUT: %U.patt.loc11_15.2: %I_where.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: fn(%U.param_patt: %I_where.type);
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: generic fn @Impls(%V.loc13_10.1: %J_where.type) {
  247. // CHECK:STDOUT: %V.loc13_10.2: %J_where.type = bind_symbolic_name V, 0 [symbolic = %V.loc13_10.2 (constants.%V)]
  248. // CHECK:STDOUT: %V.patt.loc13_10.2: %J_where.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: fn(%V.param_patt: %J_where.type);
  251. // CHECK:STDOUT: }
  252. // CHECK:STDOUT:
  253. // CHECK:STDOUT: generic fn @And(%W.loc15_8.1: %I_where.type) {
  254. // CHECK:STDOUT: %W.loc15_8.2: %I_where.type = bind_symbolic_name W, 0 [symbolic = %W.loc15_8.2 (constants.%W)]
  255. // CHECK:STDOUT: %W.patt.loc15_8.2: %I_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  256. // CHECK:STDOUT:
  257. // CHECK:STDOUT: fn(%W.param_patt: %I_where.type);
  258. // CHECK:STDOUT: }
  259. // CHECK:STDOUT:
  260. // CHECK:STDOUT: specific @Member(constants.%Self.826) {}
  261. // CHECK:STDOUT:
  262. // CHECK:STDOUT: specific @Second(constants.%Self.826) {}
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: specific @EqualEqual(constants.%U) {
  265. // CHECK:STDOUT: %U.loc11_15.2 => constants.%U
  266. // CHECK:STDOUT: %U.patt.loc11_15.2 => constants.%U
  267. // CHECK:STDOUT: }
  268. // CHECK:STDOUT:
  269. // CHECK:STDOUT: specific @Impls(constants.%V) {
  270. // CHECK:STDOUT: %V.loc13_10.2 => constants.%V
  271. // CHECK:STDOUT: %V.patt.loc13_10.2 => constants.%V
  272. // CHECK:STDOUT: }
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: specific @Member(constants.%I.facet) {}
  275. // CHECK:STDOUT:
  276. // CHECK:STDOUT: specific @And(constants.%W) {
  277. // CHECK:STDOUT: %W.loc15_8.2 => constants.%W
  278. // CHECK:STDOUT: %W.patt.loc15_8.2 => constants.%W
  279. // CHECK:STDOUT: }
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: --- associated_type_impls.carbon
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: constants {
  284. // CHECK:STDOUT: %L.type: type = facet_type <@L> [concrete]
  285. // CHECK:STDOUT: %Self.1d2: %L.type = bind_symbolic_name Self, 0 [symbolic]
  286. // CHECK:STDOUT: %M.type: type = facet_type <@M> [concrete]
  287. // CHECK:STDOUT: %Self.bcc: %M.type = bind_symbolic_name Self, 0 [symbolic]
  288. // CHECK:STDOUT: %K.type: type = facet_type <@K> [concrete]
  289. // CHECK:STDOUT: %Self.09f: %K.type = bind_symbolic_name Self, 0 [symbolic]
  290. // CHECK:STDOUT: %K.assoc_type: type = assoc_entity_type %K.type [concrete]
  291. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%Associated [concrete]
  292. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic_self]
  293. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  294. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic_self]
  295. // CHECK:STDOUT: %K.facet: %K.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic_self]
  296. // CHECK:STDOUT: %impl.elem0: %L.type = impl_witness_access %.Self.as_wit, element0 [symbolic_self]
  297. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic_self]
  298. // CHECK:STDOUT: %K_where.type: type = facet_type <@K where TODO> [concrete]
  299. // CHECK:STDOUT: %W: %K_where.type = bind_symbolic_name W, 0 [symbolic]
  300. // CHECK:STDOUT: %W.patt: %K_where.type = symbolic_binding_pattern W, 0 [symbolic]
  301. // CHECK:STDOUT: %AssociatedTypeImpls.type: type = fn_type @AssociatedTypeImpls [concrete]
  302. // CHECK:STDOUT: %AssociatedTypeImpls: %AssociatedTypeImpls.type = struct_value () [concrete]
  303. // CHECK:STDOUT: }
  304. // CHECK:STDOUT:
  305. // CHECK:STDOUT: imports {
  306. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  307. // CHECK:STDOUT: import Core//prelude
  308. // CHECK:STDOUT: import Core//prelude/...
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT: }
  311. // CHECK:STDOUT:
  312. // CHECK:STDOUT: file {
  313. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  314. // CHECK:STDOUT: .Core = imports.%Core
  315. // CHECK:STDOUT: .L = %L.decl
  316. // CHECK:STDOUT: .M = %M.decl
  317. // CHECK:STDOUT: .K = %K.decl
  318. // CHECK:STDOUT: .AssociatedTypeImpls = %AssociatedTypeImpls.decl
  319. // CHECK:STDOUT: }
  320. // CHECK:STDOUT: %Core.import = import Core
  321. // CHECK:STDOUT: %L.decl: type = interface_decl @L [concrete = constants.%L.type] {} {}
  322. // CHECK:STDOUT: %M.decl: type = interface_decl @M [concrete = constants.%M.type] {} {}
  323. // CHECK:STDOUT: %K.decl: type = interface_decl @K [concrete = constants.%K.type] {} {}
  324. // CHECK:STDOUT: %AssociatedTypeImpls.decl: %AssociatedTypeImpls.type = fn_decl @AssociatedTypeImpls [concrete = constants.%AssociatedTypeImpls] {
  325. // CHECK:STDOUT: %W.patt.loc11_24.1: %K_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_24.2 (constants.%W.patt)]
  326. // CHECK:STDOUT: %W.param_patt: %K_where.type = value_param_pattern %W.patt.loc11_24.1, runtime_param<none> [symbolic = %W.patt.loc11_24.2 (constants.%W.patt)]
  327. // CHECK:STDOUT: } {
  328. // CHECK:STDOUT: %W.param: %K_where.type = value_param runtime_param<none>
  329. // CHECK:STDOUT: %.loc11_30.1: type = splice_block %.loc11_30.2 [concrete = constants.%K_where.type] {
  330. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [concrete = constants.%K.type]
  331. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  332. // CHECK:STDOUT: %.Self.ref: %K.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  333. // CHECK:STDOUT: %Associated.ref: %K.assoc_type = name_ref Associated, @Associated.%assoc0 [concrete = constants.%assoc0]
  334. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  335. // CHECK:STDOUT: %.loc11_36.1: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  336. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic_self = constants.%.Self.as_wit]
  337. // CHECK:STDOUT: %impl.elem0: %L.type = impl_witness_access %.Self.as_wit, element0 [symbolic_self = constants.%impl.elem0]
  338. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [concrete = constants.%M.type]
  339. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic_self = constants.%as_type]
  340. // CHECK:STDOUT: %.loc11_36.2: type = converted %impl.elem0, %as_type [symbolic_self = constants.%as_type]
  341. // CHECK:STDOUT: %.loc11_30.2: type = where_expr %.Self [concrete = constants.%K_where.type] {
  342. // CHECK:STDOUT: requirement_impls %.loc11_36.2, %M.ref
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: }
  345. // CHECK:STDOUT: %W.loc11_24.1: %K_where.type = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc11_24.2 (constants.%W)]
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: interface @L {
  350. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1d2]
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: !members:
  353. // CHECK:STDOUT: .Self = %Self
  354. // CHECK:STDOUT: witness = ()
  355. // CHECK:STDOUT: }
  356. // CHECK:STDOUT:
  357. // CHECK:STDOUT: interface @M {
  358. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.bcc]
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: !members:
  361. // CHECK:STDOUT: .Self = %Self
  362. // CHECK:STDOUT: witness = ()
  363. // CHECK:STDOUT: }
  364. // CHECK:STDOUT:
  365. // CHECK:STDOUT: interface @K {
  366. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.09f]
  367. // CHECK:STDOUT: %Associated: %L.type = assoc_const_decl @Associated [concrete] {
  368. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%Associated [concrete = constants.%assoc0]
  369. // CHECK:STDOUT: }
  370. // CHECK:STDOUT:
  371. // CHECK:STDOUT: !members:
  372. // CHECK:STDOUT: .Self = %Self
  373. // CHECK:STDOUT: .L = <poisoned>
  374. // CHECK:STDOUT: .Associated = @Associated.%assoc0
  375. // CHECK:STDOUT: witness = (%Associated)
  376. // CHECK:STDOUT: }
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: generic assoc_const @Associated(@K.%Self: %K.type) {
  379. // CHECK:STDOUT: assoc_const Associated:! %L.type;
  380. // CHECK:STDOUT: }
  381. // CHECK:STDOUT:
  382. // CHECK:STDOUT: generic fn @AssociatedTypeImpls(%W.loc11_24.1: %K_where.type) {
  383. // CHECK:STDOUT: %W.loc11_24.2: %K_where.type = bind_symbolic_name W, 0 [symbolic = %W.loc11_24.2 (constants.%W)]
  384. // CHECK:STDOUT: %W.patt.loc11_24.2: %K_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_24.2 (constants.%W.patt)]
  385. // CHECK:STDOUT:
  386. // CHECK:STDOUT: fn(%W.param_patt: %K_where.type);
  387. // CHECK:STDOUT: }
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: specific @Associated(constants.%Self.09f) {}
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: specific @Associated(constants.%K.facet) {}
  392. // CHECK:STDOUT:
  393. // CHECK:STDOUT: specific @AssociatedTypeImpls(constants.%W) {
  394. // CHECK:STDOUT: %W.loc11_24.2 => constants.%W
  395. // CHECK:STDOUT: %W.patt.loc11_24.2 => constants.%W
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: --- fail_left_of_impls_non_type.carbon
  399. // CHECK:STDOUT:
  400. // CHECK:STDOUT: constants {
  401. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self]
  402. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete]
  403. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [concrete]
  404. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  405. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  406. // CHECK:STDOUT: %NonTypeImpls.type: type = fn_type @NonTypeImpls [concrete]
  407. // CHECK:STDOUT: %NonTypeImpls: %NonTypeImpls.type = struct_value () [concrete]
  408. // CHECK:STDOUT: }
  409. // CHECK:STDOUT:
  410. // CHECK:STDOUT: imports {
  411. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  412. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  413. // CHECK:STDOUT: import Core//prelude
  414. // CHECK:STDOUT: import Core//prelude/...
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT: }
  417. // CHECK:STDOUT:
  418. // CHECK:STDOUT: file {
  419. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  420. // CHECK:STDOUT: .Core = imports.%Core
  421. // CHECK:STDOUT: .NonTypeImpls = %NonTypeImpls.decl
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT: %Core.import = import Core
  424. // CHECK:STDOUT: %NonTypeImpls.decl: %NonTypeImpls.type = fn_decl @NonTypeImpls [concrete = constants.%NonTypeImpls] {
  425. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  426. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc11_17.1, runtime_param<none> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  427. // CHECK:STDOUT: } {
  428. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  429. // CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [concrete = constants.%type_where] {
  430. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  431. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7]
  432. // CHECK:STDOUT: %.loc11_32: type = converted %int_7, <error> [concrete = <error>]
  433. // CHECK:STDOUT: %.loc11_26.2: type = where_expr %.Self [concrete = constants.%type_where] {
  434. // CHECK:STDOUT: requirement_impls <error>, type
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: generic fn @NonTypeImpls(%U.loc11_17.1: %type_where) {
  442. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  443. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  446. // CHECK:STDOUT: }
  447. // CHECK:STDOUT:
  448. // CHECK:STDOUT: specific @NonTypeImpls(constants.%U) {
  449. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  450. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  451. // CHECK:STDOUT: }
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: --- fail_right_of_impls_non_type.carbon
  454. // CHECK:STDOUT:
  455. // CHECK:STDOUT: constants {
  456. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self]
  457. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete]
  458. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [concrete]
  459. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  460. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  461. // CHECK:STDOUT: %ImplsNonType.type: type = fn_type @ImplsNonType [concrete]
  462. // CHECK:STDOUT: %ImplsNonType: %ImplsNonType.type = struct_value () [concrete]
  463. // CHECK:STDOUT: }
  464. // CHECK:STDOUT:
  465. // CHECK:STDOUT: imports {
  466. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  467. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  468. // CHECK:STDOUT: import Core//prelude
  469. // CHECK:STDOUT: import Core//prelude/...
  470. // CHECK:STDOUT: }
  471. // CHECK:STDOUT: }
  472. // CHECK:STDOUT:
  473. // CHECK:STDOUT: file {
  474. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  475. // CHECK:STDOUT: .Core = imports.%Core
  476. // CHECK:STDOUT: .ImplsNonType = %ImplsNonType.decl
  477. // CHECK:STDOUT: }
  478. // CHECK:STDOUT: %Core.import = import Core
  479. // CHECK:STDOUT: %ImplsNonType.decl: %ImplsNonType.type = fn_decl @ImplsNonType [concrete = constants.%ImplsNonType] {
  480. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  481. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc11_17.1, runtime_param<none> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  482. // CHECK:STDOUT: } {
  483. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  484. // CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [concrete = constants.%type_where] {
  485. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  486. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  487. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [concrete = constants.%int_7]
  488. // CHECK:STDOUT: %.loc11_44: type = converted %int_7, <error> [concrete = <error>]
  489. // CHECK:STDOUT: %.loc11_26.2: type = where_expr %.Self [concrete = constants.%type_where] {
  490. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  491. // CHECK:STDOUT: }
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT: }
  496. // CHECK:STDOUT:
  497. // CHECK:STDOUT: generic fn @ImplsNonType(%U.loc11_17.1: %type_where) {
  498. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  499. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  500. // CHECK:STDOUT:
  501. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  502. // CHECK:STDOUT: }
  503. // CHECK:STDOUT:
  504. // CHECK:STDOUT: specific @ImplsNonType(constants.%U) {
  505. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  506. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  507. // CHECK:STDOUT: }
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: --- fail_right_of_impls_non_facet_type.carbon
  510. // CHECK:STDOUT:
  511. // CHECK:STDOUT: constants {
  512. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self]
  513. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete]
  514. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [concrete]
  515. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [concrete]
  516. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  517. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  518. // CHECK:STDOUT: %ImplsOfNonFacetType.type: type = fn_type @ImplsOfNonFacetType [concrete]
  519. // CHECK:STDOUT: %ImplsOfNonFacetType: %ImplsOfNonFacetType.type = struct_value () [concrete]
  520. // CHECK:STDOUT: }
  521. // CHECK:STDOUT:
  522. // CHECK:STDOUT: imports {
  523. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  524. // CHECK:STDOUT: .Int = %Core.Int
  525. // CHECK:STDOUT: import Core//prelude
  526. // CHECK:STDOUT: import Core//prelude/...
  527. // CHECK:STDOUT: }
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT:
  530. // CHECK:STDOUT: file {
  531. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  532. // CHECK:STDOUT: .Core = imports.%Core
  533. // CHECK:STDOUT: .ImplsOfNonFacetType = %ImplsOfNonFacetType.decl
  534. // CHECK:STDOUT: }
  535. // CHECK:STDOUT: %Core.import = import Core
  536. // CHECK:STDOUT: %ImplsOfNonFacetType.decl: %ImplsOfNonFacetType.type = fn_decl @ImplsOfNonFacetType [concrete = constants.%ImplsOfNonFacetType] {
  537. // CHECK:STDOUT: %U.patt.loc8_24.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  538. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc8_24.1, runtime_param<none> [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  539. // CHECK:STDOUT: } {
  540. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  541. // CHECK:STDOUT: %.loc8_33.1: type = splice_block %.loc8_33.2 [concrete = constants.%type_where] {
  542. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  543. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  544. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [concrete = constants.%int_32]
  545. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [concrete = constants.%i32]
  546. // CHECK:STDOUT: %.loc8_33.2: type = where_expr %.Self [concrete = constants.%type_where] {
  547. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  548. // CHECK:STDOUT: }
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: %U.loc8_24.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc8_24.2 (constants.%U)]
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT: }
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: generic fn @ImplsOfNonFacetType(%U.loc8_24.1: %type_where) {
  555. // CHECK:STDOUT: %U.loc8_24.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc8_24.2 (constants.%U)]
  556. // CHECK:STDOUT: %U.patt.loc8_24.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  557. // CHECK:STDOUT:
  558. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  559. // CHECK:STDOUT: }
  560. // CHECK:STDOUT:
  561. // CHECK:STDOUT: specific @ImplsOfNonFacetType(constants.%U) {
  562. // CHECK:STDOUT: %U.loc8_24.2 => constants.%U
  563. // CHECK:STDOUT: %U.patt.loc8_24.2 => constants.%U
  564. // CHECK:STDOUT: }
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: --- fail_todo_enforce_constraint.carbon
  567. // CHECK:STDOUT:
  568. // CHECK:STDOUT: constants {
  569. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  570. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  571. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  572. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  573. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [concrete]
  574. // CHECK:STDOUT: %DoesNotImplI.type: type = fn_type @DoesNotImplI [concrete]
  575. // CHECK:STDOUT: %DoesNotImplI: %DoesNotImplI.type = struct_value () [concrete]
  576. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [concrete]
  577. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [concrete]
  578. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where TODO> [concrete]
  579. // CHECK:STDOUT: %V.patt: %J_where.type = symbolic_binding_pattern V, 0 [symbolic]
  580. // CHECK:STDOUT: %V: %J_where.type = bind_symbolic_name V, 0 [symbolic]
  581. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self]
  582. // CHECK:STDOUT: %Y: %J_where.type = bind_symbolic_name Y, 0 [symbolic]
  583. // CHECK:STDOUT: %Y.patt: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic]
  584. // CHECK:STDOUT: %EmptyStruct.type: type = fn_type @EmptyStruct [concrete]
  585. // CHECK:STDOUT: %EmptyStruct: %EmptyStruct.type = struct_value () [concrete]
  586. // CHECK:STDOUT: %NotEmptyStruct.type: type = fn_type @NotEmptyStruct [concrete]
  587. // CHECK:STDOUT: %NotEmptyStruct: %NotEmptyStruct.type = struct_value () [concrete]
  588. // CHECK:STDOUT: }
  589. // CHECK:STDOUT:
  590. // CHECK:STDOUT: imports {
  591. // CHECK:STDOUT: %Main.J: type = import_ref Main//state_constraints, J, loaded [concrete = constants.%J.type]
  592. // CHECK:STDOUT: %Main.I = import_ref Main//state_constraints, I, unloaded
  593. // CHECK:STDOUT: %Main.EqualEqual = import_ref Main//state_constraints, EqualEqual, unloaded
  594. // CHECK:STDOUT: %Main.Impls: %Impls.type = import_ref Main//state_constraints, Impls, loaded [concrete = constants.%Impls]
  595. // CHECK:STDOUT: %Main.And = import_ref Main//state_constraints, And, unloaded
  596. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [concrete] {
  597. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  598. // CHECK:STDOUT: import Core//prelude
  599. // CHECK:STDOUT: import Core//prelude/...
  600. // CHECK:STDOUT: }
  601. // CHECK:STDOUT: %Main.import_ref.8fd = import_ref Main//state_constraints, inst17 [no loc], unloaded
  602. // CHECK:STDOUT: %Main.import_ref.81e: %J_where.type = import_ref Main//state_constraints, loc13_10, loaded [symbolic = @Impls.%V (constants.%V)]
  603. // CHECK:STDOUT: }
  604. // CHECK:STDOUT:
  605. // CHECK:STDOUT: file {
  606. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  607. // CHECK:STDOUT: .J = imports.%Main.J
  608. // CHECK:STDOUT: .I = imports.%Main.I
  609. // CHECK:STDOUT: .EqualEqual = imports.%Main.EqualEqual
  610. // CHECK:STDOUT: .Impls = imports.%Main.Impls
  611. // CHECK:STDOUT: .And = imports.%Main.And
  612. // CHECK:STDOUT: .Core = imports.%Core
  613. // CHECK:STDOUT: .C = %C.decl
  614. // CHECK:STDOUT: .DoesNotImplI = %DoesNotImplI.decl
  615. // CHECK:STDOUT: .EmptyStruct = %EmptyStruct.decl
  616. // CHECK:STDOUT: .NotEmptyStruct = %NotEmptyStruct.decl
  617. // CHECK:STDOUT: }
  618. // CHECK:STDOUT: %Core.import = import Core
  619. // CHECK:STDOUT: %default.import = import <none>
  620. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  621. // CHECK:STDOUT: impl_decl @impl [concrete] {} {
  622. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  623. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%Main.J [concrete = constants.%J.type]
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [concrete = constants.%impl_witness]
  626. // CHECK:STDOUT: %DoesNotImplI.decl: %DoesNotImplI.type = fn_decl @DoesNotImplI [concrete = constants.%DoesNotImplI] {} {}
  627. // CHECK:STDOUT: %EmptyStruct.decl: %EmptyStruct.type = fn_decl @EmptyStruct [concrete = constants.%EmptyStruct] {
  628. // CHECK:STDOUT: %Y.patt.loc26_16.1: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  629. // CHECK:STDOUT: %Y.param_patt: %J_where.type = value_param_pattern %Y.patt.loc26_16.1, runtime_param<none> [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  630. // CHECK:STDOUT: } {
  631. // CHECK:STDOUT: %Y.param: %J_where.type = value_param runtime_param<none>
  632. // CHECK:STDOUT: %.loc26_22.1: type = splice_block %.loc26_22.2 [concrete = constants.%J_where.type] {
  633. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%Main.J [concrete = constants.%J.type]
  634. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic_self = constants.%.Self]
  635. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  636. // CHECK:STDOUT: %.loc26_38: %empty_struct_type = struct_literal ()
  637. // CHECK:STDOUT: %.loc26_22.2: type = where_expr %.Self [concrete = constants.%J_where.type] {
  638. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc26_38
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: %Y.loc26_16.1: %J_where.type = bind_symbolic_name Y, 0, %Y.param [symbolic = %Y.loc26_16.2 (constants.%Y)]
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT: %NotEmptyStruct.decl: %NotEmptyStruct.type = fn_decl @NotEmptyStruct [concrete = constants.%NotEmptyStruct] {} {}
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT:
  646. // CHECK:STDOUT: interface @J [from "state_constraints.carbon"] {
  647. // CHECK:STDOUT: !members:
  648. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8fd
  649. // CHECK:STDOUT: witness = ()
  650. // CHECK:STDOUT: }
  651. // CHECK:STDOUT:
  652. // CHECK:STDOUT: impl @impl: %C.ref as %J.ref {
  653. // CHECK:STDOUT: !members:
  654. // CHECK:STDOUT: witness = file.%impl_witness
  655. // CHECK:STDOUT: }
  656. // CHECK:STDOUT:
  657. // CHECK:STDOUT: class @C {
  658. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete = constants.%complete_type]
  659. // CHECK:STDOUT: complete_type_witness = %complete_type
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: !members:
  662. // CHECK:STDOUT: .Self = constants.%C
  663. // CHECK:STDOUT: }
  664. // CHECK:STDOUT:
  665. // CHECK:STDOUT: fn @DoesNotImplI() {
  666. // CHECK:STDOUT: !entry:
  667. // CHECK:STDOUT: %Impls.ref: %Impls.type = name_ref Impls, imports.%Main.Impls [concrete = constants.%Impls]
  668. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  669. // CHECK:STDOUT: %.loc23: %J_where.type = converted %C.ref, <error> [concrete = <error>]
  670. // CHECK:STDOUT: return
  671. // CHECK:STDOUT: }
  672. // CHECK:STDOUT:
  673. // CHECK:STDOUT: generic fn @Impls(imports.%Main.import_ref.81e: %J_where.type) [from "state_constraints.carbon"] {
  674. // CHECK:STDOUT: %V: %J_where.type = bind_symbolic_name V, 0 [symbolic = %V (constants.%V)]
  675. // CHECK:STDOUT: %V.patt: %J_where.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt (constants.%V.patt)]
  676. // CHECK:STDOUT:
  677. // CHECK:STDOUT: fn(%V.param_patt: %J_where.type);
  678. // CHECK:STDOUT: }
  679. // CHECK:STDOUT:
  680. // CHECK:STDOUT: generic fn @EmptyStruct(%Y.loc26_16.1: %J_where.type) {
  681. // CHECK:STDOUT: %Y.loc26_16.2: %J_where.type = bind_symbolic_name Y, 0 [symbolic = %Y.loc26_16.2 (constants.%Y)]
  682. // CHECK:STDOUT: %Y.patt.loc26_16.2: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: fn(%Y.param_patt: %J_where.type);
  685. // CHECK:STDOUT: }
  686. // CHECK:STDOUT:
  687. // CHECK:STDOUT: fn @NotEmptyStruct() {
  688. // CHECK:STDOUT: !entry:
  689. // CHECK:STDOUT: %EmptyStruct.ref: %EmptyStruct.type = name_ref EmptyStruct, file.%EmptyStruct.decl [concrete = constants.%EmptyStruct]
  690. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  691. // CHECK:STDOUT: %.loc40: %J_where.type = converted %C.ref, <error> [concrete = <error>]
  692. // CHECK:STDOUT: return
  693. // CHECK:STDOUT: }
  694. // CHECK:STDOUT:
  695. // CHECK:STDOUT: specific @Impls(constants.%V) {
  696. // CHECK:STDOUT: %V => constants.%V
  697. // CHECK:STDOUT: %V.patt => constants.%V
  698. // CHECK:STDOUT: }
  699. // CHECK:STDOUT:
  700. // CHECK:STDOUT: specific @EmptyStruct(constants.%Y) {
  701. // CHECK:STDOUT: %Y.loc26_16.2 => constants.%Y
  702. // CHECK:STDOUT: %Y.patt.loc26_16.2 => constants.%Y
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: