constraints.carbon 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  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> [template]
  95. // CHECK:STDOUT: %Self.ccd: %J.type = bind_symbolic_name Self, 0 [symbolic]
  96. // CHECK:STDOUT: %I.type: type = facet_type <@I> [template]
  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 [template]
  99. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Member [template]
  100. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  101. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%Second [template]
  102. // CHECK:STDOUT: %.Self.258: %I.type = bind_symbolic_name .Self [symbolic]
  103. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where TODO> [template]
  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 [template]
  107. // CHECK:STDOUT: %EqualEqual: %EqualEqual.type = struct_value () [template]
  108. // CHECK:STDOUT: %.Self.968: %J.type = bind_symbolic_name .Self [symbolic]
  109. // CHECK:STDOUT: %.Self.as_type.78d: type = facet_access_type %.Self.968 [symbolic]
  110. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where TODO> [template]
  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 [template]
  114. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  115. // CHECK:STDOUT: %.Self.as_type.541: type = facet_access_type %.Self.258 [symbolic]
  116. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.258 [symbolic]
  117. // CHECK:STDOUT: %I.facet: %I.type = facet_value %.Self.as_type.541, %.Self.as_wit [symbolic]
  118. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  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 [template]
  122. // CHECK:STDOUT: %And: %And.type = struct_value () [template]
  123. // CHECK:STDOUT: }
  124. // CHECK:STDOUT:
  125. // CHECK:STDOUT: imports {
  126. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  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 [template] {
  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 [template = constants.%J.type] {} {}
  143. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type] {} {}
  144. // CHECK:STDOUT: %EqualEqual.decl: %EqualEqual.type = fn_decl @EqualEqual [template = 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 [template = constants.%I_where.type] {
  150. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  151. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self.258]
  152. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.258]
  153. // CHECK:STDOUT: %.loc11_37: %empty_tuple.type = tuple_literal ()
  154. // CHECK:STDOUT: %.loc11_21.2: type = where_expr %.Self [template = 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 [template = 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 [template = constants.%J_where.type] {
  166. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  167. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self.968]
  168. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self.968]
  169. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  170. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type.78d]
  171. // CHECK:STDOUT: %.loc13_22: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type.78d]
  172. // CHECK:STDOUT: %.loc13_16.2: type = where_expr %.Self [template = 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 [template = 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 [template = constants.%I_where.type] {
  184. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type]
  185. // CHECK:STDOUT: %.Self: %I.type = bind_symbolic_name .Self [symbolic = constants.%.Self.258]
  186. // CHECK:STDOUT: %.Self.ref.loc15_20: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.258]
  187. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type]
  188. // CHECK:STDOUT: %.Self.as_type.loc15_20: type = facet_access_type %.Self.ref.loc15_20 [symbolic = constants.%.Self.as_type.541]
  189. // CHECK:STDOUT: %.loc15_20: type = converted %.Self.ref.loc15_20, %.Self.as_type.loc15_20 [symbolic = constants.%.Self.as_type.541]
  190. // CHECK:STDOUT: %.Self.ref.loc15_38: %I.type = name_ref .Self, %.Self [symbolic = constants.%.Self.258]
  191. // CHECK:STDOUT: %Member.ref: %I.assoc_type = name_ref Member, @Member.%assoc0 [template = constants.%assoc0]
  192. // CHECK:STDOUT: %.Self.as_type.loc15_38: type = facet_access_type %.Self.ref.loc15_38 [symbolic = constants.%.Self.as_type.541]
  193. // CHECK:STDOUT: %.loc15_38: type = converted %.Self.ref.loc15_38, %.Self.as_type.loc15_38 [symbolic = constants.%.Self.as_type.541]
  194. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref.loc15_38 [symbolic = constants.%.Self.as_wit]
  195. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  196. // CHECK:STDOUT: %.loc15_50: %empty_tuple.type = tuple_literal ()
  197. // CHECK:STDOUT: %.loc15_14.2: type = where_expr %.Self [template = 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 [template] {
  217. // CHECK:STDOUT: %assoc0: %I.assoc_type = assoc_entity element0, @I.%Member [template = constants.%assoc0]
  218. // CHECK:STDOUT: }
  219. // CHECK:STDOUT: %Second: %J.type = assoc_const_decl @Second [template] {
  220. // CHECK:STDOUT: %assoc1: %I.assoc_type = assoc_entity element1, @I.%Second [template = 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: .Second = @Second.%assoc1
  227. // CHECK:STDOUT: witness = (%Member, %Second)
  228. // CHECK:STDOUT: }
  229. // CHECK:STDOUT:
  230. // CHECK:STDOUT: generic assoc_const @Member(@I.%Self: %I.type) {
  231. // CHECK:STDOUT: assoc_const Member:! type;
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: generic assoc_const @Second(@I.%Self: %I.type) {
  235. // CHECK:STDOUT: assoc_const Second:! %J.type;
  236. // CHECK:STDOUT: }
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: generic fn @EqualEqual(%U.loc11_15.1: %I_where.type) {
  239. // CHECK:STDOUT: %U.loc11_15.2: %I_where.type = bind_symbolic_name U, 0 [symbolic = %U.loc11_15.2 (constants.%U)]
  240. // CHECK:STDOUT: %U.patt.loc11_15.2: %I_where.type = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: fn(%U.param_patt: %I_where.type);
  243. // CHECK:STDOUT: }
  244. // CHECK:STDOUT:
  245. // CHECK:STDOUT: generic fn @Impls(%V.loc13_10.1: %J_where.type) {
  246. // CHECK:STDOUT: %V.loc13_10.2: %J_where.type = bind_symbolic_name V, 0 [symbolic = %V.loc13_10.2 (constants.%V)]
  247. // CHECK:STDOUT: %V.patt.loc13_10.2: %J_where.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  248. // CHECK:STDOUT:
  249. // CHECK:STDOUT: fn(%V.param_patt: %J_where.type);
  250. // CHECK:STDOUT: }
  251. // CHECK:STDOUT:
  252. // CHECK:STDOUT: generic fn @And(%W.loc15_8.1: %I_where.type) {
  253. // CHECK:STDOUT: %W.loc15_8.2: %I_where.type = bind_symbolic_name W, 0 [symbolic = %W.loc15_8.2 (constants.%W)]
  254. // CHECK:STDOUT: %W.patt.loc15_8.2: %I_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: fn(%W.param_patt: %I_where.type);
  257. // CHECK:STDOUT: }
  258. // CHECK:STDOUT:
  259. // CHECK:STDOUT: specific @Member(constants.%Self.826) {}
  260. // CHECK:STDOUT:
  261. // CHECK:STDOUT: specific @Second(constants.%Self.826) {}
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: specific @EqualEqual(constants.%U) {
  264. // CHECK:STDOUT: %U.loc11_15.2 => constants.%U
  265. // CHECK:STDOUT: %U.patt.loc11_15.2 => constants.%U
  266. // CHECK:STDOUT: }
  267. // CHECK:STDOUT:
  268. // CHECK:STDOUT: specific @Impls(constants.%V) {
  269. // CHECK:STDOUT: %V.loc13_10.2 => constants.%V
  270. // CHECK:STDOUT: %V.patt.loc13_10.2 => constants.%V
  271. // CHECK:STDOUT: }
  272. // CHECK:STDOUT:
  273. // CHECK:STDOUT: specific @Member(constants.%I.facet) {}
  274. // CHECK:STDOUT:
  275. // CHECK:STDOUT: specific @And(constants.%W) {
  276. // CHECK:STDOUT: %W.loc15_8.2 => constants.%W
  277. // CHECK:STDOUT: %W.patt.loc15_8.2 => constants.%W
  278. // CHECK:STDOUT: }
  279. // CHECK:STDOUT:
  280. // CHECK:STDOUT: --- associated_type_impls.carbon
  281. // CHECK:STDOUT:
  282. // CHECK:STDOUT: constants {
  283. // CHECK:STDOUT: %L.type: type = facet_type <@L> [template]
  284. // CHECK:STDOUT: %Self.1d2: %L.type = bind_symbolic_name Self, 0 [symbolic]
  285. // CHECK:STDOUT: %M.type: type = facet_type <@M> [template]
  286. // CHECK:STDOUT: %Self.bcc: %M.type = bind_symbolic_name Self, 0 [symbolic]
  287. // CHECK:STDOUT: %K.type: type = facet_type <@K> [template]
  288. // CHECK:STDOUT: %Self.09f: %K.type = bind_symbolic_name Self, 0 [symbolic]
  289. // CHECK:STDOUT: %K.assoc_type: type = assoc_entity_type %K.type [template]
  290. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%Associated [template]
  291. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic]
  292. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic]
  293. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self [symbolic]
  294. // CHECK:STDOUT: %K.facet: %K.type = facet_value %.Self.as_type, %.Self.as_wit [symbolic]
  295. // CHECK:STDOUT: %impl.elem0: %L.type = impl_witness_access %.Self.as_wit, element0 [symbolic]
  296. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic]
  297. // CHECK:STDOUT: %K_where.type: type = facet_type <@K where TODO> [template]
  298. // CHECK:STDOUT: %W: %K_where.type = bind_symbolic_name W, 0 [symbolic]
  299. // CHECK:STDOUT: %W.patt: %K_where.type = symbolic_binding_pattern W, 0 [symbolic]
  300. // CHECK:STDOUT: %AssociatedTypeImpls.type: type = fn_type @AssociatedTypeImpls [template]
  301. // CHECK:STDOUT: %AssociatedTypeImpls: %AssociatedTypeImpls.type = struct_value () [template]
  302. // CHECK:STDOUT: }
  303. // CHECK:STDOUT:
  304. // CHECK:STDOUT: imports {
  305. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  306. // CHECK:STDOUT: import Core//prelude
  307. // CHECK:STDOUT: import Core//prelude/...
  308. // CHECK:STDOUT: }
  309. // CHECK:STDOUT: }
  310. // CHECK:STDOUT:
  311. // CHECK:STDOUT: file {
  312. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  313. // CHECK:STDOUT: .Core = imports.%Core
  314. // CHECK:STDOUT: .L = %L.decl
  315. // CHECK:STDOUT: .M = %M.decl
  316. // CHECK:STDOUT: .K = %K.decl
  317. // CHECK:STDOUT: .AssociatedTypeImpls = %AssociatedTypeImpls.decl
  318. // CHECK:STDOUT: }
  319. // CHECK:STDOUT: %Core.import = import Core
  320. // CHECK:STDOUT: %L.decl: type = interface_decl @L [template = constants.%L.type] {} {}
  321. // CHECK:STDOUT: %M.decl: type = interface_decl @M [template = constants.%M.type] {} {}
  322. // CHECK:STDOUT: %K.decl: type = interface_decl @K [template = constants.%K.type] {} {}
  323. // CHECK:STDOUT: %AssociatedTypeImpls.decl: %AssociatedTypeImpls.type = fn_decl @AssociatedTypeImpls [template = constants.%AssociatedTypeImpls] {
  324. // CHECK:STDOUT: %W.patt.loc11_24.1: %K_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_24.2 (constants.%W.patt)]
  325. // 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)]
  326. // CHECK:STDOUT: } {
  327. // CHECK:STDOUT: %W.param: %K_where.type = value_param runtime_param<none>
  328. // CHECK:STDOUT: %.loc11_30.1: type = splice_block %.loc11_30.2 [template = constants.%K_where.type] {
  329. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [template = constants.%K.type]
  330. // CHECK:STDOUT: %.Self: %K.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  331. // CHECK:STDOUT: %.Self.ref: %K.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  332. // CHECK:STDOUT: %Associated.ref: %K.assoc_type = name_ref Associated, @Associated.%assoc0 [template = constants.%assoc0]
  333. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic = constants.%.Self.as_type]
  334. // CHECK:STDOUT: %.loc11_36.1: type = converted %.Self.ref, %.Self.as_type [symbolic = constants.%.Self.as_type]
  335. // CHECK:STDOUT: %.Self.as_wit: <witness> = facet_access_witness %.Self.ref [symbolic = constants.%.Self.as_wit]
  336. // CHECK:STDOUT: %impl.elem0: %L.type = impl_witness_access %.Self.as_wit, element0 [symbolic = constants.%impl.elem0]
  337. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [template = constants.%M.type]
  338. // CHECK:STDOUT: %as_type: type = facet_access_type %impl.elem0 [symbolic = constants.%as_type]
  339. // CHECK:STDOUT: %.loc11_36.2: type = converted %impl.elem0, %as_type [symbolic = constants.%as_type]
  340. // CHECK:STDOUT: %.loc11_30.2: type = where_expr %.Self [template = constants.%K_where.type] {
  341. // CHECK:STDOUT: requirement_impls %.loc11_36.2, %M.ref
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: %W.loc11_24.1: %K_where.type = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc11_24.2 (constants.%W)]
  345. // CHECK:STDOUT: }
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT:
  348. // CHECK:STDOUT: interface @L {
  349. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1d2]
  350. // CHECK:STDOUT:
  351. // CHECK:STDOUT: !members:
  352. // CHECK:STDOUT: .Self = %Self
  353. // CHECK:STDOUT: witness = ()
  354. // CHECK:STDOUT: }
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: interface @M {
  357. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.bcc]
  358. // CHECK:STDOUT:
  359. // CHECK:STDOUT: !members:
  360. // CHECK:STDOUT: .Self = %Self
  361. // CHECK:STDOUT: witness = ()
  362. // CHECK:STDOUT: }
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: interface @K {
  365. // CHECK:STDOUT: %Self: %K.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.09f]
  366. // CHECK:STDOUT: %Associated: %L.type = assoc_const_decl @Associated [template] {
  367. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.%Associated [template = constants.%assoc0]
  368. // CHECK:STDOUT: }
  369. // CHECK:STDOUT:
  370. // CHECK:STDOUT: !members:
  371. // CHECK:STDOUT: .Self = %Self
  372. // CHECK:STDOUT: .Associated = @Associated.%assoc0
  373. // CHECK:STDOUT: witness = (%Associated)
  374. // CHECK:STDOUT: }
  375. // CHECK:STDOUT:
  376. // CHECK:STDOUT: generic assoc_const @Associated(@K.%Self: %K.type) {
  377. // CHECK:STDOUT: assoc_const Associated:! %L.type;
  378. // CHECK:STDOUT: }
  379. // CHECK:STDOUT:
  380. // CHECK:STDOUT: generic fn @AssociatedTypeImpls(%W.loc11_24.1: %K_where.type) {
  381. // CHECK:STDOUT: %W.loc11_24.2: %K_where.type = bind_symbolic_name W, 0 [symbolic = %W.loc11_24.2 (constants.%W)]
  382. // CHECK:STDOUT: %W.patt.loc11_24.2: %K_where.type = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc11_24.2 (constants.%W.patt)]
  383. // CHECK:STDOUT:
  384. // CHECK:STDOUT: fn(%W.param_patt: %K_where.type);
  385. // CHECK:STDOUT: }
  386. // CHECK:STDOUT:
  387. // CHECK:STDOUT: specific @Associated(constants.%Self.09f) {}
  388. // CHECK:STDOUT:
  389. // CHECK:STDOUT: specific @Associated(constants.%K.facet) {}
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: specific @AssociatedTypeImpls(constants.%W) {
  392. // CHECK:STDOUT: %W.loc11_24.2 => constants.%W
  393. // CHECK:STDOUT: %W.patt.loc11_24.2 => constants.%W
  394. // CHECK:STDOUT: }
  395. // CHECK:STDOUT:
  396. // CHECK:STDOUT: --- fail_left_of_impls_non_type.carbon
  397. // CHECK:STDOUT:
  398. // CHECK:STDOUT: constants {
  399. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic]
  400. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template]
  401. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  402. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  403. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  404. // CHECK:STDOUT: %NonTypeImpls.type: type = fn_type @NonTypeImpls [template]
  405. // CHECK:STDOUT: %NonTypeImpls: %NonTypeImpls.type = struct_value () [template]
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT:
  408. // CHECK:STDOUT: imports {
  409. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  410. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  411. // CHECK:STDOUT: import Core//prelude
  412. // CHECK:STDOUT: import Core//prelude/...
  413. // CHECK:STDOUT: }
  414. // CHECK:STDOUT: }
  415. // CHECK:STDOUT:
  416. // CHECK:STDOUT: file {
  417. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  418. // CHECK:STDOUT: .Core = imports.%Core
  419. // CHECK:STDOUT: .NonTypeImpls = %NonTypeImpls.decl
  420. // CHECK:STDOUT: }
  421. // CHECK:STDOUT: %Core.import = import Core
  422. // CHECK:STDOUT: %NonTypeImpls.decl: %NonTypeImpls.type = fn_decl @NonTypeImpls [template = constants.%NonTypeImpls] {
  423. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  424. // 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)]
  425. // CHECK:STDOUT: } {
  426. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  427. // CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [template = constants.%type_where] {
  428. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  429. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template = constants.%int_7]
  430. // CHECK:STDOUT: %.loc11_32: type = converted %int_7, <error> [template = <error>]
  431. // CHECK:STDOUT: %.loc11_26.2: type = where_expr %.Self [template = constants.%type_where] {
  432. // CHECK:STDOUT: requirement_impls <error>, type
  433. // CHECK:STDOUT: }
  434. // CHECK:STDOUT: }
  435. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  436. // CHECK:STDOUT: }
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT:
  439. // CHECK:STDOUT: generic fn @NonTypeImpls(%U.loc11_17.1: %type_where) {
  440. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  441. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  442. // CHECK:STDOUT:
  443. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  444. // CHECK:STDOUT: }
  445. // CHECK:STDOUT:
  446. // CHECK:STDOUT: specific @NonTypeImpls(constants.%U) {
  447. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  448. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  449. // CHECK:STDOUT: }
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: --- fail_right_of_impls_non_type.carbon
  452. // CHECK:STDOUT:
  453. // CHECK:STDOUT: constants {
  454. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic]
  455. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template]
  456. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  457. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  458. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  459. // CHECK:STDOUT: %ImplsNonType.type: type = fn_type @ImplsNonType [template]
  460. // CHECK:STDOUT: %ImplsNonType: %ImplsNonType.type = struct_value () [template]
  461. // CHECK:STDOUT: }
  462. // CHECK:STDOUT:
  463. // CHECK:STDOUT: imports {
  464. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  465. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  466. // CHECK:STDOUT: import Core//prelude
  467. // CHECK:STDOUT: import Core//prelude/...
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT: }
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: file {
  472. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  473. // CHECK:STDOUT: .Core = imports.%Core
  474. // CHECK:STDOUT: .ImplsNonType = %ImplsNonType.decl
  475. // CHECK:STDOUT: }
  476. // CHECK:STDOUT: %Core.import = import Core
  477. // CHECK:STDOUT: %ImplsNonType.decl: %ImplsNonType.type = fn_decl @ImplsNonType [template = constants.%ImplsNonType] {
  478. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  479. // 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)]
  480. // CHECK:STDOUT: } {
  481. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  482. // CHECK:STDOUT: %.loc11_26.1: type = splice_block %.loc11_26.2 [template = constants.%type_where] {
  483. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  484. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  485. // CHECK:STDOUT: %int_7: Core.IntLiteral = int_value 7 [template = constants.%int_7]
  486. // CHECK:STDOUT: %.loc11_44: type = converted %int_7, <error> [template = <error>]
  487. // CHECK:STDOUT: %.loc11_26.2: type = where_expr %.Self [template = constants.%type_where] {
  488. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  489. // CHECK:STDOUT: }
  490. // CHECK:STDOUT: }
  491. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  492. // CHECK:STDOUT: }
  493. // CHECK:STDOUT: }
  494. // CHECK:STDOUT:
  495. // CHECK:STDOUT: generic fn @ImplsNonType(%U.loc11_17.1: %type_where) {
  496. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  497. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  498. // CHECK:STDOUT:
  499. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: specific @ImplsNonType(constants.%U) {
  503. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  504. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT:
  507. // CHECK:STDOUT: --- fail_right_of_impls_non_facet_type.carbon
  508. // CHECK:STDOUT:
  509. // CHECK:STDOUT: constants {
  510. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic]
  511. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template]
  512. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(%int_32) [template]
  513. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  514. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  515. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  516. // CHECK:STDOUT: %ImplsOfNonFacetType.type: type = fn_type @ImplsOfNonFacetType [template]
  517. // CHECK:STDOUT: %ImplsOfNonFacetType: %ImplsOfNonFacetType.type = struct_value () [template]
  518. // CHECK:STDOUT: }
  519. // CHECK:STDOUT:
  520. // CHECK:STDOUT: imports {
  521. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  522. // CHECK:STDOUT: .Int = %Core.Int
  523. // CHECK:STDOUT: import Core//prelude
  524. // CHECK:STDOUT: import Core//prelude/...
  525. // CHECK:STDOUT: }
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT:
  528. // CHECK:STDOUT: file {
  529. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  530. // CHECK:STDOUT: .Core = imports.%Core
  531. // CHECK:STDOUT: .ImplsOfNonFacetType = %ImplsOfNonFacetType.decl
  532. // CHECK:STDOUT: }
  533. // CHECK:STDOUT: %Core.import = import Core
  534. // CHECK:STDOUT: %ImplsOfNonFacetType.decl: %ImplsOfNonFacetType.type = fn_decl @ImplsOfNonFacetType [template = constants.%ImplsOfNonFacetType] {
  535. // CHECK:STDOUT: %U.patt.loc8_24.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  536. // 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)]
  537. // CHECK:STDOUT: } {
  538. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<none>
  539. // CHECK:STDOUT: %.loc8_33.1: type = splice_block %.loc8_33.2 [template = constants.%type_where] {
  540. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  541. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  542. // CHECK:STDOUT: %int_32: Core.IntLiteral = int_value 32 [template = constants.%int_32]
  543. // CHECK:STDOUT: %i32: type = class_type @Int, @Int(constants.%int_32) [template = constants.%i32]
  544. // CHECK:STDOUT: %.loc8_33.2: type = where_expr %.Self [template = constants.%type_where] {
  545. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  546. // CHECK:STDOUT: }
  547. // CHECK:STDOUT: }
  548. // CHECK:STDOUT: %U.loc8_24.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc8_24.2 (constants.%U)]
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: generic fn @ImplsOfNonFacetType(%U.loc8_24.1: %type_where) {
  553. // CHECK:STDOUT: %U.loc8_24.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc8_24.2 (constants.%U)]
  554. // CHECK:STDOUT: %U.patt.loc8_24.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  555. // CHECK:STDOUT:
  556. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  557. // CHECK:STDOUT: }
  558. // CHECK:STDOUT:
  559. // CHECK:STDOUT: specific @ImplsOfNonFacetType(constants.%U) {
  560. // CHECK:STDOUT: %U.loc8_24.2 => constants.%U
  561. // CHECK:STDOUT: %U.patt.loc8_24.2 => constants.%U
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: --- fail_todo_enforce_constraint.carbon
  565. // CHECK:STDOUT:
  566. // CHECK:STDOUT: constants {
  567. // CHECK:STDOUT: %C: type = class_type @C [template]
  568. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [template]
  569. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template]
  570. // CHECK:STDOUT: %J.type: type = facet_type <@J> [template]
  571. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template]
  572. // CHECK:STDOUT: %DoesNotImplI.type: type = fn_type @DoesNotImplI [template]
  573. // CHECK:STDOUT: %DoesNotImplI: %DoesNotImplI.type = struct_value () [template]
  574. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [template]
  575. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  576. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where TODO> [template]
  577. // CHECK:STDOUT: %V.patt: %J_where.type = symbolic_binding_pattern V, 0 [symbolic]
  578. // CHECK:STDOUT: %V: %J_where.type = bind_symbolic_name V, 0 [symbolic]
  579. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic]
  580. // CHECK:STDOUT: %Y: %J_where.type = bind_symbolic_name Y, 0 [symbolic]
  581. // CHECK:STDOUT: %Y.patt: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic]
  582. // CHECK:STDOUT: %EmptyStruct.type: type = fn_type @EmptyStruct [template]
  583. // CHECK:STDOUT: %EmptyStruct: %EmptyStruct.type = struct_value () [template]
  584. // CHECK:STDOUT: %NotEmptyStruct.type: type = fn_type @NotEmptyStruct [template]
  585. // CHECK:STDOUT: %NotEmptyStruct: %NotEmptyStruct.type = struct_value () [template]
  586. // CHECK:STDOUT: }
  587. // CHECK:STDOUT:
  588. // CHECK:STDOUT: imports {
  589. // CHECK:STDOUT: %Main.J: type = import_ref Main//state_constraints, J, loaded [template = constants.%J.type]
  590. // CHECK:STDOUT: %Main.I = import_ref Main//state_constraints, I, unloaded
  591. // CHECK:STDOUT: %Main.EqualEqual = import_ref Main//state_constraints, EqualEqual, unloaded
  592. // CHECK:STDOUT: %Main.Impls: %Impls.type = import_ref Main//state_constraints, Impls, loaded [template = constants.%Impls]
  593. // CHECK:STDOUT: %Main.And = import_ref Main//state_constraints, And, unloaded
  594. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  595. // CHECK:STDOUT: .ImplicitAs = %Core.ImplicitAs
  596. // CHECK:STDOUT: import Core//prelude
  597. // CHECK:STDOUT: import Core//prelude/...
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT: %Main.import_ref.8fd = import_ref Main//state_constraints, inst17 [no loc], unloaded
  600. // CHECK:STDOUT: %Main.import_ref.81e: %J_where.type = import_ref Main//state_constraints, loc13_10, loaded [symbolic = @Impls.%V (constants.%V)]
  601. // CHECK:STDOUT: }
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: file {
  604. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  605. // CHECK:STDOUT: .J = imports.%Main.J
  606. // CHECK:STDOUT: .I = imports.%Main.I
  607. // CHECK:STDOUT: .EqualEqual = imports.%Main.EqualEqual
  608. // CHECK:STDOUT: .Impls = imports.%Main.Impls
  609. // CHECK:STDOUT: .And = imports.%Main.And
  610. // CHECK:STDOUT: .Core = imports.%Core
  611. // CHECK:STDOUT: .C = %C.decl
  612. // CHECK:STDOUT: .DoesNotImplI = %DoesNotImplI.decl
  613. // CHECK:STDOUT: .EmptyStruct = %EmptyStruct.decl
  614. // CHECK:STDOUT: .NotEmptyStruct = %NotEmptyStruct.decl
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT: %Core.import = import Core
  617. // CHECK:STDOUT: %default.import = import <none>
  618. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  619. // CHECK:STDOUT: impl_decl @impl [template] {} {
  620. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  621. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%Main.J [template = constants.%J.type]
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: %impl_witness: <witness> = impl_witness () [template = constants.%impl_witness]
  624. // CHECK:STDOUT: %DoesNotImplI.decl: %DoesNotImplI.type = fn_decl @DoesNotImplI [template = constants.%DoesNotImplI] {} {}
  625. // CHECK:STDOUT: %EmptyStruct.decl: %EmptyStruct.type = fn_decl @EmptyStruct [template = constants.%EmptyStruct] {
  626. // CHECK:STDOUT: %Y.patt.loc26_16.1: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  627. // 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)]
  628. // CHECK:STDOUT: } {
  629. // CHECK:STDOUT: %Y.param: %J_where.type = value_param runtime_param<none>
  630. // CHECK:STDOUT: %.loc26_22.1: type = splice_block %.loc26_22.2 [template = constants.%J_where.type] {
  631. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%Main.J [template = constants.%J.type]
  632. // CHECK:STDOUT: %.Self: %J.type = bind_symbolic_name .Self [symbolic = constants.%.Self]
  633. // CHECK:STDOUT: %.Self.ref: %J.type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  634. // CHECK:STDOUT: %.loc26_38: %empty_struct_type = struct_literal ()
  635. // CHECK:STDOUT: %.loc26_22.2: type = where_expr %.Self [template = constants.%J_where.type] {
  636. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc26_38
  637. // CHECK:STDOUT: }
  638. // CHECK:STDOUT: }
  639. // CHECK:STDOUT: %Y.loc26_16.1: %J_where.type = bind_symbolic_name Y, 0, %Y.param [symbolic = %Y.loc26_16.2 (constants.%Y)]
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: %NotEmptyStruct.decl: %NotEmptyStruct.type = fn_decl @NotEmptyStruct [template = constants.%NotEmptyStruct] {} {}
  642. // CHECK:STDOUT: }
  643. // CHECK:STDOUT:
  644. // CHECK:STDOUT: interface @J [from "state_constraints.carbon"] {
  645. // CHECK:STDOUT: !members:
  646. // CHECK:STDOUT: .Self = imports.%Main.import_ref.8fd
  647. // CHECK:STDOUT: witness = ()
  648. // CHECK:STDOUT: }
  649. // CHECK:STDOUT:
  650. // CHECK:STDOUT: impl @impl: %C.ref as %J.ref {
  651. // CHECK:STDOUT: !members:
  652. // CHECK:STDOUT: witness = file.%impl_witness
  653. // CHECK:STDOUT: }
  654. // CHECK:STDOUT:
  655. // CHECK:STDOUT: class @C {
  656. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [template = constants.%complete_type]
  657. // CHECK:STDOUT: complete_type_witness = %complete_type
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: !members:
  660. // CHECK:STDOUT: .Self = constants.%C
  661. // CHECK:STDOUT: }
  662. // CHECK:STDOUT:
  663. // CHECK:STDOUT: fn @DoesNotImplI() {
  664. // CHECK:STDOUT: !entry:
  665. // CHECK:STDOUT: %Impls.ref: %Impls.type = name_ref Impls, imports.%Main.Impls [template = constants.%Impls]
  666. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  667. // CHECK:STDOUT: %.loc23: %J_where.type = converted %C.ref, <error> [template = <error>]
  668. // CHECK:STDOUT: return
  669. // CHECK:STDOUT: }
  670. // CHECK:STDOUT:
  671. // CHECK:STDOUT: generic fn @Impls(imports.%Main.import_ref.81e: %J_where.type) [from "state_constraints.carbon"] {
  672. // CHECK:STDOUT: %V: %J_where.type = bind_symbolic_name V, 0 [symbolic = %V (constants.%V)]
  673. // CHECK:STDOUT: %V.patt: %J_where.type = symbolic_binding_pattern V, 0 [symbolic = %V.patt (constants.%V.patt)]
  674. // CHECK:STDOUT:
  675. // CHECK:STDOUT: fn(%V.param_patt: %J_where.type);
  676. // CHECK:STDOUT: }
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: generic fn @EmptyStruct(%Y.loc26_16.1: %J_where.type) {
  679. // CHECK:STDOUT: %Y.loc26_16.2: %J_where.type = bind_symbolic_name Y, 0 [symbolic = %Y.loc26_16.2 (constants.%Y)]
  680. // CHECK:STDOUT: %Y.patt.loc26_16.2: %J_where.type = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: fn(%Y.param_patt: %J_where.type);
  683. // CHECK:STDOUT: }
  684. // CHECK:STDOUT:
  685. // CHECK:STDOUT: fn @NotEmptyStruct() {
  686. // CHECK:STDOUT: !entry:
  687. // CHECK:STDOUT: %EmptyStruct.ref: %EmptyStruct.type = name_ref EmptyStruct, file.%EmptyStruct.decl [template = constants.%EmptyStruct]
  688. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  689. // CHECK:STDOUT: %.loc40: %J_where.type = converted %C.ref, <error> [template = <error>]
  690. // CHECK:STDOUT: return
  691. // CHECK:STDOUT: }
  692. // CHECK:STDOUT:
  693. // CHECK:STDOUT: specific @Impls(constants.%V) {
  694. // CHECK:STDOUT: %V => constants.%V
  695. // CHECK:STDOUT: %V.patt => constants.%V
  696. // CHECK:STDOUT: }
  697. // CHECK:STDOUT:
  698. // CHECK:STDOUT: specific @EmptyStruct(constants.%Y) {
  699. // CHECK:STDOUT: %Y.loc26_16.2 => constants.%Y
  700. // CHECK:STDOUT: %Y.patt.loc26_16.2 => constants.%Y
  701. // CHECK:STDOUT: }
  702. // CHECK:STDOUT: