constraints.carbon 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966
  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. // --- fail_todo_equal_constraint.carbon
  21. library "[[@TEST_NAME]]";
  22. interface N {
  23. let P:! type;
  24. }
  25. // CHECK:STDERR: fail_todo_equal_constraint.carbon:[[@LINE+7]]:27: error: cannot implicitly convert from `{}` to `<associated type in N>` [ImplicitAsConversionFailure]
  26. // CHECK:STDERR: fn Equal(T:! N where .P = {});
  27. // CHECK:STDERR: ^~
  28. // CHECK:STDERR: fail_todo_equal_constraint.carbon:[[@LINE+4]]:27: note: type `{}` does not implement interface `ImplicitAs(<associated type in N>)` [MissingImplInMemberAccessNote]
  29. // CHECK:STDERR: fn Equal(T:! N where .P = {});
  30. // CHECK:STDERR: ^~
  31. // CHECK:STDERR:
  32. fn Equal(T:! N where .P = {});
  33. // --- fail_todo_associated_type_impls.carbon
  34. library "[[@TEST_NAME]]";
  35. interface L {}
  36. interface M {}
  37. interface K {
  38. let Associated:! L;
  39. }
  40. // CHECK:STDERR: fail_todo_associated_type_impls.carbon:[[@LINE+7]]:36: error: cannot implicitly convert from `<associated L in K>` to `type` [ImplicitAsConversionFailure]
  41. // CHECK:STDERR: fn AssociatedTypeImpls(W:! K where .Associated impls M);
  42. // CHECK:STDERR: ^~~~~~~~~~~
  43. // CHECK:STDERR: fail_todo_associated_type_impls.carbon:[[@LINE+4]]:36: note: type `<associated L in K>` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote]
  44. // CHECK:STDERR: fn AssociatedTypeImpls(W:! K where .Associated impls M);
  45. // CHECK:STDERR: ^~~~~~~~~~~
  46. // CHECK:STDERR:
  47. fn AssociatedTypeImpls(W:! K where .Associated impls M);
  48. // --- fail_check_rewrite_constraints.carbon
  49. library "[[@TEST_NAME]]";
  50. import library "state_constraints";
  51. // `2` can't be converted to the type of `I.Member`
  52. // TODO: The diagnostics are wrong since member access into facets isn't
  53. // working properly yet.
  54. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+7]]:46: error: cannot implicitly convert from `Core.IntLiteral` to `<associated type in I>` [ImplicitAsConversionFailure]
  55. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  56. // CHECK:STDERR: ^
  57. // CHECK:STDERR: fail_check_rewrite_constraints.carbon:[[@LINE+4]]:46: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(<associated type in I>)` [MissingImplInMemberAccessNote]
  58. // CHECK:STDERR: fn RewriteTypeMismatch(X:! I where .Member = 2);
  59. // CHECK:STDERR: ^
  60. // CHECK:STDERR:
  61. fn RewriteTypeMismatch(X:! I where .Member = 2);
  62. // --- fail_left_of_impls_non_type.carbon
  63. library "[[@TEST_NAME]]";
  64. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+7]]:32: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  65. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  66. // CHECK:STDERR: ^
  67. // CHECK:STDERR: fail_left_of_impls_non_type.carbon:[[@LINE+4]]:32: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote]
  68. // CHECK:STDERR: fn NonTypeImpls(U:! type where 7 impls type);
  69. // CHECK:STDERR: ^
  70. // CHECK:STDERR:
  71. fn NonTypeImpls(U:! type where 7 impls type);
  72. // --- fail_right_of_impls_non_type.carbon
  73. library "[[@TEST_NAME]]";
  74. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+7]]:44: error: cannot implicitly convert from `Core.IntLiteral` to `type` [ImplicitAsConversionFailure]
  75. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  76. // CHECK:STDERR: ^
  77. // CHECK:STDERR: fail_right_of_impls_non_type.carbon:[[@LINE+4]]:44: note: type `Core.IntLiteral` does not implement interface `ImplicitAs(type)` [MissingImplInMemberAccessNote]
  78. // CHECK:STDERR: fn ImplsNonType(U:! type where .Self impls 7);
  79. // CHECK:STDERR: ^
  80. // CHECK:STDERR:
  81. fn ImplsNonType(U:! type where .Self impls 7);
  82. // --- fail_right_of_impls_non_facet_type.carbon
  83. library "[[@TEST_NAME]]";
  84. // 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]
  85. // CHECK:STDERR: fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  86. // CHECK:STDERR: ^~~
  87. // CHECK:STDERR:
  88. fn ImplsOfNonFacetType(U:! type where .Self impls i32);
  89. // --- fail_todo_enforce_constraint.carbon
  90. library "[[@TEST_NAME]]";
  91. import library "state_constraints";
  92. // C implements J but not I.
  93. class C {}
  94. impl C as J {}
  95. // TODO: Should report that `C` does not meet the constraint.
  96. fn DoesNotImplI() {
  97. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+11]]:3: error: cannot implicitly convert from `type` to `J` [ImplicitAsConversionFailure]
  98. // CHECK:STDERR: Impls(C);
  99. // CHECK:STDERR: ^~~~~~
  100. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+8]]:3: note: type `type` does not implement interface `ImplicitAs(J)` [MissingImplInMemberAccessNote]
  101. // CHECK:STDERR: Impls(C);
  102. // CHECK:STDERR: ^~~~~~
  103. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE-14]]:1: in import [InImport]
  104. // CHECK:STDERR: state_constraints.carbon:13:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  105. // CHECK:STDERR: fn Impls(V:! J where .Self impls I);
  106. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. // CHECK:STDERR:
  108. Impls(C);
  109. }
  110. fn EmptyStruct(Y:! J where .Self == {});
  111. // TODO: Should report that `C` does not meeet the constraint.
  112. fn NotEmptyStruct() {
  113. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+10]]:3: error: cannot implicitly convert from `type` to `J where...` [ImplicitAsConversionFailure]
  114. // CHECK:STDERR: EmptyStruct(C);
  115. // CHECK:STDERR: ^~~~~~~~~~~~
  116. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE+7]]:3: note: type `type` does not implement interface `ImplicitAs(J where...)` [MissingImplInMemberAccessNote]
  117. // CHECK:STDERR: EmptyStruct(C);
  118. // CHECK:STDERR: ^~~~~~~~~~~~
  119. // CHECK:STDERR: fail_todo_enforce_constraint.carbon:[[@LINE-10]]:1: note: while deducing parameters of generic declared here [DeductionGenericHere]
  120. // CHECK:STDERR: fn EmptyStruct(Y:! J where .Self == {});
  121. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122. // CHECK:STDERR:
  123. EmptyStruct(C);
  124. }
  125. // --- fail_todo_let.carbon
  126. library "[[@TEST_NAME]]";
  127. interface A {}
  128. class D {}
  129. impl D as A {}
  130. // TODO: This should be a compile-time binding, once that is supported.
  131. // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+6]]:1: error: cannot implicitly convert from `type` to `type where...` [ImplicitAsConversionFailure]
  132. // CHECK:STDERR: let B: type where .Self impls A = D;
  133. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134. // CHECK:STDERR: fail_todo_let.carbon:[[@LINE+3]]:1: note: type `type` does not implement interface `ImplicitAs(type where...)` [MissingImplInMemberAccessNote]
  135. // CHECK:STDERR: let B: type where .Self impls A = D;
  136. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137. let B: type where .Self impls A = D;
  138. // CHECK:STDOUT: --- state_constraints.carbon
  139. // CHECK:STDOUT:
  140. // CHECK:STDOUT: constants {
  141. // CHECK:STDOUT: %J.type.1: type = facet_type <@J> [template]
  142. // CHECK:STDOUT: %Self.1: %J.type.1 = bind_symbolic_name Self, 0 [symbolic]
  143. // CHECK:STDOUT: %I.type.1: type = facet_type <@I> [template]
  144. // CHECK:STDOUT: %Self.2: %I.type.1 = bind_symbolic_name Self, 0 [symbolic]
  145. // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type.1, type [template]
  146. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @I.%Member [template]
  147. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [template]
  148. // CHECK:STDOUT: %.3: type = assoc_entity_type %I.type.1, %J.type.1 [template]
  149. // CHECK:STDOUT: %.4: %.3 = assoc_entity element1, @I.%Second [template]
  150. // CHECK:STDOUT: %.Self.1: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  151. // CHECK:STDOUT: %I.type.2: type = facet_type <@I where TODO> [template]
  152. // CHECK:STDOUT: %U: %I.type.2 = bind_symbolic_name U, 0 [symbolic]
  153. // CHECK:STDOUT: %U.patt: %I.type.2 = symbolic_binding_pattern U, 0 [symbolic]
  154. // CHECK:STDOUT: %EqualEqual.type: type = fn_type @EqualEqual [template]
  155. // CHECK:STDOUT: %EqualEqual: %EqualEqual.type = struct_value () [template]
  156. // CHECK:STDOUT: %.Self.2: %J.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  157. // CHECK:STDOUT: %J.type.2: type = facet_type <@J where TODO> [template]
  158. // CHECK:STDOUT: %V: %J.type.2 = bind_symbolic_name V, 0 [symbolic]
  159. // CHECK:STDOUT: %V.patt: %J.type.2 = symbolic_binding_pattern V, 0 [symbolic]
  160. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [template]
  161. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  162. // CHECK:STDOUT: %I.type.3: type = facet_type <@I where TODO> [template]
  163. // CHECK:STDOUT: %W: %I.type.3 = bind_symbolic_name W, 0 [symbolic]
  164. // CHECK:STDOUT: %W.patt: %I.type.3 = symbolic_binding_pattern W, 0 [symbolic]
  165. // CHECK:STDOUT: %And.type: type = fn_type @And [template]
  166. // CHECK:STDOUT: %And: %And.type = struct_value () [template]
  167. // CHECK:STDOUT: }
  168. // CHECK:STDOUT:
  169. // CHECK:STDOUT: imports {
  170. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  171. // CHECK:STDOUT: import Core//prelude
  172. // CHECK:STDOUT: import Core//prelude/...
  173. // CHECK:STDOUT: }
  174. // CHECK:STDOUT: }
  175. // CHECK:STDOUT:
  176. // CHECK:STDOUT: file {
  177. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  178. // CHECK:STDOUT: .Core = imports.%Core
  179. // CHECK:STDOUT: .J = %J.decl
  180. // CHECK:STDOUT: .I = %I.decl
  181. // CHECK:STDOUT: .EqualEqual = %EqualEqual.decl
  182. // CHECK:STDOUT: .Impls = %Impls.decl
  183. // CHECK:STDOUT: .And = %And.decl
  184. // CHECK:STDOUT: }
  185. // CHECK:STDOUT: %Core.import = import Core
  186. // CHECK:STDOUT: %J.decl: type = interface_decl @J [template = constants.%J.type.1] {} {}
  187. // CHECK:STDOUT: %I.decl: type = interface_decl @I [template = constants.%I.type.1] {} {}
  188. // CHECK:STDOUT: %EqualEqual.decl: %EqualEqual.type = fn_decl @EqualEqual [template = constants.%EqualEqual] {
  189. // CHECK:STDOUT: %U.patt.loc11_15.1: %I.type.2 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  190. // CHECK:STDOUT: %U.param_patt: %I.type.2 = value_param_pattern %U.patt.loc11_15.1, runtime_param<invalid> [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  191. // CHECK:STDOUT: } {
  192. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type.1]
  193. // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.1]
  194. // CHECK:STDOUT: %.Self.ref: %I.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  195. // CHECK:STDOUT: %.loc11_37: %empty_tuple.type = tuple_literal ()
  196. // CHECK:STDOUT: %.loc11_21: type = where_expr %.Self [template = constants.%I.type.2] {
  197. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc11_37
  198. // CHECK:STDOUT: }
  199. // CHECK:STDOUT: %U.param: %I.type.2 = value_param runtime_param<invalid>
  200. // CHECK:STDOUT: %U.loc11_15.1: %I.type.2 = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_15.2 (constants.%U)]
  201. // CHECK:STDOUT: }
  202. // CHECK:STDOUT: %Impls.decl: %Impls.type = fn_decl @Impls [template = constants.%Impls] {
  203. // CHECK:STDOUT: %V.patt.loc13_10.1: %J.type.2 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  204. // CHECK:STDOUT: %V.param_patt: %J.type.2 = value_param_pattern %V.patt.loc13_10.1, runtime_param<invalid> [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  205. // CHECK:STDOUT: } {
  206. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type.1]
  207. // CHECK:STDOUT: %.Self: %J.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.2]
  208. // CHECK:STDOUT: %.Self.ref: %J.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.2]
  209. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type.1]
  210. // CHECK:STDOUT: %.loc13_22.1: type = facet_type_access %.Self.ref [symbolic = constants.%.Self.2]
  211. // CHECK:STDOUT: %.loc13_22.2: type = converted %.Self.ref, %.loc13_22.1 [symbolic = constants.%.Self.2]
  212. // CHECK:STDOUT: %.loc13_16: type = where_expr %.Self [template = constants.%J.type.2] {
  213. // CHECK:STDOUT: requirement_impls %.loc13_22.2, %I.ref
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT: %V.param: %J.type.2 = value_param runtime_param<invalid>
  216. // CHECK:STDOUT: %V.loc13_10.1: %J.type.2 = bind_symbolic_name V, 0, %V.param [symbolic = %V.loc13_10.2 (constants.%V)]
  217. // CHECK:STDOUT: }
  218. // CHECK:STDOUT: %And.decl: %And.type = fn_decl @And [template = constants.%And] {
  219. // CHECK:STDOUT: %W.patt.loc15_8.1: %I.type.3 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  220. // CHECK:STDOUT: %W.param_patt: %I.type.3 = value_param_pattern %W.patt.loc15_8.1, runtime_param<invalid> [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  221. // CHECK:STDOUT: } {
  222. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [template = constants.%I.type.1]
  223. // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self.1]
  224. // CHECK:STDOUT: %.Self.ref.loc15_20: %I.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  225. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type.1]
  226. // CHECK:STDOUT: %.loc15_20.1: type = facet_type_access %.Self.ref.loc15_20 [symbolic = constants.%.Self.1]
  227. // CHECK:STDOUT: %.loc15_20.2: type = converted %.Self.ref.loc15_20, %.loc15_20.1 [symbolic = constants.%.Self.1]
  228. // CHECK:STDOUT: %.Self.ref.loc15_38: %I.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self.1]
  229. // CHECK:STDOUT: %Member.ref: %.1 = name_ref Member, @I.%.loc7 [template = constants.%.2]
  230. // CHECK:STDOUT: %.loc15_50: %empty_tuple.type = tuple_literal ()
  231. // CHECK:STDOUT: %.loc15_14: type = where_expr %.Self [template = constants.%I.type.3] {
  232. // CHECK:STDOUT: requirement_impls %.loc15_20.2, %J.ref
  233. // CHECK:STDOUT: requirement_equivalent %Member.ref, %.loc15_50
  234. // CHECK:STDOUT: }
  235. // CHECK:STDOUT: %W.param: %I.type.3 = value_param runtime_param<invalid>
  236. // CHECK:STDOUT: %W.loc15_8.1: %I.type.3 = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc15_8.2 (constants.%W)]
  237. // CHECK:STDOUT: }
  238. // CHECK:STDOUT: }
  239. // CHECK:STDOUT:
  240. // CHECK:STDOUT: interface @J {
  241. // CHECK:STDOUT: %Self: %J.type.1 = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  242. // CHECK:STDOUT:
  243. // CHECK:STDOUT: !members:
  244. // CHECK:STDOUT: .Self = %Self
  245. // CHECK:STDOUT: witness = ()
  246. // CHECK:STDOUT: }
  247. // CHECK:STDOUT:
  248. // CHECK:STDOUT: interface @I {
  249. // CHECK:STDOUT: %Self: %I.type.1 = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  250. // CHECK:STDOUT: %Member: type = assoc_const_decl Member [template]
  251. // CHECK:STDOUT: %.loc7: %.1 = assoc_entity element0, %Member [template = constants.%.2]
  252. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [template = constants.%J.type.1]
  253. // CHECK:STDOUT: %Second: %J.type.1 = assoc_const_decl Second [template]
  254. // CHECK:STDOUT: %.loc8: %.3 = assoc_entity element1, %Second [template = constants.%.4]
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: !members:
  257. // CHECK:STDOUT: .Self = %Self
  258. // CHECK:STDOUT: .Member = %.loc7
  259. // CHECK:STDOUT: .Second = %.loc8
  260. // CHECK:STDOUT: witness = (%Member, %Second)
  261. // CHECK:STDOUT: }
  262. // CHECK:STDOUT:
  263. // CHECK:STDOUT: generic fn @EqualEqual(%U.loc11_15.1: %I.type.2) {
  264. // CHECK:STDOUT: %U.loc11_15.2: %I.type.2 = bind_symbolic_name U, 0 [symbolic = %U.loc11_15.2 (constants.%U)]
  265. // CHECK:STDOUT: %U.patt.loc11_15.2: %I.type.2 = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_15.2 (constants.%U.patt)]
  266. // CHECK:STDOUT:
  267. // CHECK:STDOUT: fn(%U.param_patt: %I.type.2);
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT:
  270. // CHECK:STDOUT: generic fn @Impls(%V.loc13_10.1: %J.type.2) {
  271. // CHECK:STDOUT: %V.loc13_10.2: %J.type.2 = bind_symbolic_name V, 0 [symbolic = %V.loc13_10.2 (constants.%V)]
  272. // CHECK:STDOUT: %V.patt.loc13_10.2: %J.type.2 = symbolic_binding_pattern V, 0 [symbolic = %V.patt.loc13_10.2 (constants.%V.patt)]
  273. // CHECK:STDOUT:
  274. // CHECK:STDOUT: fn(%V.param_patt: %J.type.2);
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: generic fn @And(%W.loc15_8.1: %I.type.3) {
  278. // CHECK:STDOUT: %W.loc15_8.2: %I.type.3 = bind_symbolic_name W, 0 [symbolic = %W.loc15_8.2 (constants.%W)]
  279. // CHECK:STDOUT: %W.patt.loc15_8.2: %I.type.3 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc15_8.2 (constants.%W.patt)]
  280. // CHECK:STDOUT:
  281. // CHECK:STDOUT: fn(%W.param_patt: %I.type.3);
  282. // CHECK:STDOUT: }
  283. // CHECK:STDOUT:
  284. // CHECK:STDOUT: specific @EqualEqual(constants.%U) {
  285. // CHECK:STDOUT: %U.loc11_15.2 => constants.%U
  286. // CHECK:STDOUT: %U.patt.loc11_15.2 => constants.%U
  287. // CHECK:STDOUT: }
  288. // CHECK:STDOUT:
  289. // CHECK:STDOUT: specific @Impls(constants.%V) {
  290. // CHECK:STDOUT: %V.loc13_10.2 => constants.%V
  291. // CHECK:STDOUT: %V.patt.loc13_10.2 => constants.%V
  292. // CHECK:STDOUT: }
  293. // CHECK:STDOUT:
  294. // CHECK:STDOUT: specific @And(constants.%W) {
  295. // CHECK:STDOUT: %W.loc15_8.2 => constants.%W
  296. // CHECK:STDOUT: %W.patt.loc15_8.2 => constants.%W
  297. // CHECK:STDOUT: }
  298. // CHECK:STDOUT:
  299. // CHECK:STDOUT: --- fail_todo_equal_constraint.carbon
  300. // CHECK:STDOUT:
  301. // CHECK:STDOUT: constants {
  302. // CHECK:STDOUT: %N.type.1: type = facet_type <@N> [template]
  303. // CHECK:STDOUT: %Self.1: %N.type.1 = bind_symbolic_name Self, 0 [symbolic]
  304. // CHECK:STDOUT: %.1: type = assoc_entity_type %N.type.1, type [template]
  305. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @N.%P [template]
  306. // CHECK:STDOUT: %.Self: %N.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  307. // CHECK:STDOUT: %.3: type = struct_type {} [template]
  308. // CHECK:STDOUT: %N.type.2: type = facet_type <@N where TODO> [template]
  309. // CHECK:STDOUT: %T: %N.type.2 = bind_symbolic_name T, 0 [symbolic]
  310. // CHECK:STDOUT: %T.patt: %N.type.2 = symbolic_binding_pattern T, 0 [symbolic]
  311. // CHECK:STDOUT: %Equal.type: type = fn_type @Equal [template]
  312. // CHECK:STDOUT: %Equal: %Equal.type = struct_value () [template]
  313. // CHECK:STDOUT: }
  314. // CHECK:STDOUT:
  315. // CHECK:STDOUT: imports {
  316. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  317. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  318. // CHECK:STDOUT: import Core//prelude
  319. // CHECK:STDOUT: import Core//prelude/...
  320. // CHECK:STDOUT: }
  321. // CHECK:STDOUT: }
  322. // CHECK:STDOUT:
  323. // CHECK:STDOUT: file {
  324. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  325. // CHECK:STDOUT: .Core = imports.%Core
  326. // CHECK:STDOUT: .N = %N.decl
  327. // CHECK:STDOUT: .Equal = %Equal.decl
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT: %Core.import = import Core
  330. // CHECK:STDOUT: %N.decl: type = interface_decl @N [template = constants.%N.type.1] {} {}
  331. // CHECK:STDOUT: %Equal.decl: %Equal.type = fn_decl @Equal [template = constants.%Equal] {
  332. // CHECK:STDOUT: %T.patt.loc15_10.1: %N.type.2 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  333. // CHECK:STDOUT: %T.param_patt: %N.type.2 = value_param_pattern %T.patt.loc15_10.1, runtime_param<invalid> [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  334. // CHECK:STDOUT: } {
  335. // CHECK:STDOUT: %N.ref: type = name_ref N, file.%N.decl [template = constants.%N.type.1]
  336. // CHECK:STDOUT: %.Self: %N.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  337. // CHECK:STDOUT: %.Self.ref: %N.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self]
  338. // CHECK:STDOUT: %P.ref: %.1 = name_ref P, @N.%.loc5 [template = constants.%.2]
  339. // CHECK:STDOUT: %.loc15_28.1: %.3 = struct_literal ()
  340. // CHECK:STDOUT: %.loc15_28.2: %.1 = converted %.loc15_28.1, <error> [template = <error>]
  341. // CHECK:STDOUT: %.loc15_16: type = where_expr %.Self [template = constants.%N.type.2] {
  342. // CHECK:STDOUT: requirement_rewrite %P.ref, <error>
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT: %T.param: %N.type.2 = value_param runtime_param<invalid>
  345. // CHECK:STDOUT: %T.loc15_10.1: %N.type.2 = bind_symbolic_name T, 0, %T.param [symbolic = %T.loc15_10.2 (constants.%T)]
  346. // CHECK:STDOUT: }
  347. // CHECK:STDOUT: }
  348. // CHECK:STDOUT:
  349. // CHECK:STDOUT: interface @N {
  350. // CHECK:STDOUT: %Self: %N.type.1 = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  351. // CHECK:STDOUT: %P: type = assoc_const_decl P [template]
  352. // CHECK:STDOUT: %.loc5: %.1 = assoc_entity element0, %P [template = constants.%.2]
  353. // CHECK:STDOUT:
  354. // CHECK:STDOUT: !members:
  355. // CHECK:STDOUT: .Self = %Self
  356. // CHECK:STDOUT: .P = %.loc5
  357. // CHECK:STDOUT: witness = (%P)
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: generic fn @Equal(%T.loc15_10.1: %N.type.2) {
  361. // CHECK:STDOUT: %T.loc15_10.2: %N.type.2 = bind_symbolic_name T, 0 [symbolic = %T.loc15_10.2 (constants.%T)]
  362. // CHECK:STDOUT: %T.patt.loc15_10.2: %N.type.2 = symbolic_binding_pattern T, 0 [symbolic = %T.patt.loc15_10.2 (constants.%T.patt)]
  363. // CHECK:STDOUT:
  364. // CHECK:STDOUT: fn(%T.param_patt: %N.type.2);
  365. // CHECK:STDOUT: }
  366. // CHECK:STDOUT:
  367. // CHECK:STDOUT: specific @Equal(constants.%T) {
  368. // CHECK:STDOUT: %T.loc15_10.2 => constants.%T
  369. // CHECK:STDOUT: %T.patt.loc15_10.2 => constants.%T
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: --- fail_todo_associated_type_impls.carbon
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: constants {
  375. // CHECK:STDOUT: %L.type: type = facet_type <@L> [template]
  376. // CHECK:STDOUT: %Self.1: %L.type = bind_symbolic_name Self, 0 [symbolic]
  377. // CHECK:STDOUT: %M.type: type = facet_type <@M> [template]
  378. // CHECK:STDOUT: %Self.2: %M.type = bind_symbolic_name Self, 0 [symbolic]
  379. // CHECK:STDOUT: %K.type.1: type = facet_type <@K> [template]
  380. // CHECK:STDOUT: %Self.3: %K.type.1 = bind_symbolic_name Self, 0 [symbolic]
  381. // CHECK:STDOUT: %.1: type = assoc_entity_type %K.type.1, %L.type [template]
  382. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, @K.%Associated [template]
  383. // CHECK:STDOUT: %.Self: %K.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  384. // CHECK:STDOUT: %K.type.2: type = facet_type <@K where TODO> [template]
  385. // CHECK:STDOUT: %W: %K.type.2 = bind_symbolic_name W, 0 [symbolic]
  386. // CHECK:STDOUT: %W.patt: %K.type.2 = symbolic_binding_pattern W, 0 [symbolic]
  387. // CHECK:STDOUT: %AssociatedTypeImpls.type: type = fn_type @AssociatedTypeImpls [template]
  388. // CHECK:STDOUT: %AssociatedTypeImpls: %AssociatedTypeImpls.type = struct_value () [template]
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: imports {
  392. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  393. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  394. // CHECK:STDOUT: import Core//prelude
  395. // CHECK:STDOUT: import Core//prelude/...
  396. // CHECK:STDOUT: }
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: file {
  400. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  401. // CHECK:STDOUT: .Core = imports.%Core
  402. // CHECK:STDOUT: .L = %L.decl
  403. // CHECK:STDOUT: .M = %M.decl
  404. // CHECK:STDOUT: .K = %K.decl
  405. // CHECK:STDOUT: .AssociatedTypeImpls = %AssociatedTypeImpls.decl
  406. // CHECK:STDOUT: }
  407. // CHECK:STDOUT: %Core.import = import Core
  408. // CHECK:STDOUT: %L.decl: type = interface_decl @L [template = constants.%L.type] {} {}
  409. // CHECK:STDOUT: %M.decl: type = interface_decl @M [template = constants.%M.type] {} {}
  410. // CHECK:STDOUT: %K.decl: type = interface_decl @K [template = constants.%K.type.1] {} {}
  411. // CHECK:STDOUT: %AssociatedTypeImpls.decl: %AssociatedTypeImpls.type = fn_decl @AssociatedTypeImpls [template = constants.%AssociatedTypeImpls] {
  412. // CHECK:STDOUT: %W.patt.loc18_24.1: %K.type.2 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  413. // CHECK:STDOUT: %W.param_patt: %K.type.2 = value_param_pattern %W.patt.loc18_24.1, runtime_param<invalid> [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  414. // CHECK:STDOUT: } {
  415. // CHECK:STDOUT: %K.ref: type = name_ref K, file.%K.decl [template = constants.%K.type.1]
  416. // CHECK:STDOUT: %.Self: %K.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  417. // CHECK:STDOUT: %.Self.ref: %K.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self]
  418. // CHECK:STDOUT: %Associated.ref: %.1 = name_ref Associated, @K.%.loc8 [template = constants.%.2]
  419. // CHECK:STDOUT: %M.ref: type = name_ref M, file.%M.decl [template = constants.%M.type]
  420. // CHECK:STDOUT: %.loc18_36: type = converted %Associated.ref, <error> [template = <error>]
  421. // CHECK:STDOUT: %.loc18_30: type = where_expr %.Self [template = constants.%K.type.2] {
  422. // CHECK:STDOUT: requirement_impls <error>, %M.ref
  423. // CHECK:STDOUT: }
  424. // CHECK:STDOUT: %W.param: %K.type.2 = value_param runtime_param<invalid>
  425. // CHECK:STDOUT: %W.loc18_24.1: %K.type.2 = bind_symbolic_name W, 0, %W.param [symbolic = %W.loc18_24.2 (constants.%W)]
  426. // CHECK:STDOUT: }
  427. // CHECK:STDOUT: }
  428. // CHECK:STDOUT:
  429. // CHECK:STDOUT: interface @L {
  430. // CHECK:STDOUT: %Self: %L.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  431. // CHECK:STDOUT:
  432. // CHECK:STDOUT: !members:
  433. // CHECK:STDOUT: .Self = %Self
  434. // CHECK:STDOUT: witness = ()
  435. // CHECK:STDOUT: }
  436. // CHECK:STDOUT:
  437. // CHECK:STDOUT: interface @M {
  438. // CHECK:STDOUT: %Self: %M.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.2]
  439. // CHECK:STDOUT:
  440. // CHECK:STDOUT: !members:
  441. // CHECK:STDOUT: .Self = %Self
  442. // CHECK:STDOUT: witness = ()
  443. // CHECK:STDOUT: }
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: interface @K {
  446. // CHECK:STDOUT: %Self: %K.type.1 = bind_symbolic_name Self, 0 [symbolic = constants.%Self.3]
  447. // CHECK:STDOUT: %L.ref: type = name_ref L, file.%L.decl [template = constants.%L.type]
  448. // CHECK:STDOUT: %Associated: %L.type = assoc_const_decl Associated [template]
  449. // CHECK:STDOUT: %.loc8: %.1 = assoc_entity element0, %Associated [template = constants.%.2]
  450. // CHECK:STDOUT:
  451. // CHECK:STDOUT: !members:
  452. // CHECK:STDOUT: .Self = %Self
  453. // CHECK:STDOUT: .Associated = %.loc8
  454. // CHECK:STDOUT: witness = (%Associated)
  455. // CHECK:STDOUT: }
  456. // CHECK:STDOUT:
  457. // CHECK:STDOUT: generic fn @AssociatedTypeImpls(%W.loc18_24.1: %K.type.2) {
  458. // CHECK:STDOUT: %W.loc18_24.2: %K.type.2 = bind_symbolic_name W, 0 [symbolic = %W.loc18_24.2 (constants.%W)]
  459. // CHECK:STDOUT: %W.patt.loc18_24.2: %K.type.2 = symbolic_binding_pattern W, 0 [symbolic = %W.patt.loc18_24.2 (constants.%W.patt)]
  460. // CHECK:STDOUT:
  461. // CHECK:STDOUT: fn(%W.param_patt: %K.type.2);
  462. // CHECK:STDOUT: }
  463. // CHECK:STDOUT:
  464. // CHECK:STDOUT: specific @AssociatedTypeImpls(constants.%W) {
  465. // CHECK:STDOUT: %W.loc18_24.2 => constants.%W
  466. // CHECK:STDOUT: %W.patt.loc18_24.2 => constants.%W
  467. // CHECK:STDOUT: }
  468. // CHECK:STDOUT:
  469. // CHECK:STDOUT: --- fail_check_rewrite_constraints.carbon
  470. // CHECK:STDOUT:
  471. // CHECK:STDOUT: constants {
  472. // CHECK:STDOUT: %I.type.1: type = facet_type <@I> [template]
  473. // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  474. // CHECK:STDOUT: %.1: type = assoc_entity_type %I.type.1, type [template]
  475. // CHECK:STDOUT: %.2: %.1 = assoc_entity element0, imports.%import_ref.11 [template]
  476. // CHECK:STDOUT: %.3: Core.IntLiteral = int_value 2 [template]
  477. // CHECK:STDOUT: %I.type.2: type = facet_type <@I where TODO> [template]
  478. // CHECK:STDOUT: %X: %I.type.2 = bind_symbolic_name X, 0 [symbolic]
  479. // CHECK:STDOUT: %X.patt: %I.type.2 = symbolic_binding_pattern X, 0 [symbolic]
  480. // CHECK:STDOUT: %RewriteTypeMismatch.type: type = fn_type @RewriteTypeMismatch [template]
  481. // CHECK:STDOUT: %RewriteTypeMismatch: %RewriteTypeMismatch.type = struct_value () [template]
  482. // CHECK:STDOUT: }
  483. // CHECK:STDOUT:
  484. // CHECK:STDOUT: imports {
  485. // CHECK:STDOUT: %import_ref.1 = import_ref Main//state_constraints, inst+3, unloaded
  486. // CHECK:STDOUT: %import_ref.2: type = import_ref Main//state_constraints, inst+7, loaded [template = constants.%I.type.1]
  487. // CHECK:STDOUT: %import_ref.3 = import_ref Main//state_constraints, inst+35, unloaded
  488. // CHECK:STDOUT: %import_ref.4 = import_ref Main//state_constraints, inst+56, unloaded
  489. // CHECK:STDOUT: %import_ref.5 = import_ref Main//state_constraints, inst+80, unloaded
  490. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  491. // CHECK:STDOUT: .ImplicitAs = %import_ref.12
  492. // CHECK:STDOUT: import Core//prelude
  493. // CHECK:STDOUT: import Core//prelude/...
  494. // CHECK:STDOUT: }
  495. // CHECK:STDOUT: %import_ref.6 = import_ref Main//state_constraints, inst+9, unloaded
  496. // CHECK:STDOUT: %import_ref.7: %.1 = import_ref Main//state_constraints, inst+13, loaded [template = constants.%.2]
  497. // CHECK:STDOUT: %import_ref.8 = import_ref Main//state_constraints, inst+19, unloaded
  498. // CHECK:STDOUT: %import_ref.9 = import_ref Main//state_constraints, inst+11, unloaded
  499. // CHECK:STDOUT: %import_ref.10 = import_ref Main//state_constraints, inst+17, unloaded
  500. // CHECK:STDOUT: }
  501. // CHECK:STDOUT:
  502. // CHECK:STDOUT: file {
  503. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  504. // CHECK:STDOUT: .J = imports.%import_ref.1
  505. // CHECK:STDOUT: .I = imports.%import_ref.2
  506. // CHECK:STDOUT: .EqualEqual = imports.%import_ref.3
  507. // CHECK:STDOUT: .Impls = imports.%import_ref.4
  508. // CHECK:STDOUT: .And = imports.%import_ref.5
  509. // CHECK:STDOUT: .Core = imports.%Core
  510. // CHECK:STDOUT: .RewriteTypeMismatch = %RewriteTypeMismatch.decl
  511. // CHECK:STDOUT: }
  512. // CHECK:STDOUT: %Core.import = import Core
  513. // CHECK:STDOUT: %default.import = import <invalid>
  514. // CHECK:STDOUT: %RewriteTypeMismatch.decl: %RewriteTypeMismatch.type = fn_decl @RewriteTypeMismatch [template = constants.%RewriteTypeMismatch] {
  515. // CHECK:STDOUT: %X.patt.loc16_24.1: %I.type.2 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  516. // CHECK:STDOUT: %X.param_patt: %I.type.2 = value_param_pattern %X.patt.loc16_24.1, runtime_param<invalid> [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  517. // CHECK:STDOUT: } {
  518. // CHECK:STDOUT: %I.ref: type = name_ref I, imports.%import_ref.2 [template = constants.%I.type.1]
  519. // CHECK:STDOUT: %.Self: %I.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  520. // CHECK:STDOUT: %.Self.ref: %I.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self]
  521. // CHECK:STDOUT: %Member.ref: %.1 = name_ref Member, imports.%import_ref.7 [template = constants.%.2]
  522. // CHECK:STDOUT: %.loc16_46.1: Core.IntLiteral = int_value 2 [template = constants.%.3]
  523. // CHECK:STDOUT: %.loc16_46.2: %.1 = converted %.loc16_46.1, <error> [template = <error>]
  524. // CHECK:STDOUT: %.loc16_30: type = where_expr %.Self [template = constants.%I.type.2] {
  525. // CHECK:STDOUT: requirement_rewrite %Member.ref, <error>
  526. // CHECK:STDOUT: }
  527. // CHECK:STDOUT: %X.param: %I.type.2 = value_param runtime_param<invalid>
  528. // CHECK:STDOUT: %X.loc16_24.1: %I.type.2 = bind_symbolic_name X, 0, %X.param [symbolic = %X.loc16_24.2 (constants.%X)]
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT: }
  531. // CHECK:STDOUT:
  532. // CHECK:STDOUT: interface @I {
  533. // CHECK:STDOUT: !members:
  534. // CHECK:STDOUT: .Self = imports.%import_ref.6
  535. // CHECK:STDOUT: .Member = imports.%import_ref.7
  536. // CHECK:STDOUT: .Second = imports.%import_ref.8
  537. // CHECK:STDOUT: witness = (imports.%import_ref.9, imports.%import_ref.10)
  538. // CHECK:STDOUT: }
  539. // CHECK:STDOUT:
  540. // CHECK:STDOUT: generic fn @RewriteTypeMismatch(%X.loc16_24.1: %I.type.2) {
  541. // CHECK:STDOUT: %X.loc16_24.2: %I.type.2 = bind_symbolic_name X, 0 [symbolic = %X.loc16_24.2 (constants.%X)]
  542. // CHECK:STDOUT: %X.patt.loc16_24.2: %I.type.2 = symbolic_binding_pattern X, 0 [symbolic = %X.patt.loc16_24.2 (constants.%X.patt)]
  543. // CHECK:STDOUT:
  544. // CHECK:STDOUT: fn(%X.param_patt: %I.type.2);
  545. // CHECK:STDOUT: }
  546. // CHECK:STDOUT:
  547. // CHECK:STDOUT: specific @RewriteTypeMismatch(constants.%X) {
  548. // CHECK:STDOUT: %X.loc16_24.2 => constants.%X
  549. // CHECK:STDOUT: %X.patt.loc16_24.2 => constants.%X
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT:
  552. // CHECK:STDOUT: --- fail_left_of_impls_non_type.carbon
  553. // CHECK:STDOUT:
  554. // CHECK:STDOUT: constants {
  555. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  556. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 7 [template]
  557. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  558. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  559. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  560. // CHECK:STDOUT: %NonTypeImpls.type: type = fn_type @NonTypeImpls [template]
  561. // CHECK:STDOUT: %NonTypeImpls: %NonTypeImpls.type = struct_value () [template]
  562. // CHECK:STDOUT: }
  563. // CHECK:STDOUT:
  564. // CHECK:STDOUT: imports {
  565. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  566. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  567. // CHECK:STDOUT: import Core//prelude
  568. // CHECK:STDOUT: import Core//prelude/...
  569. // CHECK:STDOUT: }
  570. // CHECK:STDOUT: }
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: file {
  573. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  574. // CHECK:STDOUT: .Core = imports.%Core
  575. // CHECK:STDOUT: .NonTypeImpls = %NonTypeImpls.decl
  576. // CHECK:STDOUT: }
  577. // CHECK:STDOUT: %Core.import = import Core
  578. // CHECK:STDOUT: %NonTypeImpls.decl: %NonTypeImpls.type = fn_decl @NonTypeImpls [template = constants.%NonTypeImpls] {
  579. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  580. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc11_17.1, runtime_param<invalid> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  581. // CHECK:STDOUT: } {
  582. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  583. // CHECK:STDOUT: %.loc11_32.1: Core.IntLiteral = int_value 7 [template = constants.%.1]
  584. // CHECK:STDOUT: %.loc11_32.2: type = converted %.loc11_32.1, <error> [template = <error>]
  585. // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = constants.%type_where] {
  586. // CHECK:STDOUT: requirement_impls <error>, type
  587. // CHECK:STDOUT: }
  588. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<invalid>
  589. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  590. // CHECK:STDOUT: }
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: generic fn @NonTypeImpls(%U.loc11_17.1: %type_where) {
  594. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  595. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  598. // CHECK:STDOUT: }
  599. // CHECK:STDOUT:
  600. // CHECK:STDOUT: specific @NonTypeImpls(constants.%U) {
  601. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  602. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  603. // CHECK:STDOUT: }
  604. // CHECK:STDOUT:
  605. // CHECK:STDOUT: --- fail_right_of_impls_non_type.carbon
  606. // CHECK:STDOUT:
  607. // CHECK:STDOUT: constants {
  608. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  609. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 7 [template]
  610. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  611. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  612. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  613. // CHECK:STDOUT: %ImplsNonType.type: type = fn_type @ImplsNonType [template]
  614. // CHECK:STDOUT: %ImplsNonType: %ImplsNonType.type = struct_value () [template]
  615. // CHECK:STDOUT: }
  616. // CHECK:STDOUT:
  617. // CHECK:STDOUT: imports {
  618. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  619. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  620. // CHECK:STDOUT: import Core//prelude
  621. // CHECK:STDOUT: import Core//prelude/...
  622. // CHECK:STDOUT: }
  623. // CHECK:STDOUT: }
  624. // CHECK:STDOUT:
  625. // CHECK:STDOUT: file {
  626. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  627. // CHECK:STDOUT: .Core = imports.%Core
  628. // CHECK:STDOUT: .ImplsNonType = %ImplsNonType.decl
  629. // CHECK:STDOUT: }
  630. // CHECK:STDOUT: %Core.import = import Core
  631. // CHECK:STDOUT: %ImplsNonType.decl: %ImplsNonType.type = fn_decl @ImplsNonType [template = constants.%ImplsNonType] {
  632. // CHECK:STDOUT: %U.patt.loc11_17.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  633. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc11_17.1, runtime_param<invalid> [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  634. // CHECK:STDOUT: } {
  635. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  636. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  637. // CHECK:STDOUT: %.loc11_44.1: Core.IntLiteral = int_value 7 [template = constants.%.1]
  638. // CHECK:STDOUT: %.loc11_44.2: type = converted %.loc11_44.1, <error> [template = <error>]
  639. // CHECK:STDOUT: %.loc11_26: type = where_expr %.Self [template = constants.%type_where] {
  640. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<invalid>
  643. // CHECK:STDOUT: %U.loc11_17.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc11_17.2 (constants.%U)]
  644. // CHECK:STDOUT: }
  645. // CHECK:STDOUT: }
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: generic fn @ImplsNonType(%U.loc11_17.1: %type_where) {
  648. // CHECK:STDOUT: %U.loc11_17.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc11_17.2 (constants.%U)]
  649. // CHECK:STDOUT: %U.patt.loc11_17.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc11_17.2 (constants.%U.patt)]
  650. // CHECK:STDOUT:
  651. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: specific @ImplsNonType(constants.%U) {
  655. // CHECK:STDOUT: %U.loc11_17.2 => constants.%U
  656. // CHECK:STDOUT: %U.patt.loc11_17.2 => constants.%U
  657. // CHECK:STDOUT: }
  658. // CHECK:STDOUT:
  659. // CHECK:STDOUT: --- fail_right_of_impls_non_facet_type.carbon
  660. // CHECK:STDOUT:
  661. // CHECK:STDOUT: constants {
  662. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  663. // CHECK:STDOUT: %.1: Core.IntLiteral = int_value 32 [template]
  664. // CHECK:STDOUT: %Int.type: type = fn_type @Int [template]
  665. // CHECK:STDOUT: %Int: %Int.type = struct_value () [template]
  666. // CHECK:STDOUT: %i32: type = int_type signed, %.1 [template]
  667. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  668. // CHECK:STDOUT: %U: %type_where = bind_symbolic_name U, 0 [symbolic]
  669. // CHECK:STDOUT: %U.patt: %type_where = symbolic_binding_pattern U, 0 [symbolic]
  670. // CHECK:STDOUT: %ImplsOfNonFacetType.type: type = fn_type @ImplsOfNonFacetType [template]
  671. // CHECK:STDOUT: %ImplsOfNonFacetType: %ImplsOfNonFacetType.type = struct_value () [template]
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: imports {
  675. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  676. // CHECK:STDOUT: .Int = %import_ref
  677. // CHECK:STDOUT: import Core//prelude
  678. // CHECK:STDOUT: import Core//prelude/...
  679. // CHECK:STDOUT: }
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: file {
  683. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  684. // CHECK:STDOUT: .Core = imports.%Core
  685. // CHECK:STDOUT: .ImplsOfNonFacetType = %ImplsOfNonFacetType.decl
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT: %Core.import = import Core
  688. // CHECK:STDOUT: %ImplsOfNonFacetType.decl: %ImplsOfNonFacetType.type = fn_decl @ImplsOfNonFacetType [template = constants.%ImplsOfNonFacetType] {
  689. // CHECK:STDOUT: %U.patt.loc8_24.1: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  690. // CHECK:STDOUT: %U.param_patt: %type_where = value_param_pattern %U.patt.loc8_24.1, runtime_param<invalid> [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  691. // CHECK:STDOUT: } {
  692. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  693. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  694. // CHECK:STDOUT: %.loc8_51.1: Core.IntLiteral = int_value 32 [template = constants.%.1]
  695. // CHECK:STDOUT: %int.make_type_signed: init type = call constants.%Int(%.loc8_51.1) [template = constants.%i32]
  696. // CHECK:STDOUT: %.loc8_51.2: type = value_of_initializer %int.make_type_signed [template = constants.%i32]
  697. // CHECK:STDOUT: %.loc8_51.3: type = converted %int.make_type_signed, %.loc8_51.2 [template = constants.%i32]
  698. // CHECK:STDOUT: %.loc8_33: type = where_expr %.Self [template = constants.%type_where] {
  699. // CHECK:STDOUT: requirement_impls %.Self.ref, <error>
  700. // CHECK:STDOUT: }
  701. // CHECK:STDOUT: %U.param: %type_where = value_param runtime_param<invalid>
  702. // CHECK:STDOUT: %U.loc8_24.1: %type_where = bind_symbolic_name U, 0, %U.param [symbolic = %U.loc8_24.2 (constants.%U)]
  703. // CHECK:STDOUT: }
  704. // CHECK:STDOUT: }
  705. // CHECK:STDOUT:
  706. // CHECK:STDOUT: generic fn @ImplsOfNonFacetType(%U.loc8_24.1: %type_where) {
  707. // CHECK:STDOUT: %U.loc8_24.2: %type_where = bind_symbolic_name U, 0 [symbolic = %U.loc8_24.2 (constants.%U)]
  708. // CHECK:STDOUT: %U.patt.loc8_24.2: %type_where = symbolic_binding_pattern U, 0 [symbolic = %U.patt.loc8_24.2 (constants.%U.patt)]
  709. // CHECK:STDOUT:
  710. // CHECK:STDOUT: fn(%U.param_patt: %type_where);
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT:
  713. // CHECK:STDOUT: specific @ImplsOfNonFacetType(constants.%U) {
  714. // CHECK:STDOUT: %U.loc8_24.2 => constants.%U
  715. // CHECK:STDOUT: %U.patt.loc8_24.2 => constants.%U
  716. // CHECK:STDOUT: }
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: --- fail_todo_enforce_constraint.carbon
  719. // CHECK:STDOUT:
  720. // CHECK:STDOUT: constants {
  721. // CHECK:STDOUT: %C: type = class_type @C [template]
  722. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  723. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  724. // CHECK:STDOUT: %J.type.1: type = facet_type <@J> [template]
  725. // CHECK:STDOUT: %.3: <witness> = interface_witness () [template]
  726. // CHECK:STDOUT: %DoesNotImplI.type: type = fn_type @DoesNotImplI [template]
  727. // CHECK:STDOUT: %DoesNotImplI: %DoesNotImplI.type = struct_value () [template]
  728. // CHECK:STDOUT: %Impls.type: type = fn_type @Impls [template]
  729. // CHECK:STDOUT: %Impls: %Impls.type = struct_value () [template]
  730. // CHECK:STDOUT: %V: %J.type.1 = bind_symbolic_name V, 0 [symbolic]
  731. // CHECK:STDOUT: %V.patt: %J.type.1 = symbolic_binding_pattern V, 0 [symbolic]
  732. // CHECK:STDOUT: %.Self: %J.type.1 = bind_symbolic_name .Self, 0 [symbolic]
  733. // CHECK:STDOUT: %J.type.2: type = facet_type <@J where TODO> [template]
  734. // CHECK:STDOUT: %Y: %J.type.2 = bind_symbolic_name Y, 0 [symbolic]
  735. // CHECK:STDOUT: %Y.patt: %J.type.2 = symbolic_binding_pattern Y, 0 [symbolic]
  736. // CHECK:STDOUT: %EmptyStruct.type: type = fn_type @EmptyStruct [template]
  737. // CHECK:STDOUT: %EmptyStruct: %EmptyStruct.type = struct_value () [template]
  738. // CHECK:STDOUT: %NotEmptyStruct.type: type = fn_type @NotEmptyStruct [template]
  739. // CHECK:STDOUT: %NotEmptyStruct: %NotEmptyStruct.type = struct_value () [template]
  740. // CHECK:STDOUT: }
  741. // CHECK:STDOUT:
  742. // CHECK:STDOUT: imports {
  743. // CHECK:STDOUT: %import_ref.1: type = import_ref Main//state_constraints, inst+3, loaded [template = constants.%J.type.1]
  744. // CHECK:STDOUT: %import_ref.2 = import_ref Main//state_constraints, inst+7, unloaded
  745. // CHECK:STDOUT: %import_ref.3 = import_ref Main//state_constraints, inst+35, unloaded
  746. // CHECK:STDOUT: %import_ref.4: %Impls.type = import_ref Main//state_constraints, inst+56, loaded [template = constants.%Impls]
  747. // CHECK:STDOUT: %import_ref.5 = import_ref Main//state_constraints, inst+80, unloaded
  748. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  749. // CHECK:STDOUT: .ImplicitAs = %import_ref.7
  750. // CHECK:STDOUT: import Core//prelude
  751. // CHECK:STDOUT: import Core//prelude/...
  752. // CHECK:STDOUT: }
  753. // CHECK:STDOUT: %import_ref.6 = import_ref Main//state_constraints, inst+5, unloaded
  754. // CHECK:STDOUT: }
  755. // CHECK:STDOUT:
  756. // CHECK:STDOUT: file {
  757. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  758. // CHECK:STDOUT: .J = imports.%import_ref.1
  759. // CHECK:STDOUT: .I = imports.%import_ref.2
  760. // CHECK:STDOUT: .EqualEqual = imports.%import_ref.3
  761. // CHECK:STDOUT: .Impls = imports.%import_ref.4
  762. // CHECK:STDOUT: .And = imports.%import_ref.5
  763. // CHECK:STDOUT: .Core = imports.%Core
  764. // CHECK:STDOUT: .C = %C.decl
  765. // CHECK:STDOUT: .DoesNotImplI = %DoesNotImplI.decl
  766. // CHECK:STDOUT: .EmptyStruct = %EmptyStruct.decl
  767. // CHECK:STDOUT: .NotEmptyStruct = %NotEmptyStruct.decl
  768. // CHECK:STDOUT: }
  769. // CHECK:STDOUT: %Core.import = import Core
  770. // CHECK:STDOUT: %default.import = import <invalid>
  771. // CHECK:STDOUT: %C.decl: type = class_decl @C [template = constants.%C] {} {}
  772. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  773. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  774. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%import_ref.1 [template = constants.%J.type.1]
  775. // CHECK:STDOUT: }
  776. // CHECK:STDOUT: %DoesNotImplI.decl: %DoesNotImplI.type = fn_decl @DoesNotImplI [template = constants.%DoesNotImplI] {} {}
  777. // CHECK:STDOUT: %EmptyStruct.decl: %EmptyStruct.type = fn_decl @EmptyStruct [template = constants.%EmptyStruct] {
  778. // CHECK:STDOUT: %Y.patt.loc26_16.1: %J.type.2 = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  779. // CHECK:STDOUT: %Y.param_patt: %J.type.2 = value_param_pattern %Y.patt.loc26_16.1, runtime_param<invalid> [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  780. // CHECK:STDOUT: } {
  781. // CHECK:STDOUT: %J.ref: type = name_ref J, imports.%import_ref.1 [template = constants.%J.type.1]
  782. // CHECK:STDOUT: %.Self: %J.type.1 = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  783. // CHECK:STDOUT: %.Self.ref: %J.type.1 = name_ref .Self, %.Self [symbolic = constants.%.Self]
  784. // CHECK:STDOUT: %.loc26_38: %.1 = struct_literal ()
  785. // CHECK:STDOUT: %.loc26_22: type = where_expr %.Self [template = constants.%J.type.2] {
  786. // CHECK:STDOUT: requirement_equivalent %.Self.ref, %.loc26_38
  787. // CHECK:STDOUT: }
  788. // CHECK:STDOUT: %Y.param: %J.type.2 = value_param runtime_param<invalid>
  789. // CHECK:STDOUT: %Y.loc26_16.1: %J.type.2 = bind_symbolic_name Y, 0, %Y.param [symbolic = %Y.loc26_16.2 (constants.%Y)]
  790. // CHECK:STDOUT: }
  791. // CHECK:STDOUT: %NotEmptyStruct.decl: %NotEmptyStruct.type = fn_decl @NotEmptyStruct [template = constants.%NotEmptyStruct] {} {}
  792. // CHECK:STDOUT: }
  793. // CHECK:STDOUT:
  794. // CHECK:STDOUT: interface @J {
  795. // CHECK:STDOUT: !members:
  796. // CHECK:STDOUT: .Self = imports.%import_ref.6
  797. // CHECK:STDOUT: witness = ()
  798. // CHECK:STDOUT: }
  799. // CHECK:STDOUT:
  800. // CHECK:STDOUT: impl @impl.1: %C.ref as %J.ref {
  801. // CHECK:STDOUT: %.loc8: <witness> = interface_witness () [template = constants.%.3]
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: !members:
  804. // CHECK:STDOUT: witness = %.loc8
  805. // CHECK:STDOUT: }
  806. // CHECK:STDOUT:
  807. // CHECK:STDOUT: class @C {
  808. // CHECK:STDOUT: %.loc7: <witness> = complete_type_witness %.1 [template = constants.%.2]
  809. // CHECK:STDOUT:
  810. // CHECK:STDOUT: !members:
  811. // CHECK:STDOUT: .Self = constants.%C
  812. // CHECK:STDOUT: }
  813. // CHECK:STDOUT:
  814. // CHECK:STDOUT: fn @DoesNotImplI() {
  815. // CHECK:STDOUT: !entry:
  816. // CHECK:STDOUT: %Impls.ref: %Impls.type = name_ref Impls, imports.%import_ref.4 [template = constants.%Impls]
  817. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  818. // CHECK:STDOUT: %.loc23: %J.type.1 = converted %C.ref, <error> [template = <error>]
  819. // CHECK:STDOUT: return
  820. // CHECK:STDOUT: }
  821. // CHECK:STDOUT:
  822. // CHECK:STDOUT: generic fn @Impls(constants.%V: %J.type.1) {
  823. // CHECK:STDOUT: %V: %J.type.1 = bind_symbolic_name V, 0 [symbolic = %V (constants.%V)]
  824. // CHECK:STDOUT: %V.patt: %J.type.1 = symbolic_binding_pattern V, 0 [symbolic = %V.patt (constants.%V.patt)]
  825. // CHECK:STDOUT:
  826. // CHECK:STDOUT: fn(%V.param_patt: %J.type.1);
  827. // CHECK:STDOUT: }
  828. // CHECK:STDOUT:
  829. // CHECK:STDOUT: generic fn @EmptyStruct(%Y.loc26_16.1: %J.type.2) {
  830. // CHECK:STDOUT: %Y.loc26_16.2: %J.type.2 = bind_symbolic_name Y, 0 [symbolic = %Y.loc26_16.2 (constants.%Y)]
  831. // CHECK:STDOUT: %Y.patt.loc26_16.2: %J.type.2 = symbolic_binding_pattern Y, 0 [symbolic = %Y.patt.loc26_16.2 (constants.%Y.patt)]
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: fn(%Y.param_patt: %J.type.2);
  834. // CHECK:STDOUT: }
  835. // CHECK:STDOUT:
  836. // CHECK:STDOUT: fn @NotEmptyStruct() {
  837. // CHECK:STDOUT: !entry:
  838. // CHECK:STDOUT: %EmptyStruct.ref: %EmptyStruct.type = name_ref EmptyStruct, file.%EmptyStruct.decl [template = constants.%EmptyStruct]
  839. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [template = constants.%C]
  840. // CHECK:STDOUT: %.loc40: %J.type.2 = converted %C.ref, <error> [template = <error>]
  841. // CHECK:STDOUT: return
  842. // CHECK:STDOUT: }
  843. // CHECK:STDOUT:
  844. // CHECK:STDOUT: specific @Impls(constants.%V) {
  845. // CHECK:STDOUT: %V => constants.%V
  846. // CHECK:STDOUT: %V.patt => constants.%V
  847. // CHECK:STDOUT: }
  848. // CHECK:STDOUT:
  849. // CHECK:STDOUT: specific @EmptyStruct(constants.%Y) {
  850. // CHECK:STDOUT: %Y.loc26_16.2 => constants.%Y
  851. // CHECK:STDOUT: %Y.patt.loc26_16.2 => constants.%Y
  852. // CHECK:STDOUT: }
  853. // CHECK:STDOUT:
  854. // CHECK:STDOUT: --- fail_todo_let.carbon
  855. // CHECK:STDOUT:
  856. // CHECK:STDOUT: constants {
  857. // CHECK:STDOUT: %A.type: type = facet_type <@A> [template]
  858. // CHECK:STDOUT: %Self.1: %A.type = bind_symbolic_name Self, 0 [symbolic]
  859. // CHECK:STDOUT: %D: type = class_type @D [template]
  860. // CHECK:STDOUT: %.1: type = struct_type {} [template]
  861. // CHECK:STDOUT: %.2: <witness> = complete_type_witness %.1 [template]
  862. // CHECK:STDOUT: %.3: <witness> = interface_witness () [template]
  863. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic]
  864. // CHECK:STDOUT: %type_where: type = facet_type <type where TODO> [template]
  865. // CHECK:STDOUT: }
  866. // CHECK:STDOUT:
  867. // CHECK:STDOUT: imports {
  868. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  869. // CHECK:STDOUT: .ImplicitAs = %import_ref.1
  870. // CHECK:STDOUT: import Core//prelude
  871. // CHECK:STDOUT: import Core//prelude/...
  872. // CHECK:STDOUT: }
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: file {
  876. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  877. // CHECK:STDOUT: .Core = imports.%Core
  878. // CHECK:STDOUT: .A = %A.decl
  879. // CHECK:STDOUT: .D = %D.decl
  880. // CHECK:STDOUT: .B = @__global_init.%B
  881. // CHECK:STDOUT: }
  882. // CHECK:STDOUT: %Core.import = import Core
  883. // CHECK:STDOUT: %A.decl: type = interface_decl @A [template = constants.%A.type] {} {}
  884. // CHECK:STDOUT: %D.decl: type = class_decl @D [template = constants.%D] {} {}
  885. // CHECK:STDOUT: impl_decl @impl.1 [template] {} {
  886. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  887. // CHECK:STDOUT: %A.ref: type = name_ref A, file.%A.decl [template = constants.%A.type]
  888. // CHECK:STDOUT: }
  889. // CHECK:STDOUT: %.Self: type = bind_symbolic_name .Self, 0 [symbolic = constants.%.Self]
  890. // CHECK:STDOUT: %.Self.ref: type = name_ref .Self, %.Self [symbolic = constants.%.Self]
  891. // CHECK:STDOUT: %A.ref: type = name_ref A, %A.decl [template = constants.%A.type]
  892. // CHECK:STDOUT: %.loc14: type = where_expr %.Self [template = constants.%type_where] {
  893. // CHECK:STDOUT: requirement_impls %.Self.ref, %A.ref
  894. // CHECK:STDOUT: }
  895. // CHECK:STDOUT: }
  896. // CHECK:STDOUT:
  897. // CHECK:STDOUT: interface @A {
  898. // CHECK:STDOUT: %Self: %A.type = bind_symbolic_name Self, 0 [symbolic = constants.%Self.1]
  899. // CHECK:STDOUT:
  900. // CHECK:STDOUT: !members:
  901. // CHECK:STDOUT: .Self = %Self
  902. // CHECK:STDOUT: witness = ()
  903. // CHECK:STDOUT: }
  904. // CHECK:STDOUT:
  905. // CHECK:STDOUT: impl @impl.1: %D.ref as %A.ref {
  906. // CHECK:STDOUT: %.loc6: <witness> = interface_witness () [template = constants.%.3]
  907. // CHECK:STDOUT:
  908. // CHECK:STDOUT: !members:
  909. // CHECK:STDOUT: witness = %.loc6
  910. // CHECK:STDOUT: }
  911. // CHECK:STDOUT:
  912. // CHECK:STDOUT: class @D {
  913. // CHECK:STDOUT: %.loc5: <witness> = complete_type_witness %.1 [template = constants.%.2]
  914. // CHECK:STDOUT:
  915. // CHECK:STDOUT: !members:
  916. // CHECK:STDOUT: .Self = constants.%D
  917. // CHECK:STDOUT: }
  918. // CHECK:STDOUT:
  919. // CHECK:STDOUT: fn @__global_init() {
  920. // CHECK:STDOUT: !entry:
  921. // CHECK:STDOUT: %D.ref: type = name_ref D, file.%D.decl [template = constants.%D]
  922. // CHECK:STDOUT: %.loc14: %type_where = converted %D.ref, <error> [template = <error>]
  923. // CHECK:STDOUT: %B: %type_where = bind_name B, <error>
  924. // CHECK:STDOUT: return
  925. // CHECK:STDOUT: }
  926. // CHECK:STDOUT: