incomplete.carbon 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // INCLUDE-FILE: toolchain/testing/testdata/min_prelude/none.carbon
  6. // TODO: Add ranges and switch to "--dump-sem-ir-ranges=only".
  7. // EXTRA-ARGS: --dump-sem-ir-ranges=if-present
  8. //
  9. // AUTOUPDATE
  10. // TIP: To test this file alone, run:
  11. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/impl/incomplete.carbon
  12. // TIP: To dump output, run:
  13. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/impl/incomplete.carbon
  14. // --- fail_empty_struct.carbon
  15. library "[[@TEST_NAME]]";
  16. interface I;
  17. // Requires I identified.
  18. impl {} as I;
  19. // CHECK:STDERR: fail_empty_struct.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `I` [ImplAsIncompleteFacetTypeDefinition]
  20. // CHECK:STDERR: impl {} as I {}
  21. // CHECK:STDERR: ^~~~~~~~~~~~~~
  22. // CHECK:STDERR: fail_empty_struct.carbon:[[@LINE-8]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  23. // CHECK:STDERR: interface I;
  24. // CHECK:STDERR: ^~~~~~~~~~~~
  25. // CHECK:STDERR:
  26. impl {} as I {}
  27. // --- fail_class.carbon
  28. library "[[@TEST_NAME]]";
  29. interface J;
  30. class C {}
  31. // Requires I identified.
  32. // CHECK:STDERR: fail_class.carbon:[[@LINE+4]]:11: error: name `I` not found [NameNotFound]
  33. // CHECK:STDERR: impl C as I;
  34. // CHECK:STDERR: ^
  35. // CHECK:STDERR:
  36. impl C as I;
  37. // CHECK:STDERR: fail_class.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition]
  38. // CHECK:STDERR: impl C as J {}
  39. // CHECK:STDERR: ^~~~~~~~~~~~~
  40. // CHECK:STDERR: fail_class.carbon:[[@LINE-13]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  41. // CHECK:STDERR: interface J;
  42. // CHECK:STDERR: ^~~~~~~~~~~~
  43. // CHECK:STDERR:
  44. impl C as J {}
  45. // --- fail_class_no_forward_decl.carbon
  46. library "[[@TEST_NAME]]";
  47. interface J;
  48. class C {}
  49. // CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE+7]]:1: error: definition of impl as incomplete facet type `J` [ImplAsIncompleteFacetTypeDefinition]
  50. // CHECK:STDERR: impl C as J {}
  51. // CHECK:STDERR: ^~~~~~~~~~~~~
  52. // CHECK:STDERR: fail_class_no_forward_decl.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  53. // CHECK:STDERR: interface J;
  54. // CHECK:STDERR: ^~~~~~~~~~~~
  55. // CHECK:STDERR:
  56. impl C as J {}
  57. // --- fail_class_with_rewrite.carbon
  58. library "[[@TEST_NAME]]";
  59. interface J;
  60. class C {}
  61. // CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+7]]:19: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet]
  62. // CHECK:STDERR: impl C as J where .X = ();
  63. // CHECK:STDERR: ^~
  64. // CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  65. // CHECK:STDERR: interface J;
  66. // CHECK:STDERR: ^~~~~~~~~~~~
  67. // CHECK:STDERR:
  68. impl C as J where .X = ();
  69. // CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE+7]]:19: error: member access into facet of incomplete type `J` [IncompleteTypeInMemberAccessOfFacet]
  70. // CHECK:STDERR: impl C as J where .X = () {}
  71. // CHECK:STDERR: ^~
  72. // CHECK:STDERR: fail_class_with_rewrite.carbon:[[@LINE-15]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  73. // CHECK:STDERR: interface J;
  74. // CHECK:STDERR: ^~~~~~~~~~~~
  75. // CHECK:STDERR:
  76. impl C as J where .X = () {}
  77. // --- fail_todo_class_with_qualified_rewrite.carbon
  78. library "[[@TEST_NAME]]";
  79. interface J;
  80. interface K { let X:! type; }
  81. class C {}
  82. // TODO: There should be no error here.
  83. //
  84. // CHECK:STDERR: fail_todo_class_with_qualified_rewrite.carbon:[[@LINE+8]]:38: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod]
  85. // CHECK:STDERR: impl C as J where .Self impls K and .(K.X) = ();
  86. // CHECK:STDERR: ^
  87. // CHECK:STDERR:
  88. // CHECK:STDERR: fail_todo_class_with_qualified_rewrite.carbon:[[@LINE+4]]:38: error: semantics TODO: `handle invalid parse trees in `check`` [SemanticsTodo]
  89. // CHECK:STDERR: impl C as J where .Self impls K and .(K.X) = ();
  90. // CHECK:STDERR: ^
  91. // CHECK:STDERR:
  92. impl C as J where .Self impls K and .(K.X) = ();
  93. // TODO: The failure here should be that J is incomplete, once the rewrite of
  94. // `.(K.X)` works. Since any rewrite in the decl requires us to know the size of
  95. // the witness table which requires all interfaces to be complete.
  96. //
  97. // CHECK:STDERR: fail_todo_class_with_qualified_rewrite.carbon:[[@LINE+4]]:38: error: expected identifier or `Self` after `.` [ExpectedIdentifierOrSelfAfterPeriod]
  98. // CHECK:STDERR: impl C as J where .Self impls K and .(K.X) = () {}
  99. // CHECK:STDERR: ^
  100. // CHECK:STDERR:
  101. impl C as J where .Self impls K and .(K.X) = () {}
  102. // --- incomplete_where.carbon
  103. library "[[@TEST_NAME]]";
  104. class C {}
  105. interface I {}
  106. interface Incomplete;
  107. impl C as I where .Self impls Incomplete {}
  108. // --- declaration_incomplete_where_rewrite.carbon
  109. library "[[@TEST_NAME]]";
  110. class C {}
  111. interface J { let T:! type; }
  112. interface Incomplete;
  113. impl C as J where .Self impls Incomplete and .T = ();
  114. impl C as J where .Self impls Incomplete and .T = () {}
  115. // --- fail_declaration_lookup_into_incomplete.carbon
  116. library "[[@TEST_NAME]]";
  117. class C {}
  118. interface I {}
  119. interface Incomplete;
  120. impl C as I where .Self impls Incomplete {
  121. // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE+7]]:19: error: member access into incomplete facet type `Incomplete` [QualifiedExprInIncompleteFacetTypeScope]
  122. // CHECK:STDERR: fn F() -> Self.(Incomplete.T);
  123. // CHECK:STDERR: ^~~~~~~~~~~~
  124. // CHECK:STDERR: fail_declaration_lookup_into_incomplete.carbon:[[@LINE-6]]:1: note: interface was forward declared here [InterfaceForwardDeclaredHere]
  125. // CHECK:STDERR: interface Incomplete;
  126. // CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~
  127. // CHECK:STDERR:
  128. fn F() -> Self.(Incomplete.T);
  129. };
  130. // --- fail_unidentified_constraint.carbon
  131. library "[[@TEST_NAME]]";
  132. constraint X;
  133. class C {}
  134. // Requires X identified.
  135. // CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE+7]]:1: error: facet type `X` cannot be identified in `impl as` [ImplOfUnidentifiedFacetType]
  136. // CHECK:STDERR: impl C as X;
  137. // CHECK:STDERR: ^~~~~~~~~~~~
  138. // CHECK:STDERR: fail_unidentified_constraint.carbon:[[@LINE-7]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  139. // CHECK:STDERR: constraint X;
  140. // CHECK:STDERR: ^~~~~~~~~~~~~
  141. // CHECK:STDERR:
  142. impl C as X;
  143. // --- nested_require_incomplete_interface.carbon
  144. library "[[@TEST_NAME]]";
  145. interface Z;
  146. constraint Y {
  147. // Not extend, so only required to be identified.
  148. require impls Z;
  149. }
  150. interface X {
  151. let X1:! type;
  152. // Not extend, so only required to be identified.
  153. require impls Y;
  154. }
  155. // Requires `X` to be complete, doesn't require Z to be complete.
  156. fn F(unused T:! X where .X1 = {}) {}
  157. // --- fail_incomplete_constraint.carbon
  158. library "[[@TEST_NAME]]";
  159. constraint A;
  160. interface B {
  161. // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE+7]]:17: error: facet type `A` cannot be identified in `require` declaration [RequireImplsUnidentifiedFacetType]
  162. // CHECK:STDERR: require impls A;
  163. // CHECK:STDERR: ^
  164. // CHECK:STDERR: fail_incomplete_constraint.carbon:[[@LINE-6]]:1: note: constraint was forward declared here [NamedConstraintForwardDeclaredHere]
  165. // CHECK:STDERR: constraint A;
  166. // CHECK:STDERR: ^~~~~~~~~~~~~
  167. // CHECK:STDERR:
  168. require impls A;
  169. }
  170. // CHECK:STDOUT: --- fail_empty_struct.carbon
  171. // CHECK:STDOUT:
  172. // CHECK:STDOUT: constants {
  173. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  174. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  175. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  176. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @empty_struct_type.as.I.impl.%I.impl_witness_table [concrete]
  177. // CHECK:STDOUT: }
  178. // CHECK:STDOUT:
  179. // CHECK:STDOUT: file {
  180. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  181. // CHECK:STDOUT: .I = %I.decl
  182. // CHECK:STDOUT: }
  183. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  184. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  185. // CHECK:STDOUT: %.loc6_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  186. // CHECK:STDOUT: %.loc6_7.2: type = converted %.loc6_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  187. // CHECK:STDOUT: %I.ref.loc6: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  188. // CHECK:STDOUT: }
  189. // CHECK:STDOUT: impl_decl @empty_struct_type.as.I.impl [concrete] {} {
  190. // CHECK:STDOUT: %.loc15_7.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  191. // CHECK:STDOUT: %.loc15_7.2: type = converted %.loc15_7.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  192. // CHECK:STDOUT: %I.ref.loc15: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  193. // CHECK:STDOUT: }
  194. // CHECK:STDOUT: }
  195. // CHECK:STDOUT:
  196. // CHECK:STDOUT: interface @I;
  197. // CHECK:STDOUT:
  198. // CHECK:STDOUT: impl @empty_struct_type.as.I.impl: %.loc6_7.2 as %I.ref.loc6 {
  199. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @empty_struct_type.as.I.impl [concrete]
  200. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  201. // CHECK:STDOUT:
  202. // CHECK:STDOUT: !members:
  203. // CHECK:STDOUT: witness = <error>
  204. // CHECK:STDOUT: }
  205. // CHECK:STDOUT:
  206. // CHECK:STDOUT: --- fail_class.carbon
  207. // CHECK:STDOUT:
  208. // CHECK:STDOUT: constants {
  209. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  210. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  211. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  212. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  213. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness @C.as.J.impl.%J.impl_witness_table [concrete]
  214. // CHECK:STDOUT: }
  215. // CHECK:STDOUT:
  216. // CHECK:STDOUT: file {
  217. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  218. // CHECK:STDOUT: .J = %J.decl
  219. // CHECK:STDOUT: .C = %C.decl
  220. // CHECK:STDOUT: .I = <poisoned>
  221. // CHECK:STDOUT: }
  222. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  223. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  224. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  225. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  226. // CHECK:STDOUT: %I.ref: <error> = name_ref I, <error> [concrete = <error>]
  227. // CHECK:STDOUT: }
  228. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  229. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  230. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  231. // CHECK:STDOUT: }
  232. // CHECK:STDOUT: }
  233. // CHECK:STDOUT:
  234. // CHECK:STDOUT: interface @J;
  235. // CHECK:STDOUT:
  236. // CHECK:STDOUT: impl @C.as.<error>.impl: %C.ref as <error>;
  237. // CHECK:STDOUT:
  238. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref as %J.ref {
  239. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @C.as.J.impl [concrete]
  240. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  241. // CHECK:STDOUT:
  242. // CHECK:STDOUT: !members:
  243. // CHECK:STDOUT: witness = <error>
  244. // CHECK:STDOUT: }
  245. // CHECK:STDOUT:
  246. // CHECK:STDOUT: class @C {
  247. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  248. // CHECK:STDOUT: complete_type_witness = %complete_type
  249. // CHECK:STDOUT:
  250. // CHECK:STDOUT: !members:
  251. // CHECK:STDOUT: .Self = constants.%C
  252. // CHECK:STDOUT: }
  253. // CHECK:STDOUT:
  254. // CHECK:STDOUT: --- fail_class_no_forward_decl.carbon
  255. // CHECK:STDOUT:
  256. // CHECK:STDOUT: constants {
  257. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  258. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  259. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  260. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  261. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness @C.as.J.impl.%J.impl_witness_table [concrete]
  262. // CHECK:STDOUT: }
  263. // CHECK:STDOUT:
  264. // CHECK:STDOUT: file {
  265. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  266. // CHECK:STDOUT: .J = %J.decl
  267. // CHECK:STDOUT: .C = %C.decl
  268. // CHECK:STDOUT: }
  269. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  270. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  271. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  272. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  273. // CHECK:STDOUT: %J.ref: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  274. // CHECK:STDOUT: }
  275. // CHECK:STDOUT: }
  276. // CHECK:STDOUT:
  277. // CHECK:STDOUT: interface @J;
  278. // CHECK:STDOUT:
  279. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref as %J.ref {
  280. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (), @C.as.J.impl [concrete]
  281. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  282. // CHECK:STDOUT:
  283. // CHECK:STDOUT: !members:
  284. // CHECK:STDOUT: witness = <error>
  285. // CHECK:STDOUT: }
  286. // CHECK:STDOUT:
  287. // CHECK:STDOUT: class @C {
  288. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  289. // CHECK:STDOUT: complete_type_witness = %complete_type
  290. // CHECK:STDOUT:
  291. // CHECK:STDOUT: !members:
  292. // CHECK:STDOUT: .Self = constants.%C
  293. // CHECK:STDOUT: }
  294. // CHECK:STDOUT:
  295. // CHECK:STDOUT: --- fail_class_with_rewrite.carbon
  296. // CHECK:STDOUT:
  297. // CHECK:STDOUT: constants {
  298. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  299. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  300. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  301. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  302. // CHECK:STDOUT: %.Self: %J.type = symbolic_binding .Self [symbolic_self]
  303. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  304. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  305. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  306. // CHECK:STDOUT: }
  307. // CHECK:STDOUT:
  308. // CHECK:STDOUT: file {
  309. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  310. // CHECK:STDOUT: .J = %J.decl
  311. // CHECK:STDOUT: .C = %C.decl
  312. // CHECK:STDOUT: }
  313. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  314. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  315. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  316. // CHECK:STDOUT: %C.ref.loc13: type = name_ref C, file.%C.decl [concrete = constants.%C]
  317. // CHECK:STDOUT: %J.ref.loc13: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  318. // CHECK:STDOUT: %.Self.2: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  319. // CHECK:STDOUT: %.Self.ref.loc13: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  320. // CHECK:STDOUT: %.Self.as_type.loc13: type = facet_access_type %.Self.ref.loc13 [symbolic_self = constants.%.Self.as_type]
  321. // CHECK:STDOUT: %.loc13_19: type = converted %.Self.ref.loc13, %.Self.as_type.loc13 [symbolic_self = constants.%.Self.as_type]
  322. // CHECK:STDOUT: %X.ref.loc13: <error> = name_ref X, <error> [concrete = <error>]
  323. // CHECK:STDOUT: %.loc13_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  324. // CHECK:STDOUT: %.loc13_13: type = where_expr [concrete = <error>] {
  325. // CHECK:STDOUT: requirement_base_facet_type %J.ref.loc13
  326. // CHECK:STDOUT: requirement_rewrite %X.ref.loc13, <error>
  327. // CHECK:STDOUT: }
  328. // CHECK:STDOUT: }
  329. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  330. // CHECK:STDOUT: %C.ref.loc22: type = name_ref C, file.%C.decl [concrete = constants.%C]
  331. // CHECK:STDOUT: %J.ref.loc22: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  332. // CHECK:STDOUT: %.Self.1: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  333. // CHECK:STDOUT: %.Self.ref.loc22: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  334. // CHECK:STDOUT: %.Self.as_type.loc22: type = facet_access_type %.Self.ref.loc22 [symbolic_self = constants.%.Self.as_type]
  335. // CHECK:STDOUT: %.loc22_19: type = converted %.Self.ref.loc22, %.Self.as_type.loc22 [symbolic_self = constants.%.Self.as_type]
  336. // CHECK:STDOUT: %X.ref.loc22: <error> = name_ref X, <error> [concrete = <error>]
  337. // CHECK:STDOUT: %.loc22_25: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  338. // CHECK:STDOUT: %.loc22_13: type = where_expr [concrete = <error>] {
  339. // CHECK:STDOUT: requirement_base_facet_type %J.ref.loc22
  340. // CHECK:STDOUT: requirement_rewrite %X.ref.loc22, <error>
  341. // CHECK:STDOUT: }
  342. // CHECK:STDOUT: }
  343. // CHECK:STDOUT: }
  344. // CHECK:STDOUT:
  345. // CHECK:STDOUT: interface @J;
  346. // CHECK:STDOUT:
  347. // CHECK:STDOUT: impl @C.as.<error>.impl: %C.ref.loc13 as %.loc13_13 {
  348. // CHECK:STDOUT: !members:
  349. // CHECK:STDOUT: witness = <error>
  350. // CHECK:STDOUT: }
  351. // CHECK:STDOUT:
  352. // CHECK:STDOUT: class @C {
  353. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  354. // CHECK:STDOUT: complete_type_witness = %complete_type
  355. // CHECK:STDOUT:
  356. // CHECK:STDOUT: !members:
  357. // CHECK:STDOUT: .Self = constants.%C
  358. // CHECK:STDOUT: }
  359. // CHECK:STDOUT:
  360. // CHECK:STDOUT: --- fail_todo_class_with_qualified_rewrite.carbon
  361. // CHECK:STDOUT:
  362. // CHECK:STDOUT: constants {
  363. // CHECK:STDOUT: %K.type: type = facet_type <@K> [concrete]
  364. // CHECK:STDOUT: %Self: %K.type = symbolic_binding Self, 0 [symbolic]
  365. // CHECK:STDOUT: %K.assoc_type: type = assoc_entity_type @K [concrete]
  366. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.WithSelf.%X [concrete]
  367. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  368. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  369. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  370. // CHECK:STDOUT: }
  371. // CHECK:STDOUT:
  372. // CHECK:STDOUT: interface @J;
  373. // CHECK:STDOUT:
  374. // CHECK:STDOUT: interface @K {
  375. // CHECK:STDOUT: %Self: %K.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  376. // CHECK:STDOUT: %K.WithSelf.decl = interface_with_self_decl @K [concrete]
  377. // CHECK:STDOUT:
  378. // CHECK:STDOUT: !with Self:
  379. // CHECK:STDOUT: %X: type = assoc_const_decl @X [concrete] {
  380. // CHECK:STDOUT: %assoc0: %K.assoc_type = assoc_entity element0, @K.WithSelf.%X [concrete = constants.%assoc0]
  381. // CHECK:STDOUT: }
  382. // CHECK:STDOUT:
  383. // CHECK:STDOUT: !members:
  384. // CHECK:STDOUT: .Self = %Self
  385. // CHECK:STDOUT: .X = @X.%assoc0
  386. // CHECK:STDOUT: witness = (@K.WithSelf.%X)
  387. // CHECK:STDOUT:
  388. // CHECK:STDOUT: !requires:
  389. // CHECK:STDOUT: }
  390. // CHECK:STDOUT:
  391. // CHECK:STDOUT: class @C {
  392. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  393. // CHECK:STDOUT: complete_type_witness = %complete_type
  394. // CHECK:STDOUT:
  395. // CHECK:STDOUT: !members:
  396. // CHECK:STDOUT: .Self = constants.%C
  397. // CHECK:STDOUT: }
  398. // CHECK:STDOUT:
  399. // CHECK:STDOUT: specific @K.WithSelf(constants.%Self) {}
  400. // CHECK:STDOUT:
  401. // CHECK:STDOUT: --- incomplete_where.carbon
  402. // CHECK:STDOUT:
  403. // CHECK:STDOUT: constants {
  404. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  405. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  406. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  407. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  408. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  409. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  410. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  411. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  412. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where .Self impls @Incomplete> [concrete]
  413. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete]
  414. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  415. // CHECK:STDOUT: }
  416. // CHECK:STDOUT:
  417. // CHECK:STDOUT: file {
  418. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  419. // CHECK:STDOUT: .C = %C.decl
  420. // CHECK:STDOUT: .I = %I.decl
  421. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  422. // CHECK:STDOUT: }
  423. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  424. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  425. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  426. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  427. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  428. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  429. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  430. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  431. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  432. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  433. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  434. // CHECK:STDOUT: %.loc8_13: type = where_expr [concrete = constants.%I_where.type] {
  435. // CHECK:STDOUT: requirement_base_facet_type %I.ref
  436. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref
  437. // CHECK:STDOUT: }
  438. // CHECK:STDOUT: }
  439. // CHECK:STDOUT: }
  440. // CHECK:STDOUT:
  441. // CHECK:STDOUT: interface @I {
  442. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  443. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  444. // CHECK:STDOUT:
  445. // CHECK:STDOUT: !members:
  446. // CHECK:STDOUT: .Self = %Self
  447. // CHECK:STDOUT: witness = ()
  448. // CHECK:STDOUT:
  449. // CHECK:STDOUT: !requires:
  450. // CHECK:STDOUT: }
  451. // CHECK:STDOUT:
  452. // CHECK:STDOUT: interface @Incomplete;
  453. // CHECK:STDOUT:
  454. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc8_13 {
  455. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @C.as.I.impl [concrete]
  456. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  457. // CHECK:STDOUT:
  458. // CHECK:STDOUT: !members:
  459. // CHECK:STDOUT: witness = %I.impl_witness
  460. // CHECK:STDOUT: }
  461. // CHECK:STDOUT:
  462. // CHECK:STDOUT: class @C {
  463. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  464. // CHECK:STDOUT: complete_type_witness = %complete_type
  465. // CHECK:STDOUT:
  466. // CHECK:STDOUT: !members:
  467. // CHECK:STDOUT: .Self = constants.%C
  468. // CHECK:STDOUT: }
  469. // CHECK:STDOUT:
  470. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {
  471. // CHECK:STDOUT: !definition:
  472. // CHECK:STDOUT: }
  473. // CHECK:STDOUT:
  474. // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet) {
  475. // CHECK:STDOUT: !definition:
  476. // CHECK:STDOUT: }
  477. // CHECK:STDOUT:
  478. // CHECK:STDOUT: --- declaration_incomplete_where_rewrite.carbon
  479. // CHECK:STDOUT:
  480. // CHECK:STDOUT: constants {
  481. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  482. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  483. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  484. // CHECK:STDOUT: %J.type: type = facet_type <@J> [concrete]
  485. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic]
  486. // CHECK:STDOUT: %J.assoc_type: type = assoc_entity_type @J [concrete]
  487. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.WithSelf.%T [concrete]
  488. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  489. // CHECK:STDOUT: %.Self: %J.type = symbolic_binding .Self [symbolic_self]
  490. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  491. // CHECK:STDOUT: %J.lookup_impl_witness: <witness> = lookup_impl_witness %.Self, @J [symbolic_self]
  492. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %J.lookup_impl_witness, element0 [symbolic_self]
  493. // CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]
  494. // CHECK:STDOUT: %empty_tuple: %empty_tuple.type = tuple_value () [concrete]
  495. // CHECK:STDOUT: %J_where.type: type = facet_type <@J where .Self impls @Incomplete and %impl.elem0 = %empty_tuple.type> [concrete]
  496. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness @C.as.J.impl.%J.impl_witness_table [concrete]
  497. // CHECK:STDOUT: %J.facet: %J.type = facet_value %C, (%J.impl_witness) [concrete]
  498. // CHECK:STDOUT: }
  499. // CHECK:STDOUT:
  500. // CHECK:STDOUT: file {
  501. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  502. // CHECK:STDOUT: .C = %C.decl
  503. // CHECK:STDOUT: .J = %J.decl
  504. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  505. // CHECK:STDOUT: }
  506. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  507. // CHECK:STDOUT: %J.decl: type = interface_decl @J [concrete = constants.%J.type] {} {}
  508. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  509. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  510. // CHECK:STDOUT: %C.ref.loc8: type = name_ref C, file.%C.decl [concrete = constants.%C]
  511. // CHECK:STDOUT: %J.ref.loc8: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  512. // CHECK:STDOUT: %.Self.2: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  513. // CHECK:STDOUT: %.Self.ref.loc8_19: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  514. // CHECK:STDOUT: %Incomplete.ref.loc8: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  515. // CHECK:STDOUT: %.Self.as_type.loc8_19: type = facet_access_type %.Self.ref.loc8_19 [symbolic_self = constants.%.Self.as_type]
  516. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref.loc8_19, %.Self.as_type.loc8_19 [symbolic_self = constants.%.Self.as_type]
  517. // CHECK:STDOUT: %.Self.ref.loc8_46: %J.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self]
  518. // CHECK:STDOUT: %.Self.as_type.loc8_46: type = facet_access_type %.Self.ref.loc8_46 [symbolic_self = constants.%.Self.as_type]
  519. // CHECK:STDOUT: %.loc8_46: type = converted %.Self.ref.loc8_46, %.Self.as_type.loc8_46 [symbolic_self = constants.%.Self.as_type]
  520. // CHECK:STDOUT: %T.ref.loc8: %J.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  521. // CHECK:STDOUT: %impl.elem0.loc8: type = impl_witness_access constants.%J.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  522. // CHECK:STDOUT: %.loc8_52.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  523. // CHECK:STDOUT: %.loc8_52.2: type = converted %.loc8_52.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  524. // CHECK:STDOUT: %.loc8_13: type = where_expr [concrete = constants.%J_where.type] {
  525. // CHECK:STDOUT: requirement_base_facet_type %J.ref.loc8
  526. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref.loc8
  527. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc8, %.loc8_52.2
  528. // CHECK:STDOUT: }
  529. // CHECK:STDOUT: }
  530. // CHECK:STDOUT: impl_decl @C.as.J.impl [concrete] {} {
  531. // CHECK:STDOUT: %C.ref.loc10: type = name_ref C, file.%C.decl [concrete = constants.%C]
  532. // CHECK:STDOUT: %J.ref.loc10: type = name_ref J, file.%J.decl [concrete = constants.%J.type]
  533. // CHECK:STDOUT: %.Self.1: %J.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  534. // CHECK:STDOUT: %.Self.ref.loc10_19: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  535. // CHECK:STDOUT: %Incomplete.ref.loc10: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  536. // CHECK:STDOUT: %.Self.as_type.loc10_19: type = facet_access_type %.Self.ref.loc10_19 [symbolic_self = constants.%.Self.as_type]
  537. // CHECK:STDOUT: %.loc10_19: type = converted %.Self.ref.loc10_19, %.Self.as_type.loc10_19 [symbolic_self = constants.%.Self.as_type]
  538. // CHECK:STDOUT: %.Self.ref.loc10_46: %J.type = name_ref .Self, %.Self.1 [symbolic_self = constants.%.Self]
  539. // CHECK:STDOUT: %.Self.as_type.loc10_46: type = facet_access_type %.Self.ref.loc10_46 [symbolic_self = constants.%.Self.as_type]
  540. // CHECK:STDOUT: %.loc10_46: type = converted %.Self.ref.loc10_46, %.Self.as_type.loc10_46 [symbolic_self = constants.%.Self.as_type]
  541. // CHECK:STDOUT: %T.ref.loc10: %J.assoc_type = name_ref T, @T.%assoc0 [concrete = constants.%assoc0]
  542. // CHECK:STDOUT: %impl.elem0.loc10: type = impl_witness_access constants.%J.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  543. // CHECK:STDOUT: %.loc10_52.1: %empty_tuple.type = tuple_literal () [concrete = constants.%empty_tuple]
  544. // CHECK:STDOUT: %.loc10_52.2: type = converted %.loc10_52.1, constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  545. // CHECK:STDOUT: %.loc10_13: type = where_expr [concrete = constants.%J_where.type] {
  546. // CHECK:STDOUT: requirement_base_facet_type %J.ref.loc10
  547. // CHECK:STDOUT: requirement_impls %.loc10_19, %Incomplete.ref.loc10
  548. // CHECK:STDOUT: requirement_rewrite %impl.elem0.loc10, %.loc10_52.2
  549. // CHECK:STDOUT: }
  550. // CHECK:STDOUT: }
  551. // CHECK:STDOUT: }
  552. // CHECK:STDOUT:
  553. // CHECK:STDOUT: interface @J {
  554. // CHECK:STDOUT: %Self: %J.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  555. // CHECK:STDOUT: %J.WithSelf.decl = interface_with_self_decl @J [concrete]
  556. // CHECK:STDOUT:
  557. // CHECK:STDOUT: !with Self:
  558. // CHECK:STDOUT: %T: type = assoc_const_decl @T [concrete] {
  559. // CHECK:STDOUT: %assoc0: %J.assoc_type = assoc_entity element0, @J.WithSelf.%T [concrete = constants.%assoc0]
  560. // CHECK:STDOUT: }
  561. // CHECK:STDOUT:
  562. // CHECK:STDOUT: !members:
  563. // CHECK:STDOUT: .Self = %Self
  564. // CHECK:STDOUT: .T = @T.%assoc0
  565. // CHECK:STDOUT: witness = (@J.WithSelf.%T)
  566. // CHECK:STDOUT:
  567. // CHECK:STDOUT: !requires:
  568. // CHECK:STDOUT: }
  569. // CHECK:STDOUT:
  570. // CHECK:STDOUT: interface @Incomplete;
  571. // CHECK:STDOUT:
  572. // CHECK:STDOUT: impl @C.as.J.impl: %C.ref.loc8 as %.loc8_13 {
  573. // CHECK:STDOUT: %J.impl_witness_table = impl_witness_table (%impl_witness_assoc_constant), @C.as.J.impl [concrete]
  574. // CHECK:STDOUT: %J.impl_witness: <witness> = impl_witness %J.impl_witness_table [concrete = constants.%J.impl_witness]
  575. // CHECK:STDOUT: %impl_witness_assoc_constant: type = impl_witness_assoc_constant constants.%empty_tuple.type [concrete = constants.%empty_tuple.type]
  576. // CHECK:STDOUT:
  577. // CHECK:STDOUT: !members:
  578. // CHECK:STDOUT: witness = %J.impl_witness
  579. // CHECK:STDOUT: }
  580. // CHECK:STDOUT:
  581. // CHECK:STDOUT: class @C {
  582. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  583. // CHECK:STDOUT: complete_type_witness = %complete_type
  584. // CHECK:STDOUT:
  585. // CHECK:STDOUT: !members:
  586. // CHECK:STDOUT: .Self = constants.%C
  587. // CHECK:STDOUT: }
  588. // CHECK:STDOUT:
  589. // CHECK:STDOUT: specific @J.WithSelf(constants.%Self) {
  590. // CHECK:STDOUT: !definition:
  591. // CHECK:STDOUT: }
  592. // CHECK:STDOUT:
  593. // CHECK:STDOUT: specific @J.WithSelf(constants.%.Self) {
  594. // CHECK:STDOUT: !definition:
  595. // CHECK:STDOUT: }
  596. // CHECK:STDOUT:
  597. // CHECK:STDOUT: specific @J.WithSelf(constants.%J.facet) {
  598. // CHECK:STDOUT: !definition:
  599. // CHECK:STDOUT: }
  600. // CHECK:STDOUT:
  601. // CHECK:STDOUT: --- fail_declaration_lookup_into_incomplete.carbon
  602. // CHECK:STDOUT:
  603. // CHECK:STDOUT: constants {
  604. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  605. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  606. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  607. // CHECK:STDOUT: %I.type: type = facet_type <@I> [concrete]
  608. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic]
  609. // CHECK:STDOUT: %Incomplete.type: type = facet_type <@Incomplete> [concrete]
  610. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self]
  611. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self [symbolic_self]
  612. // CHECK:STDOUT: %I_where.type: type = facet_type <@I where .Self impls @Incomplete> [concrete]
  613. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness @C.as.I.impl.%I.impl_witness_table [concrete]
  614. // CHECK:STDOUT: %C.as.I.impl.F.type: type = fn_type @C.as.I.impl.F [concrete]
  615. // CHECK:STDOUT: %C.as.I.impl.F: %C.as.I.impl.F.type = struct_value () [concrete]
  616. // CHECK:STDOUT: %I.facet: %I.type = facet_value %C, (%I.impl_witness) [concrete]
  617. // CHECK:STDOUT: }
  618. // CHECK:STDOUT:
  619. // CHECK:STDOUT: file {
  620. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  621. // CHECK:STDOUT: .C = %C.decl
  622. // CHECK:STDOUT: .I = %I.decl
  623. // CHECK:STDOUT: .Incomplete = %Incomplete.decl
  624. // CHECK:STDOUT: }
  625. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  626. // CHECK:STDOUT: %I.decl: type = interface_decl @I [concrete = constants.%I.type] {} {}
  627. // CHECK:STDOUT: %Incomplete.decl: type = interface_decl @Incomplete [concrete = constants.%Incomplete.type] {} {}
  628. // CHECK:STDOUT: impl_decl @C.as.I.impl [concrete] {} {
  629. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  630. // CHECK:STDOUT: %I.ref: type = name_ref I, file.%I.decl [concrete = constants.%I.type]
  631. // CHECK:STDOUT: %.Self: %I.type = symbolic_binding .Self [symbolic_self = constants.%.Self]
  632. // CHECK:STDOUT: %.Self.ref: %I.type = name_ref .Self, %.Self [symbolic_self = constants.%.Self]
  633. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  634. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  635. // CHECK:STDOUT: %.loc8_19: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  636. // CHECK:STDOUT: %.loc8_13: type = where_expr [concrete = constants.%I_where.type] {
  637. // CHECK:STDOUT: requirement_base_facet_type %I.ref
  638. // CHECK:STDOUT: requirement_impls %.loc8_19, %Incomplete.ref
  639. // CHECK:STDOUT: }
  640. // CHECK:STDOUT: }
  641. // CHECK:STDOUT: }
  642. // CHECK:STDOUT:
  643. // CHECK:STDOUT: interface @I {
  644. // CHECK:STDOUT: %Self: %I.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  645. // CHECK:STDOUT: %I.WithSelf.decl = interface_with_self_decl @I [concrete]
  646. // CHECK:STDOUT:
  647. // CHECK:STDOUT: !members:
  648. // CHECK:STDOUT: .Self = %Self
  649. // CHECK:STDOUT: witness = ()
  650. // CHECK:STDOUT:
  651. // CHECK:STDOUT: !requires:
  652. // CHECK:STDOUT: }
  653. // CHECK:STDOUT:
  654. // CHECK:STDOUT: interface @Incomplete;
  655. // CHECK:STDOUT:
  656. // CHECK:STDOUT: impl @C.as.I.impl: %C.ref as %.loc8_13 {
  657. // CHECK:STDOUT: %C.as.I.impl.F.decl: %C.as.I.impl.F.type = fn_decl @C.as.I.impl.F [concrete = constants.%C.as.I.impl.F] {
  658. // CHECK:STDOUT: %return.patt: <error> = return_slot_pattern <error>, <error> [concrete]
  659. // CHECK:STDOUT: } {
  660. // CHECK:STDOUT: %Self.ref: type = name_ref Self, @C.as.I.impl.%C.ref [concrete = constants.%C]
  661. // CHECK:STDOUT: %Incomplete.ref: type = name_ref Incomplete, file.%Incomplete.decl [concrete = constants.%Incomplete.type]
  662. // CHECK:STDOUT: %T.ref: <error> = name_ref T, <error> [concrete = <error>]
  663. // CHECK:STDOUT: %return: <error> = return_slot <error>
  664. // CHECK:STDOUT: }
  665. // CHECK:STDOUT: %I.impl_witness_table = impl_witness_table (), @C.as.I.impl [concrete]
  666. // CHECK:STDOUT: %I.impl_witness: <witness> = impl_witness %I.impl_witness_table [concrete = constants.%I.impl_witness]
  667. // CHECK:STDOUT:
  668. // CHECK:STDOUT: !members:
  669. // CHECK:STDOUT: .Incomplete = <poisoned>
  670. // CHECK:STDOUT: .F = %C.as.I.impl.F.decl
  671. // CHECK:STDOUT: witness = %I.impl_witness
  672. // CHECK:STDOUT: }
  673. // CHECK:STDOUT:
  674. // CHECK:STDOUT: class @C {
  675. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  676. // CHECK:STDOUT: complete_type_witness = %complete_type
  677. // CHECK:STDOUT:
  678. // CHECK:STDOUT: !members:
  679. // CHECK:STDOUT: .Self = constants.%C
  680. // CHECK:STDOUT: }
  681. // CHECK:STDOUT:
  682. // CHECK:STDOUT: fn @C.as.I.impl.F() -> <error>;
  683. // CHECK:STDOUT:
  684. // CHECK:STDOUT: specific @I.WithSelf(constants.%Self) {
  685. // CHECK:STDOUT: !definition:
  686. // CHECK:STDOUT: }
  687. // CHECK:STDOUT:
  688. // CHECK:STDOUT: specific @I.WithSelf(constants.%I.facet) {
  689. // CHECK:STDOUT: !definition:
  690. // CHECK:STDOUT: }
  691. // CHECK:STDOUT:
  692. // CHECK:STDOUT: --- fail_unidentified_constraint.carbon
  693. // CHECK:STDOUT:
  694. // CHECK:STDOUT: constants {
  695. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  696. // CHECK:STDOUT: %C: type = class_type @C [concrete]
  697. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  698. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness %empty_struct_type [concrete]
  699. // CHECK:STDOUT: }
  700. // CHECK:STDOUT:
  701. // CHECK:STDOUT: file {
  702. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  703. // CHECK:STDOUT: .X = %X.decl
  704. // CHECK:STDOUT: .C = %C.decl
  705. // CHECK:STDOUT: }
  706. // CHECK:STDOUT: %X.decl: type = constraint_decl @X [concrete = constants.%X.type] {} {}
  707. // CHECK:STDOUT: %C.decl: type = class_decl @C [concrete = constants.%C] {} {}
  708. // CHECK:STDOUT: impl_decl @C.as.<error>.impl [concrete] {} {
  709. // CHECK:STDOUT: %C.ref: type = name_ref C, file.%C.decl [concrete = constants.%C]
  710. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  711. // CHECK:STDOUT: }
  712. // CHECK:STDOUT: }
  713. // CHECK:STDOUT:
  714. // CHECK:STDOUT: constraint @X;
  715. // CHECK:STDOUT:
  716. // CHECK:STDOUT: impl @C.as.<error>.impl: %C.ref as %X.ref;
  717. // CHECK:STDOUT:
  718. // CHECK:STDOUT: class @C {
  719. // CHECK:STDOUT: %complete_type: <witness> = complete_type_witness constants.%empty_struct_type [concrete = constants.%complete_type]
  720. // CHECK:STDOUT: complete_type_witness = %complete_type
  721. // CHECK:STDOUT:
  722. // CHECK:STDOUT: !members:
  723. // CHECK:STDOUT: .Self = constants.%C
  724. // CHECK:STDOUT: }
  725. // CHECK:STDOUT:
  726. // CHECK:STDOUT: --- nested_require_incomplete_interface.carbon
  727. // CHECK:STDOUT:
  728. // CHECK:STDOUT: constants {
  729. // CHECK:STDOUT: %Z.type: type = facet_type <@Z> [concrete]
  730. // CHECK:STDOUT: %Y.type: type = facet_type <@Y> [concrete]
  731. // CHECK:STDOUT: %Self.550: %Y.type = symbolic_binding Self, 0 [symbolic]
  732. // CHECK:STDOUT: %Self.as_type.92a: type = facet_access_type %Self.550 [symbolic]
  733. // CHECK:STDOUT: %X.type: type = facet_type <@X> [concrete]
  734. // CHECK:STDOUT: %Self.e52: %X.type = symbolic_binding Self, 0 [symbolic]
  735. // CHECK:STDOUT: %X.assoc_type: type = assoc_entity_type @X [concrete]
  736. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.WithSelf.%X1 [concrete]
  737. // CHECK:STDOUT: %Self.as_type.dff: type = facet_access_type %Self.e52 [symbolic]
  738. // CHECK:STDOUT: %type: type = facet_type <type> [concrete]
  739. // CHECK:STDOUT: %.Self.c39: %type = symbolic_binding .Self [symbolic_self]
  740. // CHECK:STDOUT: %.Self.637: %X.type = symbolic_binding .Self [symbolic_self]
  741. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.637 [symbolic_self]
  742. // CHECK:STDOUT: %X.lookup_impl_witness: <witness> = lookup_impl_witness %.Self.637, @X [symbolic_self]
  743. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access %X.lookup_impl_witness, element0 [symbolic_self]
  744. // CHECK:STDOUT: %empty_struct_type: type = struct_type {} [concrete]
  745. // CHECK:STDOUT: %empty_struct: %empty_struct_type = struct_value () [concrete]
  746. // CHECK:STDOUT: %X_where.type: type = facet_type <@X where %impl.elem0 = %empty_struct_type> [concrete]
  747. // CHECK:STDOUT: %pattern_type: type = pattern_type %X_where.type [concrete]
  748. // CHECK:STDOUT: %T: %X_where.type = symbolic_binding T, 0 [symbolic]
  749. // CHECK:STDOUT: %F.type: type = fn_type @F [concrete]
  750. // CHECK:STDOUT: %F: %F.type = struct_value () [concrete]
  751. // CHECK:STDOUT: }
  752. // CHECK:STDOUT:
  753. // CHECK:STDOUT: file {
  754. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  755. // CHECK:STDOUT: .Z = %Z.decl
  756. // CHECK:STDOUT: .Y = %Y.decl
  757. // CHECK:STDOUT: .X = %X.decl
  758. // CHECK:STDOUT: .F = %F.decl
  759. // CHECK:STDOUT: }
  760. // CHECK:STDOUT: %Z.decl: type = interface_decl @Z [concrete = constants.%Z.type] {} {}
  761. // CHECK:STDOUT: %Y.decl: type = constraint_decl @Y [concrete = constants.%Y.type] {} {}
  762. // CHECK:STDOUT: %X.decl: type = interface_decl @X [concrete = constants.%X.type] {} {}
  763. // CHECK:STDOUT: %F.decl: %F.type = fn_decl @F [concrete = constants.%F] {
  764. // CHECK:STDOUT: %T.patt: %pattern_type = symbolic_binding_pattern T, 0 [concrete]
  765. // CHECK:STDOUT: } {
  766. // CHECK:STDOUT: %.loc16_19.1: type = splice_block %.loc16_19.2 [concrete = constants.%X_where.type] {
  767. // CHECK:STDOUT: %.Self.1: %type = symbolic_binding .Self [symbolic_self = constants.%.Self.c39]
  768. // CHECK:STDOUT: %X.ref: type = name_ref X, file.%X.decl [concrete = constants.%X.type]
  769. // CHECK:STDOUT: %.Self.2: %X.type = symbolic_binding .Self [symbolic_self = constants.%.Self.637]
  770. // CHECK:STDOUT: %.Self.ref: %X.type = name_ref .Self, %.Self.2 [symbolic_self = constants.%.Self.637]
  771. // CHECK:STDOUT: %.Self.as_type: type = facet_access_type %.Self.ref [symbolic_self = constants.%.Self.as_type]
  772. // CHECK:STDOUT: %.loc16_25: type = converted %.Self.ref, %.Self.as_type [symbolic_self = constants.%.Self.as_type]
  773. // CHECK:STDOUT: %X1.ref: %X.assoc_type = name_ref X1, @X1.%assoc0 [concrete = constants.%assoc0]
  774. // CHECK:STDOUT: %impl.elem0: type = impl_witness_access constants.%X.lookup_impl_witness, element0 [symbolic_self = constants.%impl.elem0]
  775. // CHECK:STDOUT: %.loc16_32.1: %empty_struct_type = struct_literal () [concrete = constants.%empty_struct]
  776. // CHECK:STDOUT: %.loc16_32.2: type = converted %.loc16_32.1, constants.%empty_struct_type [concrete = constants.%empty_struct_type]
  777. // CHECK:STDOUT: %.loc16_19.2: type = where_expr [concrete = constants.%X_where.type] {
  778. // CHECK:STDOUT: requirement_base_facet_type %X.ref
  779. // CHECK:STDOUT: requirement_rewrite %impl.elem0, %.loc16_32.2
  780. // CHECK:STDOUT: }
  781. // CHECK:STDOUT: }
  782. // CHECK:STDOUT: %T.loc16_14.2: %X_where.type = symbolic_binding T, 0 [symbolic = %T.loc16_14.1 (constants.%T)]
  783. // CHECK:STDOUT: }
  784. // CHECK:STDOUT: }
  785. // CHECK:STDOUT:
  786. // CHECK:STDOUT: interface @Z;
  787. // CHECK:STDOUT:
  788. // CHECK:STDOUT: interface @X {
  789. // CHECK:STDOUT: %Self: %X.type = symbolic_binding Self, 0 [symbolic = constants.%Self.e52]
  790. // CHECK:STDOUT: %X.WithSelf.decl = interface_with_self_decl @X [concrete]
  791. // CHECK:STDOUT:
  792. // CHECK:STDOUT: !with Self:
  793. // CHECK:STDOUT: %X1: type = assoc_const_decl @X1 [concrete] {
  794. // CHECK:STDOUT: %assoc0: %X.assoc_type = assoc_entity element0, @X.WithSelf.%X1 [concrete = constants.%assoc0]
  795. // CHECK:STDOUT: }
  796. // CHECK:STDOUT: %X.WithSelf.Self.as_type.impls.Y.type.require.decl = require_decl @X.WithSelf.Self.as_type.impls.Y.type.require [concrete] {
  797. // CHECK:STDOUT: require %Self.as_type.loc12_11.1 impls %Y.ref
  798. // CHECK:STDOUT: } {
  799. // CHECK:STDOUT: %Self.as_type.loc12_11.1: type = facet_access_type @X.%Self [symbolic = %Self.as_type.loc12_11.2 (constants.%Self.as_type.dff)]
  800. // CHECK:STDOUT: %Y.ref: type = name_ref Y, file.%Y.decl [concrete = constants.%Y.type]
  801. // CHECK:STDOUT: }
  802. // CHECK:STDOUT:
  803. // CHECK:STDOUT: !members:
  804. // CHECK:STDOUT: .Self = %Self
  805. // CHECK:STDOUT: .Y = <poisoned>
  806. // CHECK:STDOUT: .X1 = @X1.%assoc0
  807. // CHECK:STDOUT: .Y = <poisoned>
  808. // CHECK:STDOUT: witness = (@X.WithSelf.%X1)
  809. // CHECK:STDOUT:
  810. // CHECK:STDOUT: !requires:
  811. // CHECK:STDOUT: @X.WithSelf.Self.as_type.impls.Y.type.require {
  812. // CHECK:STDOUT: require @X.WithSelf.Self.as_type.impls.Y.type.require.%Self.as_type.loc12_11.1 impls @X.WithSelf.Self.as_type.impls.Y.type.require.%Y.ref
  813. // CHECK:STDOUT: }
  814. // CHECK:STDOUT: }
  815. // CHECK:STDOUT:
  816. // CHECK:STDOUT: constraint @Y {
  817. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = constants.%Self.550]
  818. // CHECK:STDOUT: %Y.WithSelf.decl = constraint_with_self_decl @Y [concrete]
  819. // CHECK:STDOUT:
  820. // CHECK:STDOUT: !with Self:
  821. // CHECK:STDOUT: %Y.WithSelf.Self.as_type.impls.Z.type.require.decl = require_decl @Y.WithSelf.Self.as_type.impls.Z.type.require [concrete] {
  822. // CHECK:STDOUT: require %Self.as_type.loc6_11.1 impls %Z.ref
  823. // CHECK:STDOUT: } {
  824. // CHECK:STDOUT: %Self.as_type.loc6_11.1: type = facet_access_type @Y.%Self [symbolic = %Self.as_type.loc6_11.2 (constants.%Self.as_type.92a)]
  825. // CHECK:STDOUT: %Z.ref: type = name_ref Z, file.%Z.decl [concrete = constants.%Z.type]
  826. // CHECK:STDOUT: }
  827. // CHECK:STDOUT:
  828. // CHECK:STDOUT: !members:
  829. // CHECK:STDOUT: .Self = %Self
  830. // CHECK:STDOUT: .Z = <poisoned>
  831. // CHECK:STDOUT: .Z = <poisoned>
  832. // CHECK:STDOUT:
  833. // CHECK:STDOUT: !requires:
  834. // CHECK:STDOUT: @Y.WithSelf.Self.as_type.impls.Z.type.require {
  835. // CHECK:STDOUT: require @Y.WithSelf.Self.as_type.impls.Z.type.require.%Self.as_type.loc6_11.1 impls @Y.WithSelf.Self.as_type.impls.Z.type.require.%Z.ref
  836. // CHECK:STDOUT: }
  837. // CHECK:STDOUT: }
  838. // CHECK:STDOUT:
  839. // CHECK:STDOUT: generic require @Y.WithSelf.Self.as_type.impls.Z.type.require(@Y.%Self: %Y.type) {
  840. // CHECK:STDOUT: %Self: %Y.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.550)]
  841. // CHECK:STDOUT: %Self.as_type.loc6_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc6_11.2 (constants.%Self.as_type.92a)]
  842. // CHECK:STDOUT: }
  843. // CHECK:STDOUT:
  844. // CHECK:STDOUT: generic require @X.WithSelf.Self.as_type.impls.Y.type.require(@X.%Self: %X.type) {
  845. // CHECK:STDOUT: %Self: %X.type = symbolic_binding Self, 0 [symbolic = %Self (constants.%Self.e52)]
  846. // CHECK:STDOUT: %Self.as_type.loc12_11.2: type = facet_access_type %Self [symbolic = %Self.as_type.loc12_11.2 (constants.%Self.as_type.dff)]
  847. // CHECK:STDOUT: }
  848. // CHECK:STDOUT:
  849. // CHECK:STDOUT: generic fn @F(%T.loc16_14.2: %X_where.type) {
  850. // CHECK:STDOUT: %T.loc16_14.1: %X_where.type = symbolic_binding T, 0 [symbolic = %T.loc16_14.1 (constants.%T)]
  851. // CHECK:STDOUT:
  852. // CHECK:STDOUT: !definition:
  853. // CHECK:STDOUT:
  854. // CHECK:STDOUT: fn() {
  855. // CHECK:STDOUT: !entry:
  856. // CHECK:STDOUT: return
  857. // CHECK:STDOUT: }
  858. // CHECK:STDOUT: }
  859. // CHECK:STDOUT:
  860. // CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.550) {}
  861. // CHECK:STDOUT:
  862. // CHECK:STDOUT: specific @Y.WithSelf.Self.as_type.impls.Z.type.require(constants.%Self.550) {
  863. // CHECK:STDOUT: %Self => constants.%Self.550
  864. // CHECK:STDOUT: %Self.as_type.loc6_11.2 => constants.%Self.as_type.92a
  865. // CHECK:STDOUT: }
  866. // CHECK:STDOUT:
  867. // CHECK:STDOUT: specific @X.WithSelf(constants.%Self.e52) {
  868. // CHECK:STDOUT: !definition:
  869. // CHECK:STDOUT: }
  870. // CHECK:STDOUT:
  871. // CHECK:STDOUT: specific @Y.WithSelf(constants.%Self.e52) {
  872. // CHECK:STDOUT: !definition:
  873. // CHECK:STDOUT: }
  874. // CHECK:STDOUT:
  875. // CHECK:STDOUT: specific @Y.WithSelf.Self.as_type.impls.Z.type.require(constants.%Self.e52) {
  876. // CHECK:STDOUT: %Self => constants.%Self.e52
  877. // CHECK:STDOUT: %Self.as_type.loc6_11.2 => constants.%Self.as_type.dff
  878. // CHECK:STDOUT: }
  879. // CHECK:STDOUT:
  880. // CHECK:STDOUT: specific @X.WithSelf.Self.as_type.impls.Y.type.require(constants.%Self.e52) {
  881. // CHECK:STDOUT: %Self => constants.%Self.e52
  882. // CHECK:STDOUT: %Self.as_type.loc12_11.2 => constants.%Self.as_type.dff
  883. // CHECK:STDOUT: }
  884. // CHECK:STDOUT:
  885. // CHECK:STDOUT: specific @X.WithSelf(constants.%.Self.637) {
  886. // CHECK:STDOUT: !definition:
  887. // CHECK:STDOUT: }
  888. // CHECK:STDOUT:
  889. // CHECK:STDOUT: specific @F(constants.%T) {
  890. // CHECK:STDOUT: %T.loc16_14.1 => constants.%T
  891. // CHECK:STDOUT: }
  892. // CHECK:STDOUT:
  893. // CHECK:STDOUT: --- fail_incomplete_constraint.carbon
  894. // CHECK:STDOUT:
  895. // CHECK:STDOUT: constants {
  896. // CHECK:STDOUT: %A.type: type = facet_type <@A> [concrete]
  897. // CHECK:STDOUT: %B.type: type = facet_type <@B> [concrete]
  898. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic]
  899. // CHECK:STDOUT: }
  900. // CHECK:STDOUT:
  901. // CHECK:STDOUT: file {
  902. // CHECK:STDOUT: package: <namespace> = namespace [concrete] {
  903. // CHECK:STDOUT: .A = %A.decl
  904. // CHECK:STDOUT: .B = %B.decl
  905. // CHECK:STDOUT: }
  906. // CHECK:STDOUT: %A.decl: type = constraint_decl @A [concrete = constants.%A.type] {} {}
  907. // CHECK:STDOUT: %B.decl: type = interface_decl @B [concrete = constants.%B.type] {} {}
  908. // CHECK:STDOUT: }
  909. // CHECK:STDOUT:
  910. // CHECK:STDOUT: interface @B {
  911. // CHECK:STDOUT: %Self: %B.type = symbolic_binding Self, 0 [symbolic = constants.%Self]
  912. // CHECK:STDOUT: %B.WithSelf.decl = interface_with_self_decl @B [concrete]
  913. // CHECK:STDOUT:
  914. // CHECK:STDOUT: !members:
  915. // CHECK:STDOUT: .Self = %Self
  916. // CHECK:STDOUT: .A = <poisoned>
  917. // CHECK:STDOUT: .A = <poisoned>
  918. // CHECK:STDOUT: witness = ()
  919. // CHECK:STDOUT:
  920. // CHECK:STDOUT: !requires:
  921. // CHECK:STDOUT: }
  922. // CHECK:STDOUT:
  923. // CHECK:STDOUT: constraint @A;
  924. // CHECK:STDOUT:
  925. // CHECK:STDOUT: specific @B.WithSelf(constants.%Self) {}
  926. // CHECK:STDOUT: